[erlang-questions] math ceil floor
Sun Sep 4 10:35:44 CEST 2016
Another possibility would be to return the argument if it is already an integer. It would be convenient for long integers as no loss of precision would come from conversion to a float.
On 3 September 2016 00:56:40 GMT+10:00, Valentin Nechayev <> wrote:
>Fri, Jun 03, 2016 at 23:37:48, samuelrivas wrote about "Re:
>[erlang-questions] math ceil floor":
>> What is the use case when you want floor/ceil to return a float and
>> not an integer in Erlang?
>C provides floor() and ceil() according to IEEE754 that requires
>* sourceFormat roundToIntegralTowardPositive(source)
>* sourceFormat roundToIntegralTowardNegative(source)
>format isn't changed. So, operations with float result will be direct
>mapping of those of implementation, with all consequential features,
>A variant of conversion of the result to integer will be as efficient
>as explicit conversion after math library floor/ceil, except a cost to
>two Erlang calls.
>erlang-questions mailing list
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions