[erlang-questions] math:pow(X, Y).
Jared Kofron
<>
Mon Mar 19 18:26:02 CET 2012
Just a guess, but math:pow/2 is implemented as a NIF and C may not enjoy the size of the number you are trying to calculate.
Here's GHCI's answer:
Prelude> 42**909
Infinity
On Mar 19, 2012, at 10:17 AM, Yves S. Garret wrote:
> Hi all,
>
> That's the standard method that I use to raise a value to a power. I compared this to the way Python does raising to a power and this is the result that I get:
>
> Erlang:
> 11> math:pow(42, 909).
> ** exception error: bad argument in an arithmetic expression
> in function math:pow/2
> called as math:pow(42,909)
>
> Python:
> http://bin.cakephp.org/view/1006418268
>
> Now. Why is it in Erlang's case I get a float as a return value? Is there a method that only returns a long? Or do most erlang coders have a custom power function if they want ridiculously large numbers?
> _______________________________________________
> erlang-questions mailing list
>
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120319/131d239a/attachment.html>
More information about the erlang-questions
mailing list