So I need to do this?
AA = Extended(8427+Extended(33/Extended(1440.0)));

That seems excessive when   BB = 8427+33/1440.1;   Has no problem

The thing I have an issue with is 
BB = 8427+33/1440.1;     is done the way I want it to, and
BB = 8427+33/1440.01;   is done the way I want it to, and
BB = 8427+33/1440;        is done the way I want it to, but
BB = 8427+33/1440.0;     is done a different way.

To me these should all be done the same way.  And they would have all been done 
the same way before the 2.2 change, that change works for every case except 
when there is a .0,  A  .01 at the end is fine,  a .001234 at the end is fine, 
its JUST .0 that's not fine.

This is inconsistent,  why didn't the 1440.1 version reduce to a single?  It 
fits in a single, and I didn't specify it any differently than 1440.0.
This lack of consistency is that's leading me to think it's more of a bug..
Everything I put in the denominator, other than something that ends with .0 
works as I expect, it's ONLY when there is a .0 that things go wrong. 

Why is 1440.0 different that 1440.1? 

Say I have a program with some constants at the top, and the program has been 
working flawlessly for years, and now I change one
Constant from something with a .001 in the denominator to a .000 in the 
denominator,  I know it's lazy, just change the 1 to a 0 and don't delete the 
useless 0's after the decimal point, , but now I have all kinds of imprecision, 
but if I would have changed it to .0000001 instead, it is still fine, and 
anything other than .0 is fine.  Why is .0 special and .1 is not?

Having one single way to do it that causes drastically differently results is a 
bug,  it should be consistent.  That way when I'm testing I will see that I 
need to cast the denominator as an extended and it will always work the same 
way.   It's this working different ways with nearly the same input that I have 
an issue with.    When I learned Turbo Pascal in technical school, no one EVER 
said you need to cast your constants, and it wasn't in the text book either.   

All of my examples above should be processed the same way,  if 1440.1 doesn't 
force single precision, then 1440.0 should not force single precision either. 

James

-----Original Message-----
From: fpc-pascal <fpc-pascal-boun...@lists.freepascal.org> On Behalf Of Jonas 
Maebe via fpc-pascal
Sent: Sunday, February 4, 2024 5:25 PM
To: fpc-pascal@lists.freepascal.org
Cc: Jonas Maebe <jo...@freepascal.org>
Subject: Re: [fpc-pascal] Floating point question

On 04/02/2024 23:21, James Richters via fpc-pascal wrote:
> Shouldn’t this do all calculations as Extended?
> 
> AA = Extended(8427+33/1440.0);

No, this only tells the compiler to interpret the result as extended.


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

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

Reply via email to