HyperMath

Numbers - Data Types

Numbers - Data Types

Previous topic Next topic No expanding text in this topic  

Numbers - Data Types

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

HyperMath allows simple arithmetic using operators to add, subtract, multiply, and divide numbers.  The following example uses the print() function to print the results of some calculations.

> print(2+2)

4

 

> print(2-7)

-5

 

> print("The product of 7 * 8 is", 7*8)

The product of 7 * 8 is 56

 

> print(7/8)

0.875

All numbers are double precision.  You can assign values to variables using the = operator.  Variable names are case sensitive.

> x = 7

> print(x)

7

The variable x is created when the number 7 is assigned to it.  In the following example, use the print() function to print the value of x.  You can use the value of x for other calculations.

> x = x * 9

> print(x)

63

 

> print(x*2) // will not change the value of x

126

> print(x)

63

Notice how print(x*2)does not change the value of x because it was not assigned using the equal sign, "=".  Instead, x = x * 9 multiples the current value of x by 9 and stores the new value of x again.

See Also:

HyperMath Number Types