Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-29 Thread Sven Barth via fpc-pascal
Am 29.08.2017 08:35 schrieb "Michael Schnell" : > > On 28.08.2017 08:04, Sven Barth via fpc-pascal wrote:I don't understand why we will have no more the right to use it under x64 OS... >> >> >> Because Microsoft declared it as deprecated. That means that should Microsoft ever bring out a 64-bit onl

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-28 Thread Michael Schnell
On 28.08.2017 08:04, Sven Barth via fpc-pascal wrote:I don't understand why we will have no more the right to use it under x64 OS... Because Microsoft declared it as deprecated. That means that should Microsoft ever bring out a 64-bit only OS ... In fact this still is a (mere) portability pro

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-28 Thread Michael Schnell
On 28.08.2017 00:23, Ched wrote: But sometimes, we absolutely need numerical precision, so we have to assume the costs in terms of runtime and possibly nonportability. I understand that when compiling to an x32 32 Bit executable, 80 Bit Extended should be fine. -Michael __

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-28 Thread Florian Klaempfl
Am 24.08.2017 um 23:45 schrieb Ched: > And under "modern" Windows, the extended type, which is fully supported > by the FPU, is *degraded* to double. So, I can't do high precision > computation with fpc even if the native hardware permits such > computations. FP permits it too, just recompile it

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-27 Thread Sven Barth via fpc-pascal
Am 28.08.2017 00:32 schrieb "Ched" < charles.edouard.des.vastes.vig...@gmail.com>: > > Hello, > > I agree that the extended type is not portable and not as fast as double. > > But sometimes, we absolutely need numerical precision, so we have to assume the costs in terms of runtime and possibly nonp

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-27 Thread Ched
Hello, I agree that the extended type is not portable and not as fast as double. But sometimes, we absolutely need numerical precision, so we have to assume the costs in terms of runtime and possibly nonportability. When the algorithms are nearly optimal, there is no room for software enhancem

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-25 Thread Michael Schnell
On 25.08.2017 01:32, Ralf Quint wrote: It's not a problem of "modern" Windows, but a problem of any 64bit x86 OS Supposedly of (m)any non-x64 archs as well. Hence relying on "extended" is not portable. -Michael ___ fpc-pascal maillist - fpc-pasc

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-25 Thread Michael Schnell
On 23.08.2017 14:11, Benito van der Zander wrote: Btw, anyone know about a BCD math implementation for Free Pascal, like it used to be implemented in DR CBASIC? (those were the days... ;-) ) Why do BCD math if you need a predefined number of correct digits after the "point" and a "limited" coun

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-25 Thread Tomas Hajny
On Fri, August 25, 2017 14:31, Sven Barth via fpc-pascal wrote: . . >> Good point... It's in package rtl-objpas. I can see it included in the >> standard FPC 3.0.2 installation, but it's missing in 3.0.4 at the >> moment, >> because it got lost in the transition from fpcmake to fpmake apparently.

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-25 Thread Sven Barth via fpc-pascal
Am 24.08.2017 23:26 schrieb "Tomas Hajny" : > > On Thu, August 24, 2017 22:25, Ralf Quint wrote: > > On 8/24/2017 2:18 AM, Sven Barth via fpc-pascal wrote: > >> > >> Am 23.08.2017 02:16 schrieb "Paul Nance" >> >: > >> > > >> > Turbo Pascal also had a BCD unit. > >> > >> F

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Sven Barth via fpc-pascal
Am 25.08.2017 01:33 schrieb "Ralf Quint" : > > On 8/24/2017 2:45 PM, Ched wrote: > > And under "modern" Windows, the extended type, which is fully > > supported by the FPU, is *degraded* to double. So, I can't do high > > precision computation with fpc even if the native hardware permits > > such c

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Ralf Quint
On 8/24/2017 2:45 PM, Ched wrote: > And under "modern" Windows, the extended type, which is fully > supported by the FPU, is *degraded* to double. So, I can't do high > precision computation with fpc even if the native hardware permits > such computations. I'm glued to XP as the full capabilities o

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Sven Barth via fpc-pascal
Am 24.08.2017 23:46 schrieb "Ched" < charles.edouard.des.vastes.vig...@gmail.com>: > > And under "modern" Windows, the extended type, which is fully supported by the FPU, is *degraded* to double. So, I can't do high precision computation with fpc even if the native hardware permits such computation

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Ched
And under "modern" Windows, the extended type, which is fully supported by the FPU, is *degraded* to double. So, I can't do high precision computation with fpc even if the native hardware permits such computations. I'm glued to XP as the full capabilities of the FPU were on the hands of programme

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Bernd Oppolzer
Am 24.08.2017 um 14:00 schrieb James Richters: Thanks everyone for the explanation and solutions.  I can work around it well enough now that I understand what’s happening, but I’m still curious if there is a way to define fixed point variables?  In a C++ Project I was helping with recently, t

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Bernd Oppolzer
Am 24.08.2017 um 15:02 schrieb el es: On 24/08/17 13:26, Sven Barth via fpc-pascal wrote: [...] Note: FPC (and Delphi) has a single fixed point type which is Currency. AFAIK it uses four digits after the comma and 28 in front of it. Regards, Sven There was a project I remember, that I was to

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Tomas Hajny
On Thu, August 24, 2017 22:25, Ralf Quint wrote: > On 8/24/2017 2:18 AM, Sven Barth via fpc-pascal wrote: >> >> Am 23.08.2017 02:16 schrieb "Paul Nance" > >: >> > >> > Turbo Pascal also had a BCD unit. >> >> Free Pascal also has a BCD unit: FmtBCD. It provides a BCD type a

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Ralf Quint
On 8/24/2017 2:18 AM, Sven Barth via fpc-pascal wrote: > > Am 23.08.2017 02:16 schrieb "Paul Nance" >: > > > > Turbo Pascal also had a BCD unit. > > Free Pascal also has a BCD unit: FmtBCD. It provides a BCD type and > operators as well operator overloads. > And where wou

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Peter
FPC has a header for the GMP library. Regards, Peter B ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread el es
On 24/08/17 13:26, Sven Barth via fpc-pascal wrote: [...] > > Note: FPC (and Delphi) has a single fixed point type which is > Currency. AFAIK it uses four digits after the comma and 28 in front > of it. > > Regards, Sven > There was a project I remember, that I was told, for some e.g. tax purpo

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Sven Barth via fpc-pascal
Am 24.08.2017 14:00 schrieb "James Richters" : > > Thanks everyone for the explanation and solutions. I can work around it well enough now that I understand what’s happening, but I’m still curious if there is a way to define fixed point variables? In a C++ Project I was helping with recently, the

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread James Richters
Subject: Re: [fpc-pascal] Freepascal Floating Point Issue Am 22.08.2017 00:02 schrieb "James Richters" mailto:ja...@productionautomation.net> >: The others already wrote about floating point precision, so I won't repeat that. > The reason I noticed this is because

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-24 Thread Sven Barth via fpc-pascal
Am 23.08.2017 02:16 schrieb "Paul Nance" : > > Turbo Pascal also had a BCD unit. Free Pascal also has a BCD unit: FmtBCD. It provides a BCD type and operators as well operator overloads. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepas

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-23 Thread Ralf Quint
On 8/22/2017 5:16 PM, Paul Nance wrote: > Turbo Pascal also had a BCD unit. Well, no, there was no unit, rather a version of Turbo Pascal 3.0x had a version that natively used BCD math for "reals" instead of the 6byte REAL type, just as there was a x87 version that used hardware x87 FP (IEEE754) fl

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-23 Thread Ralf Quint
On 8/23/2017 5:11 AM, Benito van der Zander wrote: >> Btw, anyone know about a BCD math implementation for Free Pascal, like >> it used to be implemented in DR CBASIC? (those were the days... ;-) ) > > > I have one here: http://benibela.de/sources_en.html#bigdecimalmath Thanks, but that is not quit

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-23 Thread Benito van der Zander
Btw, anyone know about a BCD math implementation for Free Pascal, like it used to be implemented in DR CBASIC? (those were the days... ;-) ) I have one here: http://benibela.de/sources_en.html#bigdecimalmath Am 23.08.2017 um 02:16 schrieb Paul Nance: Turbo Pascal also had a BCD unit. On Au

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-22 Thread Paul Nance
Turbo Pascal also had a BCD unit. On Aug 22, 2017 6:56 PM, "Ralf Quint" wrote: > On 8/22/2017 1:39 PM, Mark Morgan Lloyd wrote: > > On 21/08/17 22:15, Ralf Quint wrote: > >> On 8/21/2017 3:02 PM, James Richters wrote:> I am having an issue > >> with a simple floating point application. I am set

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-22 Thread Ralf Quint
On 8/22/2017 1:39 PM, Mark Morgan Lloyd wrote: > On 21/08/17 22:15, Ralf Quint wrote: >> On 8/21/2017 3:02 PM, James Richters wrote:> I am having an issue >> with a simple floating point application.  I am setting a variable to >> a specific value and immediately after I set it,  it is not exactly

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-22 Thread Mark Morgan Lloyd
On 21/08/17 22:15, Ralf Quint wrote: On 8/21/2017 3:02 PM, James Richters wrote:> I am having an issue with a simple floating point application. I am setting a variable to a specific value and immediately after I set it, it is not exactly what I set it to. Here's an example>>Draw_GX_Min:

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-22 Thread Sven Barth via fpc-pascal
Am 22.08.2017 18:11 schrieb "Peter" : > > Hi James, > > Its unlikely that 999.999 has an EXACT representation in floating point. > > 999.999002 maybe the closest value at your chosen precision. > > Extended type has more precision, but still probably won't be exact. Additionally Extended

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-22 Thread Peter
Hi James, Its unlikely that 999.999 has an EXACT representation in floating point. 999.999002 maybe the closest value at your chosen precision. Extended type has more precision, but still probably won't be exact. Regards, Peter B ___ fpc-pa

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-21 Thread bernd.oppol...@t-online.de
arth via fpc-pascal Betreff: Re: [fpc-pascal] Freepascal Floating Point Issue Datum: 22.08.2017, 7:54 Uhr An: FPC-Pascal users discussions Cc: Sven Barth Am 22.08.2017 00:02 schrieb "James Richters" < ja...@productionautomation.net <mailto:ja...@productionautomation.net> >

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-21 Thread Sven Barth via fpc-pascal
Am 22.08.2017 00:02 schrieb "James Richters" : The others already wrote about floating point precision, so I won't repeat that. > The reason I noticed this is because I have some conditional statements like > If Draw_GX_Min<>99.999 then > Something *DON'T* compare floating point numbers

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-21 Thread Daniel Franzini
Long story short: not every single real number have an *exact* representation in the computer. You have to live with that and learn the limitations and pitfalls of floating point calculations. On Mon, Aug 21, 2017 at 7:42 PM, Ralf Quint wrote: > On 8/21/2017 3:34 PM, Daniel Franzini wrote: > > I

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-21 Thread Ralf Quint
On 8/21/2017 3:34 PM, Daniel Franzini wrote: > It might be the case (I didn't do the math) that 999.999 doesn't have > an exact representation in IEEE-754 double-precision format, so the > best you get is an aproximation (a pretty good one, btw). Just use WriteLn (Draw_GX_Min:3:16) and you get no m

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-21 Thread Daniel Franzini
It might be the case (I didn't do the math) that 999.999 doesn't have an exact representation in IEEE-754 double-precision format, so the best you get is an aproximation (a pretty good one, btw). On Mon, Aug 21, 2017 at 7:10 PM, Ralf Quint wrote: > On 8/21/2017 3:02 PM, James Richters wrote: > >

Re: [fpc-pascal] Freepascal Floating Point Issue

2017-08-21 Thread Ralf Quint
On 8/21/2017 3:02 PM, James Richters wrote: > I am having an issue with a simple floating point application. I am setting > a variable to a specific value and immediately after I set it, it is not > exactly what I set it to. Here's an example > >Draw_GX_Min:=999.999; >Writeln(Draw_GX_M

[fpc-pascal] Freepascal Floating Point Issue

2017-08-21 Thread James Richters
I am having an issue with a simple floating point application. I am setting a variable to a specific value and immediately after I set it, it is not exactly what I set it to. Here's an example Draw_GX_Min:=999.999; Writeln(Draw_GX_Min:3:30); The writeln results in 999.999002000