Recent

Author Topic: High precision float?  (Read 752 times)

jamie

  • Hero Member
  • *****
  • Posts: 1117
Re: High precision float?
« Reply #15 on: January 11, 2019, 11:51:19 pm »
if  you can live with a 4 digit fraction then try the Currency Type.

lucamar

  • Hero Member
  • *****
  • Posts: 717
Re: High precision float?
« Reply #16 on: January 11, 2019, 11:56:04 pm »
Just Curious:

Is easy to work with BCD numbers? Can be used to floating point operations?

Very easy and yes, can be used for floating point operation. Any-point operation, in fact, with the appropiate design. :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 1.8.4/FPC 3.0.4 on:
(K)Ubuntu 12..16, Windows XP SP3 (Home/Prof.) and various DOS incarnations.

Kays

  • Full Member
  • ***
  • Posts: 122
  • Whasup!?
    • KaiBurghardt.de
Re: High precision float?
« Reply #17 on: January 12, 2019, 01:28:39 am »
[…]
If really necessary you could try:

https://gmplib.org/

Apparently Pascal headers are available for Free Pascal:

https://github.com/VadimAnIsaev/GNU-MP-for-FreePascal

I have not tried these.
[…]
“Try”? Just use. GMP works fine. However, I wanna note the headers – not the ones you referenced – are available as part of the package fp-units-math. They might be dated, but still I prefer work that's done at one single place. Therefore I don't know what to think of Vadim's work.
« Last Edit: January 12, 2019, 03:09:45 am by Kays »
Yours Sincerely
Kai Burghardt

PascalDragon

  • Full Member
  • ***
  • Posts: 227
  • Compiler Developer
Re: High precision float?
« Reply #18 on: January 14, 2019, 09:23:12 am »
@440bx : A real extended is 80 bit default on 32 bit, but only 64 bit on x86_64, but:
That limitation is technically only for window x86_64 due to Win64 ABI limitations on win64. E.g. Linux x86_64 can be compiled to use the fpu unit and so can ( not default) support 80 bit. You need to compile the compiler yourself to have that feature. Anyway really high precision (much better than 80 bit) is available in software at an additional speed cost. And the x87 FPU feature on x86_64 is also kind of slow.
Not quite correct: all x86_64 targets except Win64 have Extended enabled by default. Only for Win64 one must enable it by recompiling the compiler with FPC_SUPPORT_X87_TYPES_ON_WIN64 (see compiler/x86_64/symcpu.pas, line 181 and compiler/psystem.pas, line 314) - of course the remainder of the FPC distribution needs to be compiled then as well.

silvestre

  • New member
  • *
  • Posts: 37
Re: High precision float?
« Reply #19 on: January 14, 2019, 10:24:13 am »
A clearer explanation on your part would help, you haven't exposed any real problems and we don't have any example code to analyze.... Please, expose the details to the forum, the interventions will be more useful.

Unfortunatly double isnt enough. For some reason extended doesnt seem to improve the situation more than double.
The calculations are some rather simple mathematical series.
Althoug I need to run them around 100 times, the errors add up.
« Last Edit: January 14, 2019, 10:28:29 am by silvestre »

srvaldez

  • Newbie
  • Posts: 2
Re: High precision float?
« Reply #20 on: January 14, 2019, 01:30:49 pm »
here's another arbitrary precision floating point math library, MParith http://www.wolfgang-ehrhardt.de/mp_intro.html
Quote
The MPArith package contains Pascal/Delphi source for multi precision integer, rational, real and complex floating point arithmetic and functions