lua-users home
lua-l archive

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

LNUM patch defines LUA_INTEGER_MIN and LUA_INTEGER_MAX. What exactly is your need for the floating point equivalents?

W. C. Bubel kirjoitti 2.1.2008 kello 17:21:

On Jan 2, 2008 8:16 AM, Reuben Thomas <> wrote:
It would make it easier to write portable code for Lua if there were maxima and minima for the number types, say LUA_NUMBER_MAX, LUA_NUMBER_MIN &c. For
a default configured system, one can of course use the limits for the
default types, ptrdiff_t and double respectively, but that's not portable to
systems using non-default types.

memoir, n. a lie that flatters the author's ego and the reader's intellect

The maximum value, as in highest possible exponent, or highest
possible integer mantissa? The two are noticably different. With 64
bit double-precision, the maximum number is 1.7976931348623157 x
10^308, however the 53 bit mantissa loses resolution about

A nice way to verify that second number would be this:

function maxluanumber()
  local x = 1
  while x < x +1 do
    x = x * 2
  return x