Numerics

GEB uses different numbers representing various levels of precision.

Type

Precision

Wad

1E-18

Ray

1E-27

Rad

1E-45

You can import them from pyflex:

>>> from pyflex.numeric import Wad, Ray, Rad

Converting Wad, Ray, Rad to a str shows the numbers in a friendly format:

>>> Wad.from_number(1.2)
Wad(1200000000000000000)
>>> str(Wad.from_number(1.2))
'1.200000000000000000'
>>> Wad(10) == Wad.from_number(10)
False
>>> Wad(10) == Wad.from_number(10 * 1E-18)
True

Operations: Addition, Subtraction, Division

Wad, Ray, and Rad can only perform addition, subtraction and division with another Wad, Ray, or Rad

Operations: Multiplication

Wad, Ray, and Rad can be multiplied by any Wad, Ray, and Rad and int.

The result is the type of the first number:

Conversion

Wad, Ray, and Rad all accept Wad, Ray, and Rad in the constructors. This is the canonical way to convert numbers:

Last updated