next up previous contents
Next: 6.7.2 The complex type Up: 6.7 Operators Previous: 6.7 Operators   Contents

6.7.1 The real type

nip2 has a single number type for integers and real numbers. All are represented internally as 64-bit floating point values. You can use the four standard arithmetic operators (+, -, *, /), remainder after integer division (%), raise-to-power (**), the relational operators (<, <=, >, >=, ==), the bitwise logical operators (&, |, ^ , ~), integer shift operators («, ») and unary negation and positive (-, +).

Other mathematical functions are pre-defined for you: sin, cos, tan, asin, acos, atan, log, log10, exp, exp10, ceil, floor. Each has the standard behaviour.

You can use type-casts on reals. However, they remain 64-bit floating point, the range is simply clipped. Casting to unsigned short produces a 64-bit float whose fractional part has been set to zero, and which has been clipped to the range 0 to 65535. This may or may not cause rounding problems.



John Cupitt 2004-12-20