Forum > General

Why MaxDouble does not equal to MaxDouble?

<< < (2/9) > >>

Zoran:
Instead of old Math.MaxDouble, use Double.MaxValue. You only need SysUtils in uses, for type helper. It is declared as typed constant:
https://www.freepascal.org/docs-html/current/rtl/sysutils/tdoublehelper.maxvalue.html

mtrsoft:
The above replies are all correct.

A few additional minor observations.

1. You are running Windows x86 which supports the FPU and the Extended type.

2. On Windows x64 and 64 bit apps the Extended type is an alias for the Double type so there shouldn't be an issue.

3. One reason for sticking with 32-bit apps is that the Extended type and FPU are supported.

4. The Extended type has 19 to 20 significant digits whle the Double type has only 14 to 15 significant digits. (I know most people seldom need that many sig. fig., but....)

5. The Extended type has a greater dynamic range of a bit more the e+/-4000. (Again, not often needed, but can be useful.)

John

jollytall:
I actually use Linux 64 bit, and I always use Double as my "standard" floating point type (maybe a bad practice? thoughts?). Double should be by definition 64 bits, shouldn't it? Extended can be 80 bits on x64, so how could they be the same under Windows?

A related question: I also use Integer as my "standard" integer type as an old habit. Is it actually slower than using Int64 on an x64 platform, or does not matter? As Integer is a variable type being SmallInt or LongInt based on the processor (16bit or 32 or more bits), shouldn't it be "even more variable", being SmallInt (16bit), LongInt(32bit) or Int64(64bit) depending on the system?

Warfley:

--- Quote from: mtrsoft on October 05, 2024, 07:38:52 am ---1. You are running Windows x86 which supports the FPU and the Extended type.

2. On Windows x64 and 64 bit apps the Extended type is an alias for the Double type so there shouldn't be an issue.

--- End quote ---

Depending on your FPC configuration, the fpc can simulate 80bit float operations in software if no FPU support is available, so this is not necessarily true.

tetrastes:

--- Quote from: Warfley on October 05, 2024, 11:59:53 am ---
--- Quote from: mtrsoft on October 05, 2024, 07:38:52 am ---1. You are running Windows x86 which supports the FPU and the Extended type.

2. On Windows x64 and 64 bit apps the Extended type is an alias for the Double type so there shouldn't be an issue.

--- End quote ---

Depending on your FPC configuration, the fpc can simulate 80bit float operations in software if no FPU support is available, so this is not necessarily true.

--- End quote ---

Really? I would prefer that fpc uses 80 bit float operations at win64, where x87 fpu is present. May be you know how to configure this? 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version