why does bc(1) do this?

white:~/Documents/nanowrimo 2006 paul$ echo “50000 / 30 * `date +%d`” | bc -l
39999.99999999999999999984
white:~/Documents/nanowrimo 2006 paul$ echo “50000 / 30 * `date +%d`” | bc
39984

The -l flag would, I thought, give greater precision (not that I need it, but one of the examples I saw used it and the compared results seemed strange).


-l, –mathlib
Define the standard math library.

This is my poor man’s daily goal setter. Lucky me, I am a day ahead, according to this. I might just make 50K, after all.

Leave a Reply

Your email address will not be published. Required fields are marked *