Since bash overflows after 2^63-1 I have done quite a bit of research already and many people on StackOverflow have advised others to use the command bc in the form of var=$( bc <<< "$number" ) however, this doesn't seem to work in the output. It works fine for integers up to 62 bits but it still overflows when I echo "$var". I am using the online IDE from exercism. Is there any other way around this?
#[bash] echo-ing integers with more than 63 bits
4 messages · Page 1 of 1 (latest)
printf can help for another bit by forcing it to an unsigned int, eg for Grains
At a bash prompt, enter help printf, man 1 printf and man 3 printf
Note help printf and man printf document different (though similar) commands. You want the former command.