From OpenCog
Jump to: navigation, search

The NumberNode is a type of Node that holds double-precision floating point numbers. It is typically used in arithmetical operations, such as PlusLink and TimesLink. For example, the following scheme expression

      (NumberNode 2)
         (NumberNode 3)
         (NumberNode 4))))

will yield

 (NumberNode "14.000000")

as a result. NumberNodes can be compared with the EqualLink and the GreaterThanLink. So for example,

     NumberNode 42
          NumberNode 2
          NumberNode 2

will evaluate to "true" when evaluated by the pattern matcher or by cog-evaluate!.


The Value subsystem provides a superior mechanism for storing, recording, and working with fleeting and time-changing data. There are multiple problems with using Atoms for transient data, including: (a) it is CPU-intensive to create an Atom. Creating Values is much faster. (b) it is CPU-intensive to insert an Atom into the AtomSpace. Values are not stored in the atomsapce. For fleeting data, there is almost never any functional need for the indexing services that the AtomSpace provides, so its pointless to store fleeting data there, anyway. (c) it can become very difficult, sometimes impossible, to remove Atoms from the atomspace. This can happen when an Atom become a part of the outgoing set of another atom; in such a case, it would be illegal to delete the atom. For these three reasons, Values provide a superior mechanism for storing and working with fleeting numerical data. They just work better.

In other words, if you think that you need NumberNodes, its very likely that you don't, and that you would be better off working with Values instead.

See also