The answer he got was 0.5000000000006399.

The problem is not that the square operation is inexact, but that the sine of 45 that was already on the stack was accurate to only 12 places. Arbitrary-precision calculations still only give answers as good as their inputs.

The real problem is that there is no 12-digit number which, when
squared, comes out to 0.5 exactly. The `f [` and `f ]`
commands decrease or increase a number by one unit in the last
place (according to the current precision). They are useful for
determining facts like this.

1: 0.707106781187 1: 0.500000000001 . . 45 S 2 ^

1: 0.707106781187 1: 0.707106781186 1: 0.499999999999 . . . U DEL f [ 2 ^

A high-precision calculation must be carried out in high precision all the way. The only number in the original problem which was known exactly was the quantity 45 degrees, so the precision must be raised before anything is done after the number 45 has been entered in order for the higher precision to be meaningful.

Go to the first, previous, next, last section, table of contents.