[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: integer exponentiation with negative exponent
- From: Hartmut Henkel <hartmut_henkel@...>
- Date: Mon, 14 Apr 2014 20:01:58 +0200 (CEST)
On Mon, 14 Apr 2014, Dirk Laurie wrote:
> 2014-04-14 15:42 GMT+02:00 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>
> > The error option has the advantage that it calls the programmer
> > attention to the fact that the operation might not be doing what she
> > intended, and so she has to be more explicit (e.g., ensuring that
> > one of the operands is a float).
>
> True. But when that programmer coded, three years ago, `eps = 2^-48`,
> she did not know that one day it would be an error. And we do not
> (yet?) have Python-style throwing and catching of exceptions.
yes, such eps has to keep working, it's so basic, familiar, so expected.
Lua is also a very handy scratchpad language (replacing the pocket
calculator) for quick and dirty, fast scripts, so helpful. One wants to
type fast, so why typing 4.0, if 4 has worked? For Lua it's imho normal
to expect a float result for 2^-48, and many existing programs are coded
like that. Lua is imho not the integer expert's tool, no need, it has
many other key virtues (above all the C-Lua-stack, speed, tables, &
Lpeg). There are way more float-happy programmers than integer experts i
would guess, now all float-happy programmers would have to get "more
explicit"? Before wanting 64 bit integers (what's magic with 64?), i
would like to have arbitrary number sizes instead. Even calc, a brillant
workhorse for arbitrary size integer arithmetics, converts with negative
exponents to float. And i would expect also a float result for 2^100,
and not 0 silently (as in work2), when 2.0^100 is just 1.26e+30? Maybe
one could do 2^^61 for the integer experts, with 2^^-3 = 1 // (2^^3) = 0
an integer?
Regards, Hartmut