r/purescript • u/ulius • Jun 27 '18
Big Int Problem
Hello,
I'm new to purescript and trying to study by solving eulers project exercises. and with 3rd had a problem:
Integer value 600851475143 is out of range for the JavaScript backend. Acceptable values fall within the range -2147483648 to 2147483647 (inclusive).
Maybe someone can help me with that,
Thanks :)
3
Upvotes
View all comments
Show parent comment
2
u/ulius Jun 27 '18
Wow Thank you very much!!! ;) You are the hero of today!!!
Rewrite code:
https://pastebin.com/wLLxYq4X
And then
> solve <$> (fromString "600851475143")It works! But as always i dont read everything so had problem because overlooked that BigInts need to have big-integers so fixed it with
npm i big-integerslike written in documentation of BigInt. Thank you!