[fpc-pascal] round(2.5)=2

wkitty42 at windstream.net wkitty42 at windstream.net
Thu Jun 14 15:51:34 CEST 2018


On 06/13/2018 04:17 AM, Michael Schnell wrote:
> On 12.06.2018 23:12, Klaus Hartnegg wrote:
>>
>> No, it does not depend on the hardware, but on the setting of $N. Turbo Pascal 
>> with $N+ rounds like FreePascal. But the default is $N-. In this mode Turbo 
>> Pascal always rounds up.
>>
> What exactly does $N in Turbo pascal mean ? Obviously it in this case it (at 
> least for round() ) does not simply use the hardware for the calculation (as fpc 
> does).

$N switches between using "software code" OR using "a math coprocessor chip" for 
real-type processing... transcribing the following while reading it off another 
machine running TP6's Turbo CTRL-F1 screen... typos are mine...


{$N}
Numeric Processing Switch
=========================
Switches between the two different models of floating-point code generation 
supported by Turbo Pascal

   Syntax:  {$N+} or {$N-}
   Default: {$N-}
   Type:    Global
   Menus:   [X] 8087/80287


The {$N-} State
===============
In the {$N-} state, Turbo Pascal generates code to perform all real-type 
calculations in software by calling run-time library routines.


The {$N+} State
===============
In the {$N+} state, Turbo Pascal generates code to perform all real-type 
calculations using the 8087 numeric coprocessor.

* NOTE: You can also use the {$E+} directive to emulate the 8087. This gives you 
access to the IEEE floating-point types without requiring that you install an 
8087 chip.




-- 
  NOTE: No off-list assistance is given without prior approval.
        *Please keep mailing list traffic on the list unless*
        *a signed and pre-paid contract is in effect with us.*



More information about the fpc-pascal mailing list