Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - __matherror store error from the last math function call http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 __matherror         Store error from the last math function call
------------------------------------------------------------------------------
 Declaration
   math.hdr

 Syntax
   uint __matherror

 Default
   0.

 Description
   The __matherror system variable contains the error code resulting
   from the last call to certain math functions. Such functions are ln(),
   log(), log10(), ldexp(), and frexp(). Possible values for __matherror
   are defined in math.hdr.

   When the numeric passed to a logarithm calculating function has the
   value of zero, __matherror is set to the ME_SING (singularity) error,
   and the function returns negative DBL_MAX. When the passed number is
   negative, then __matherror is set to the ME_DOMAIN (domain error)
   value, and again negative DBL_MAX is returned. On overflow, __matherror
   is set to ME_OVERFLOW, and the value DBL_MAX is returned. On underflow
   0.0 is returned, and __matherror is set to ME_UNDERFLOW.

 Example
   #define EXAMPLE_MATH
   #include example.hdr

   proc Test_matherror
   ? log10( 100 )                    // prints 2.0
   ? __matherror                     // prints 0
   ? log10(   0 )                    // prints negative DBL_MAX
   ? __matherror                     // prints ME_SING
   ? log10(  -1 )                    // prints negative DBL_MAX
   ? __matherror                     // prints ME_DOMAIN
   endproc

   proc main
   Test_matherror()
   endproc

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson