Re: [fpc-pascal] round(2.5)=2

2018-06-13 Thread Florian Klämpfl
Am 13.06.2018 um 22:19 schrieb Marco van de Voort: In our previous episode, Florian Kl?mpfl said: In our previous episode, Sven Barth via fpc-pascal said: Which is what FPC already provides with SetRoundMode() in unit Math. As long as one changes the rounding mode only locally for some

Re: [fpc-pascal] round(2.5)=2

2018-06-13 Thread Marco van de Voort
In our previous episode, Florian Kl?mpfl said: > > In our previous episode, Sven Barth via fpc-pascal said: > >> Which is what FPC already provides with SetRoundMode() in unit Math. > >> > >> As long as one changes the rounding mode only locally for some calculations > >> and restores it

Re: [fpc-pascal] round(2.5)=2

2018-06-13 Thread Florian Klämpfl
Am 13. Juni 2018 5:39:08 nachm. schrieb mar...@stack.nl (Marco van de Voort): > In our previous episode, Sven Barth via fpc-pascal said: >> Which is what FPC already provides with SetRoundMode() in unit Math. >> >> As long as one changes the rounding mode only locally for some calculations >>

Re: [fpc-pascal] round(2.5)=2

2018-06-13 Thread Marco van de Voort
In our previous episode, Sven Barth via fpc-pascal said: > Which is what FPC already provides with SetRoundMode() in unit Math. > > As long as one changes the rounding mode only locally for some calculations > and restores it afterwards there should be no problem (the rounding mode > can be

Re: [fpc-pascal] round(2.5)=2

2018-06-13 Thread Santiago A.
El 12/06/2018 a las 23:12, Klaus Hartnegg escribió: Am 11.06.2018 um 10:01 schrieb Michael Schnell:  - the way of rounding is defined by the CPU hardware, even old Turbo Pascal executables do banker's rouding on modern hardware. No, it does not depend on the hardware, but on the setting of

Re: [fpc-pascal] round(2.5)=2

2018-06-13 Thread Sven Barth via fpc-pascal
Wolf schrieb am Mi., 13. Juni 2018, 09:27: > Why not ask the CPU to do the rounding? This is what Intel offers in > volume 1 of the Intel ® 64 and IA-32 Architectures Software Developer's > Manual: > 4.8.4.1 > Rounding Control (RC) Fields > In the Intel 64 and IA-32 architectures, the rounding

Re: [fpc-pascal] round(2.5)=2

2018-06-13 Thread Wolf
Why not ask the CPU to do the rounding? This is what Intel offers in volume 1 of the Intel ® 64 and IA-32 Architectures Software Developer's Manual: 4.8.4.1  Rounding Control (RC) Fields In the Intel 64 and IA-32 architectures, the rounding mode is controlled by a 2-bit rounding-control (RC)

Re: [fpc-pascal] round(2.5)=2

2018-06-13 Thread Michael Schnell
On 12.06.2018 09:01, Mattias Gaertner wrote: Floats can represent 1.5 exactly. Of course I do know how the binary representation of floats is done on X86 and similar architectures, and hence that same provides a bit combination that exactly defines 1.5. That is why I did say *relying* on the