Does Erlang have Bignums for math functions?

Why doesn't Erlang include arbitrary precision for math functions? I recently had to use math:pow(2,4333) and it throws an error. Why doesn't Erlang use libraries like GMP? Are there any plans to include it in the standard library? (Haskell uses it, [strike] even Java has bignums [strike]).

Thanks.

Update: To add more perspective, I understand that this can be done using NIF. I solved problems with hackerrank in which input uses large numbers. pow / 2 can easily be written to Erlang, and it worked, but for large calculations it will be slow.
Java returns a double for pow , so it does not work for Math.pow(2, 1024) , which gives Infinity .

0
source share
1 answer

Erlang has bignums for integers, but uses the 64-bit standard IEEE floating point numbers. Therefore, although you can happily compute factorial(10000) with integers by default, the math library uses floating point so that math:pow(2, 4333) does not work.

+6
source

Source: https://habr.com/ru/post/1247247/


All Articles