Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Truncation

 [1/4] from: ptretter::charter::net at: 31-Jul-2000 12:31


How do you truncate a number. For example if I have the following: num: 47.2393 How do I get just the 47. I want to return only the first part before the decimal and do NOT want to round the number. Paul Tretter

 [2/4] from: larry:ecotope at: 31-Jul-2000 10:49


Hi Paul Well for numbers of absolute magnitude less than 2,147,483,647 (i.e., within the range of the integer datatype) you can do this:
>> to-integer 47.2393
== 47 HTH -Larry

 [3/4] from: ptretter:charter at: 31-Jul-2000 13:59


Damn I thought I tried that. Thanks, I knew it was something simple.

 [4/4] from: lmecir:geocities at: 31-Jul-2000 23:07


Hi Paul, for more info see www.rebol.org/math/rounding.r Regards Ladislav