Advanced Computing Environment
Hosted by SourceForge
brix-os project page

Previous: Common Interfaces ----- Up: Contents ----- Next: Characters


show notes
Features that need to be added to the page or ideas that haven't been thought out.
  • literals
  • NaN?, signed?, unsigned?, integer?, complex?, rational? and real? predicates
  • predicates to test for positive and negative infinity?
  • operators map to shadow properties in Number to generate fast inlined code for static types and falls back to slower dynamic functions.
  • Numbers inherit a bit_interface when unsigned
  • unsigned numbers need bitwise operators: &, |, bitnot ~, bitxor , bitshifts << >>
  • bit rotation operators for unsigned numbers? ><< >><
  • unbounded floating and fixed point numbers
  • properties for floating and fixed point numbers
  • imaginary numbers: (1j) (1.0j)
  • complex numbers: (1 + 1j)
  • Ada's numeric type
    	// (-1.0 -0.9 ... 0.9 1.0)
    	type Fixed is delta 0.1 range -1.0 .. 1.0;
    	// (-999.99 ... +999.99)
    	type Decimal is delta 0.01 digits 5;

unfinished page

The Number type is used to create all possible numeric values needed by the language. It can define signed or unsigned, bounded or unbounded, and integers or floats. Declaring bounds lets the compiler handle the checks to prevent overflows and illegal values.

	`signed Number from -10..10
	`unsigned Number of 8 bit


`unbounded flags Number of X bit from range
  • `unbounded -- disables bounds checks
  • flags -- `signed, `unsigned, `complex, `rational or `real flags
  • of, bit, from -- required syntax
  • X -- size in bits
  • range -- lower and upper bounds






Sample Definition

	// macros
	`export-root odd?  = defx`open-macro (right:Number) -> Number.isOdd(right)
	`export-root even? = defx`open-macro (right:Number) -> Number.isEven(right)
	`export-root zero? = defx`open-macro (right:Number) -> Number.isZero(right)

Previous: Common Interfaces ----- Up: Contents ----- Next: Characters