Hacker News new | past | comments | ask | show | jobs | submit login

> echo 'scale=500-1;10/(10^20-10^10-1)' | BC_LINE_LENGTH=12 bc

will give you the ten digit ones, with the last digit rounded up on the very end.

I havent quite got an exact formula for scale before the rounding is wrong, e.g. for 100 digits:

> echo 'scale=50000-2000-1;10/(10^200-10^100-1)' | BC_LINE_LENGTH=102 bc




Why not just use

     scale=499
instead of

     scale=500-1
? I'm curious.


Originally in my terminal I was experimenting to find a cutoff for the point where the numbers become inaccurate. All of those formulas were in terms of digits and had a -1 on the end.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: