Re: [fpc-pascal] Floating point question

2024-02-11 Thread Jonas Maebe via fpc-pascal

On 11/02/2024 23:21, Bernd Oppolzer via fpc-pascal wrote:
and this would IMHO be the solution which is the easiest to document and 
maybe to implement

and which would satisfy the users.


And generate the slowest code possible on most platforms.


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Floating point question

2024-02-11 Thread Bernd Oppolzer via fpc-pascal

Am 11.02.2024 um 17:31 schrieb Florian Klämpfl via fpc-pascal:

On 09.02.24 15:00, greim--- via fpc-pascal wrote:

Hi,

my test with Borland Pascal 7.0 running in dosemu2 running 80x87 code.
The compiler throws an error message for calculating HH and II with 
explicit type conversion.

The results of FF and GG are the same!
Even on 16 bit system!

I think this behavior is right!


The x87 fpu behavior is completely flawed as its precision is not 
dependent on the instruction used but the state of the fpu.


Overall, the intermediate float precision is a very difficult topic. 
The famous Goldberg article 
(https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html) does 
not suggest to use the highest possible precision after all. And an 
additional interesting read: 
https://randomascii.wordpress.com/2012/03/21/intermediate-floating-point-precision/


Many thanks for the links, I read them with interest; for me - working 
almost every day with IBM systems -
the remarks on the old IBM FP hex format (base 16) are very interesting. 
Today's IBM systems support IEEE as well.


IMO, the question regarding FP constants (not variables) in compilers is 
not yet answered fully. If we have an expression
consisting only of FP constants like in the original coding: should the 
FP constants indeed given different
FP types by the compiler? Or should the FP constants maybe have all the 
same type .. the largest type available?
This would automatically lead to a computation using the maximum 
precision, no matter if it is done at compile time
or at run time ... and this would IMHO be the solution which is the 
easiest to document and maybe to implement

and which would satisfy the users.

Kind regards

Bernd Oppolzer

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Floating point question

2024-02-11 Thread Florian Klämpfl via fpc-pascal

On 09.02.24 15:00, greim--- via fpc-pascal wrote:

Hi,

my test with Borland Pascal 7.0 running in dosemu2 running 80x87 code.
The compiler throws an error message for calculating HH and II with 
explicit type conversion.

The results of FF and GG are the same!
Even on 16 bit system!

I think this behavior is right!


The x87 fpu behavior is completely flawed as its precision is not 
dependent on the instruction used but the state of the fpu.


Overall, the intermediate float precision is a very difficult topic. The 
famous Goldberg article 
(https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html) does 
not suggest to use the highest possible precision after all. And an 
additional interesting read: 
https://randomascii.wordpress.com/2012/03/21/intermediate-floating-point-precision/


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal