• where is double precision INFINITY and NAN defined?

    From Rainard Buchmann@21:1/5 to All on Sun Jul 31 14:33:40 2016
    i Just tried the following, it won't compile:

    CONST
    INFINITY = CAST(REAL64, 7FF0000000000000H);
    NINFINITY = CAST(REAL64, FFF0000000000000H);

    compiler says illegal type cast... bummer... how can I get these magic
    values into a constant?


    in ADW-Modula-2 you may use :

    CONST
    INFINITY = VAL (LONGREAL, 7FF0000000000000H) ;
    NINFINITY = VAL (LONGREAL, 0FFF0000000000000H) ;

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From magicmouse94937@gmail.com@21:1/5 to All on Sun Aug 21 23:54:40 2016
    Thanks for the tip, it turns out there is a slight quirk, almost a bug, where if you define a type like
    TYPE REAL64 = LONGREAL

    then try to do the cast to a REAL64 it won't work... it only allows raw casting to low level primitive types, not an alias to the same type... I don't know why i liked the name REAL64 better than longreal, but hey that is easy to fix!

    now if only i could get a clean ISO library for RealtoStr that doesn't introduce rounding errors, i should be all set.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin Brown@21:1/5 to magicmouse94937@gmail.com on Mon Aug 22 09:54:05 2016
    On 22/08/2016 07:54, magicmouse94937@gmail.com wrote:

    now if only i could get a clean ISO library for RealtoStr that doesn't introduce rounding errors, i should be all set.


    In what sense does ISO RealToStr introduce rounding errors?

    I recall an FP bug back in prehistory where under certain circumstances
    the behaviour of TRUNC could be subverted by the FPU rounding settings
    being non-standard in the Logitech M2 OS/2 compiler.

    This first showed in floating point numbers drifting upwards by 1lsb of
    display with each data refresh when a GUI was being used.

    Perhaps if you posted the offending code it might be possible to check
    it on other compilers.

    --
    Regards,
    Martin Brown

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)