For some kinds of work with floating point numbers, this section is important, along with a more detailed understanding of how numbers are stored and manipulated by the hardware. For most work, however, this section can be ignored.

Let's consider the calculation at the end of the last section in more detail.

pps 20 a =. 3 * 100 * % 3 a 99.999999999999986 a = 100 1By exact math you would expect a to be 100. But because the computer can't exactly represent the value %3, you get a value for a that is very close to 100, but not exactly, as you can see by its detailed display with a print precision of 20. However, note that a is considered to be equal to 100, even though you can see that it is not exactly equal. This is because the comparison is tolerant. That is, numbers do not have to be exactly identical to be considered equal.

Let's experiment to get an idea for how tolerant the comparison is by gradually taking the value further away from 100. The input line recall shortcut with Shift+Ctrl+up arrow is very useful for playing with things like this.

100 = 100 1 100 = 99.999999999999986 1 100 = 99.99999999999998 1 100 = 99.9999999999999 1 100 = 99.999999999999 1 100 = 99.99999999999 0In the last example you crossed the line and the value is far enough away from 100 that it is no longer considered to be equal. Let's look at another example.

a =. 23 b =. a - 1e_12 c =. a - 1e_11 a 23 b 22.999999999999002 c 22.999999999989999 a = b 1 a = c 0The values of a and b are close enough to be considered equal. The values of a and c are not close enough to be considered equal. Close enough refers to the difference between the two numbers.

a - b 9.9831254374294076e_13 a - c 1.000088900582341e_11In both cases the difference is small, but b is closer than c to a. Reading the J Dictionary definition for = you will see that the dividing line between close enough and not close enough is determined by the result of multiplying the larger of the numbers times the default tolerance value of 2^_44. That is, close enough is

tolerance =. a * 2 ^ _44 tolerance 1.3073986337985843e_12Check both differences against this tolerance:

(a - b , c) <: tolerance 1 0The difference between a and b is less or equal to the tolerance, whereas the difference between a and c is not.

>> << Usr Pri JfC LJ Phr Dic Rel Voc !: wd Help Primer