NeturalMath Language Definition and Syntax

Exponent Operator (^)

The exponent operator raises the first term to the power of the second term. The value of the first operand will always take precedent when determining the data type of the result.

Syntax

value + value

Data Types

Bool

Logic Table
right
left false true
false true false
true true true

Bools are treated as a single bit (0 or 1) for the purposes of arithmetic calculations. Because anything raised to the zero power is one, and anything raised to the first power it itself, if the second value is false, the returned result will always be true. If the second value is true, the result will always be the same as the first value.
:> print true ^ true

true
:> print true ^ false

true
:> print false + false

false
:> print false ^ true

true

Complex

Complex values follow conventional mathematical rules. The real and imaginary parts are computed independently and a new complex is returned.

Number

Numbers are added together following conventional mathematical rules. The values are added and the sum is returned.
:> print 10 ^ 2

100
:> print 1234 + 3

1879080904

Range

This section is not implemented

Set

This section is not implemented

String

Strings do not work in the exponent function. Using a string value in an exponent will cause an error.

Unit

This section is not implemented

See Also

Data Types
Arithmatic Operators

Last edited Oct 19, 2010 at 9:52 PM by zanethorn, version 2

Comments

No comments yet.