[fpc-pascal] Floating point question
Ralf Quint
freedos.la at gmail.com
Sun Feb 4 21:06:59 CET 2024
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20240204/0bd7feb4/attachment.htm>
More information about the fpc-pascal
mailing list