Re: math.tofloat (or how to check if number has float representation)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: math.tofloat (or how to check if number has float representation)
- From: "Soni L." <fakedme@...>
- Date: 2015年1月17日 16:16:33 -0200
On 17/01/15 04:07 PM, Luiz Henrique de Figueiredo wrote:
I was trying to do an advanced type checking library in Lua, and I
seem to need a math.tofloat. How do I do this?
If you need to convert a number x to a float, you can do x+0.0 for instance.
How do I check if x can be represented as a float? For example, for
64-bit integers and 64-bit floats, (1<<62)+5 cannot be represented as a
float, but 1<<62 can.
--
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.