Re: [fpc-pascal] Floating point question

2024-02-17 Thread Bernd Oppolzer via fpc-pascal
Am 17.02.2024 um 20:18 schrieb Florian Klämpfl via fpc-pascal: const Xconst : single = 1440.0; var y1, y2 : real; y1 := 33.0 / 1440.0; y2 :=  33.0 / Xconst; the division in the first assignment (to y1) should be done at maximum precision, that is, both constants should be converted by the

Re: [fpc-pascal] Floating point question

2024-02-17 Thread Florian Klämpfl via fpc-pascal
> Am 16.02.2024 um 15:34 schrieb Bernd Oppolzer via fpc-pascal > : > > Am 16.02.2024 um 08:32 schrieb Florian Klämpfl via fpc-pascal: >> Am 16.02.2024 um 08:23 schrieb Ern Aldo via fpc-pascal >> : >>> >>>  Compile-time math needs to be as correct as p

Re: [fpc-pascal] Can FPC link a program with static (.a) libraries on Windows

2024-02-17 Thread tony.whyman via fpc-pascal
Thanks. Easy to forget that there are 3 ways to link to external libraries.  Original message From: Sven Barth via fpc-pascal Date: 17/02/2024 00:29 (GMT+00:00) To: FPC-Pascal users discussions Cc: Sven Barth Subject: Re: [fpc-pascal] Can FPC link a program with static (.a

Re: [fpc-pascal] Floating point question

2024-02-17 Thread Bernd Oppolzer via fpc-pascal
Am 17.02.2024 um 16:38 schrieb Bernd Oppolzer: IMO, a compiler switch that gives all FP constants the best available precision would solve the problem - BTW: WITHOUT forcing expressions where they appear to use this precision, if the other parts of the expression have lower precision. In fac

Re: [fpc-pascal] Floating point question

2024-02-17 Thread Bernd Oppolzer via fpc-pascal
Am 17.02.2024 um 14:38 schrieb Michael Van Canneyt via fpc-pascal: There can be discussion about the rules that the compiler uses when it chooses a type, but any given set of rules will always have consequences that may or may not be desirable. Possibly some compiler switches can be invented

Re: [fpc-pascal] Floating point question

2024-02-17 Thread Michael Van Canneyt via fpc-pascal
On Sat, 17 Feb 2024, wkitty42--- via fpc-pascal wrote: On 2/16/24 9:57 AM, James Richters via fpc-pascal wrote: So you are saying when constant propagation is on, an expression should have a different result than with constant propagation off? The result of math when using constants MUST b

Re: [fpc-pascal] Floating point question

2024-02-17 Thread wkitty42--- via fpc-pascal
On 2/16/24 9:57 AM, James Richters via fpc-pascal wrote: So you are saying when constant propagation is on, an expression should have a different result than with constant propagation off? The result of math when using constants MUST be the same as the result of identical math using variables

Re: [fpc-pascal] Floating point question

2024-02-17 Thread Bernd Oppolzer via fpc-pascal
Am 17.02.2024 um 02:12 schrieb Ern Aldo via fpc-pascal: It is possible math is being done differently by the compiler than by programs? For math-related source code, the compiler compiles the instructions and writes them to the program file for execution at runtime. For compile-time constant