Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

IT WORKS!

  Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
  This is free software with ABSOLUTELY NO WARRANTY.
  For details type `warranty'. 
  scale=24*20
   
  1/999999999999999999999998999999999999999999999999
  .0000000000000000000000000000000000000000000000010000000000000000000\
  00001000000000000000000000002000000000000000000000003000000000000000\
  00000000500000000000000000000000800000000000000000000001300000000000\
  00000000000210000000000000000000000340000000000000000000000550000000\
  00000000000000089000000000000000000000144000000000000000000000233000\
  00000000000000000037700000000000000000000061000000000000000000000098\
  70000000000000000000015970000000000000000000025840000000000000000000\
  04181
Don't know how.


> 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.





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

Search: