<html><head></head><body>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. <br><br><div class="gmail_quote">On 3 September 2016 00:56:40 GMT+10:00, Valentin Nechayev <netch@segfault.kiev.ua> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"> Fri, Jun 03, 2016 at 23:37:48, samuelrivas wrote about "Re: [erlang-questions] math ceil floor": <br /><br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> What is the use case when you want floor/ceil to return a float and<br /> not an integer in Erlang?<br /></blockquote><br />C provides floor() and ceil() according to IEEE754 that requires<br /><br />* sourceFormat roundToIntegralTowardPositive(source)<br />* sourceFormat roundToIntegralTowardNegative(source)<br /><br />format isn't changed. So, operations with float result will be direct<br />mapping of those of implementation, with all consequential features,<br />as efficiency.<br /><br />A variant of conversion of the result to integer will be as efficient<br />as explicit conversion after math library floor/ceil, except a cost to chain<br />two Erlang calls.<br /><br /><br />-netch-<br /><hr /><br />erlang-questions mailing list<br
/>erlang-questions@erlang.org<br /><a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br /></pre></blockquote></div><br>
-- <br>
Sent from my Android device with K-9 Mail. Please excuse my brevity.</body></html>