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


  • Hero Member
  • *****
  • Posts: 1570
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.


  • Hero Member
  • *****
  • Posts: 1610
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 & 2.0.2 w/FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.


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

Apparently Pascal headers are available for Free Pascal:

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


  • Sr. Member
  • ****
  • Posts: 377
  • 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.


  • New member
  • *
  • Posts: 41
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 »


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