[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [5.3] Converting a floating point number to integer.
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sun, 16 Nov 2014 19:48:56 -0200
> I am trying to convert a floating point number to an int
Do you really need to convert from one subtype to another?
Or just remove the fractional part of a float, resulting in a float?
Note that a float may have an integral value but might not be convertible to
an int. What do you need to happen if that is the case?
Like Dirk said, it all depends on what the application needs.
The philosophy of integers in Lua 5.3 is that applications rarely need to
mix the two subtypes and will benefit from using them separately, even if
some code needs to be changed. When an application really needs to mix the
two subtypes, then that is a point where it needs to stop and think about
what really needs to be done.