4 ms·
> What? How did the last digit end up as '4'? That's no kind of rounding I've ever heard of! Have you memorized pi to nine significant places, or how did you e
by patrec 5y ago
> What? How did the last digit end up as '4'? That's no kind of rounding I've ever heard of!
Have you memorized pi to nine significant places, or how did you even notice?
BC implements arbitrary precision arithmetic with decimals (try
echo 'scale=10000; 4*a(1)' | bc -l
and make yourself a cup of coffee), so it's not that surprising that it will give you an incorrect final digit. To guarantee correct rounding of the last displayed digit you need to be able compute to arbitrary precision in the general case, I don't think bc does that and that scale does not just govern number of (trailing) digits displayed but also also precision of computation.
- brongondwana 5y ago> Have you memorized pi to nine significant places, or how did you even notice? Not the OP - but, yes. My memory runs to 3.1415926535 and gets a little fuzzy after that, I think it's 2949 or something without looking... hrm, nope; 8979. Good thing I wasn't sure. Definitely as much as any reasonable human scale thing and then some, but memorising a calculator screen full of Pi isn't that impressive. It used to be written above the stairwell in the maths dept at Uni, so I walked past it multiple times per week for years.
- Sharlin 5y ago> Have you memorized pi to nine significant places, or how did you even notice? At least my "go-to" approximation is 3.141592654 due to the nice descending 654 at the end.
- patrec 5y agoCan you explain how this "go-to approximation" is ever useful to you? I don't understand why anyone would memorize pi to more than 3 digits, other than by accident (such as the sibling, who just saw it on a campus wall countless times). Those 3 digits are good for ~0.05% error, plenty good enough for any mental calculation you might want to do. In any other context you would have pi trivially available as a constant anyway, right?
- Sharlin 5y agoMaybe "go-to" is the wrong word. It's just that those are the digits I remember off the top of my head. I don't remember whether I made an actual effort to memorize them as a kid, it's been over twenty years. But they stuck and are not easy to forget now.
- patrec 5y agoCool, makes sense, but I'd put that under the accidentally memorized camp :)