NumberNode

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

(cog-execute!
   (PlusLink
      (NumberNode 2)
      (TimesLink
         (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,

GreaterThanLink
     NumberNode 42
     PlusLink
          NumberNode 2
          NumberNode 2

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

See also