[erlang-questions] A math module better than C89
Fri Jan 20 01:02:58 CET 2017
On 01/19/2017 03:30 PM, Richard A. O'Keefe wrote:
> On 20/01/17 7:00 AM, Michael Truog wrote:
>> We do have floor/ceil now (from https://github.com/erlang/otp/pull/1145)
>> when the source code is released in Erlang/OTP 20.0 and these functions
>> are guard functions, though that means they both exist in the erlang
>> module, not the math module.
> That is good to hear.
> As a minor documentation issue, because there will be people exposed to
> C or Java who expect functions called round, trunc, floor, ceil to be
> in the same place as sqrt and acosh, it would be helpful if the
> manual page for the math module mentioned these functions, maybe at the
> end, and said where to really find them. I'm not talking about
> repeating their descriptions, just pointing to them.
I was wrong about this a bit. There are ceil/floor functions added to the math function that use the same logic as the erlang module ceil/floor functions. The main difference is that the math module return type is float while the erlang module return type is integer. So, ceil/floor are present in the math module, though the math module doc probably wants a pointer to the erlang module ceil/floor by mentioning that it returns integer instead of float.
More information about the erlang-questions