lua-users home
lua-l archive

Re: Unexpected calculation result with Lua53

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,
On 4 May 2015 at 10:45, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>
> Lua 5.3, for better or words, has a syntactic convention that "1" is
> an exact integer whereas "1." is a (by coincidence exact) approximation
> to it. In Lua 5.3, when approximations are preferred one should always
> code "1.", and in a situation where exactness is needed, one should
> always code "1". Even computer users who are not computer scientists
> can surely be trained to do that. Heck, even some pure mathematicians
> have been known to grasp this point.
>
Time for a quick Scheme REPL:
===============
11:38 $ gsi
Gambit v4.7.5
> (exact? 1)
#t
> (exact? 1.)
#f
===============
The different obviously being that Scheme exact numbers are unbounded.
Cheers,
-- 
-alex
http://unendli.ch/

AltStyle によって変換されたページ (->オリジナル) /