lua-users home
lua-l archive

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


It was thus said that the Great Dirk Laurie once stated:
> 2018-06-13 2:13 GMT+02:00 Albert Chan <albertmcchan@yahoo.com>:
> > Thanks Hartmut for the HP-15C test.
> > It seems HP-15C does *decimal* math, 10 significant digits, half-round-up
> >
> > s = (a + b + c) / 2
> > = (1e5 + 99999.99979 + 0.00029) / 2
> > = (199999.9998 + 0.00029) / 2   -- round up
> > = 200000.0001 / 2                         -- round up again
> > = 100000.0001                               -- half-round-up
> >
> > I have never seen a calculator like this ...
> 
> I have an HP41C, but it no longer works. I can recall, however, that
> it correctly evaluated 1e97 mod 97. Default Lua 5.3 on my machine says
> "1e97"%"97" is 3, which is wrong. Lua 5.3 built as `make linux -e
> MYCFLAGS=-DLUA_NOCVTS2N` and with a module supplying appropriate
> string metamethods, gets it right. My much more modern calculator of a
> different brand also gets it wrong.)

[spc]lucy:~>lua-51
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> print(1e97 % 97)
-8.8928324534259e+79
> 
[spc]lucy:~>lua-52
Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> print(1e97 % 97)
-8.8928324534259e+79
> 
[spc]lucy:~>lua-53
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
> print(1e97 % 97)
3.0
> 

I don't think any of these are right.

  -spc