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 - set decimals to establish the number of decimal places displayed http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 set decimals to     Establish the number of decimal places displayed
------------------------------------------------------------------------------
 Syntax
   set decimals to uDecimals

 Arguments
   uDecimals is a numeric expression determining the decimals setting.

 Description
   The set decimals to command establishes the number of decimal places
   displayed for double-precision values.

   The range for uDecimals is 0 to 15. The default value is 2. The
   set decimals to command has an effect only when set fixed is on,
   otherwise all non-zero decimal digits are displayed.

 Example
   #define EXAMPLE_MATH
   #include example.hdr

   proc Test_setdecimalsto
   vardef
      uint n
   enddef
   ? 15, CONST_E      // all non-zero decimals displayed
   set fixed on       // without this call set decimals to has no effect
   ?  2, CONST_E      // corresponds to the default setting of 2
   for n := 0 to 15
      set decimals to n
      ? n, CONST_E
   next
   endproc

   proc main
   Test_setdecimalsto()
   endproc

See Also: getdecimals() set fixed

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