NeturalMath Language Definition and Syntax

Divide Operator (/)

The divide operator divides the second value into the first. 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 void false
true void true

Bools are treated as a single bit (0 or 1) for the purposes of arithmetic calculations. The Divide Operation can yield some unusual results because of this. In the case where the second value is false, this would create a divide-by-zero case. Rather than throwing an error, NeturalMath will return the undefined constant value.
:> print true / true

true
:> print true / false

undefined
:> print false / false

undefined
:> print false / true

false

Complex

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

Number

Numbers are divided following conventional mathematical rules. The second value is divided into the first and the result is returned.
:> print 10 / 2

5
:> print 1234 - 5678

0.217330045790771

Range

This section is not implemented

Set

This section is not implemented

String

Strings treat division as a way to count the occurrence of the second string in the first string. The number of times the second string occurs in the first string will be returned
:> print 'NeturalMath is cool' / 'is cool'

1
:> "This is a short string' / ' '

4

Unit

This section is not implemented

See Also

Data Types
Arithmatic Operators

Last edited Oct 21, 2010 at 8:55 PM by zanethorn, version 2

Comments

No comments yet.