trunc

Eric Chatonet eric.chatonet at sosmartsoftware.com
Mon Feb 11 06:11:43 EST 2008


Or:

function logicalTrunc n
   if n is not a number then return "NAN"
   return n - (n mod 1)
end logicalTrunc

Le 10 févr. 08 à 03:03, Richard Gaskin a écrit :

> You can work around this using a function that apparently eludes the
> authors of most languages:
>
> function logicalTrunc n
>   if n is not a number then return "NAN"
>   get offset(".", n)
>   if it > 0 then
>      delete char it to -1 of n
>   end if
>   return n
> end logicalTrunc

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list