On 2/4/2024 11:15 AM, James Richters via fpc-pascal wrote:
I understand that the result depends on the variables and expressions,
The problem with constants used in an expression is that some determination
needs to be made because it's not specified.
Since it's not specified, then I think it should be implied to be the same
as the variable it would be stored in, if that determination cannot be made,
then maximum precision should be used.
I don't think that this "implied" applies in my experience to pretty much all programming languages that I have used in the last 47 years that do offer various forms of floating point formats. Not specifying in a program, specially in a strict programming language like Pascal, will always result in implementation depending variations/assumptions.

And if those variations are not to your liking, then simply specify (type cast) those constants to more precisely get the result you expect. This is Pascal after all, not Python or other over-ooped programming language that is making assumptions about your code all the time...


Ralf

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

Reply via email to