Vocabulary/underdot

From J Wiki
Jump to navigation Jump to search

>> <<   Back to: Vocabulary Thru to: Dictionary

_. Indeterminate Noun

Indeterminate (_.) is a numeric atom. It is a placeholder broadly comparable with NaN (not a number). See: WikiPedia:NaN and Essays/Indeterminate.

It can appear in data imported from external sources, eg from a DLL or data base package. For an exhaustive list of sources see the entry in the J Dictionary.

If a computation produces NaN when the arguments were not NaN, J will signal a NaN error. If a NaN is an argument to a computation, it is undefined what the result value is: it could be NaN or any other value.

Some computations that produce NaN according to the IEEE standard do not produce NaN in J:

  • 0 * _ = 0
  • 0 * __ = 0
  • 0 % 0 = 0
  • 0 ^ 0 = 1
  • _ ^ 0 = 1
  • 1 ^ _ = 1
   p=: _ [ q=: __
   p+q
|NaN error
|   p    +q
   p%q
|NaN error
|   p    %q
   0*p,q
0 0
   1%q
0

Common uses

Indeterminate (_.) is not recommended for use in J computations. It signifies a "missing value" in statistical data. You should detect it using 128!:5 and replace it at the first opportunity with a proper numeric value suited to the computation you want to perform, eg (0), (_) or (__).

   z
1 2 _. 4
   128!:5 z
0 0 1 0
  0 (I. 128!:5 z) } z   NB. replace missing values with ZERO
1 2 0 4

More Information

Indeterminate is the only numeric atom that is not equal to itself. Further bizarre properties arise from this fact.

See Essays/Indeterminate.

   z=: 1 2 _. 4
   1+z
2 3 _. 5
   z=z
1 1 0 1
   +/z
_.

Numbers (".) can take a left argument. This specifies a numeric atom to replace any ill-formed numbers. This (together with 3!:n) are the only ways to force _. to arise in pure-J code. But it is not recommended for the purpose! Use (0) or Infinity (_) instead.

   z=: '.2 0.2 2.45 3E56 3F56 _1 _0 77'
   NB. (".) accepts non-J-numerals like '.2' and '3E56' but not '3F56' ...
   ".z
|ill-formed number
|       ".z
   _. ".z
0.2 0.2 2.45 3e56 _. _1 0 77
   0 ".z     NB. replace bad-numerals by ZERO
0.2 0.2 2.45 3e56 0 _1 0 77
   _ ".z     NB. replace bad-numerals by INFINITY
0.2 0.2 2.45 3e56 _ _1 0 77