numeric.km 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Basic Numeric Types
  2. type Integer native; // *big.Int
  3. type Float native; // float64
  4. type Complex native; // complex128
  5. type Number protected Integer; // non-negative Integer
  6. type NormalFloat protected Float; // normal Float (excluding NaN & ±∞)
  7. type NormalComplex protected Complex; // normal Complex (excluding norm NaN & ∞)
  8. export function Number?: &(Integer) => Maybe[Number]
  9. native 'Number?';
  10. export function NormalFloat?: &(Float) => Maybe[NormalFloat]
  11. native 'NormalFloat?';
  12. export function NormalComplex?: &(Complex) => Maybe[NormalComplex]
  13. native 'NormalComplex?';
  14. export function String: &(Integer) => String native 'String from Integer';
  15. export function String: &(Float) => String native 'String from Float';
  16. export function String: &(Complex) => String native 'String from Complex';
  17. export function Complex: &(NormalFloat,NormalFloat) => NormalComplex
  18. native 'Complex';
  19. export function <conj>: &(Complex) => Complex native '<conj>';
  20. export function <real>: &(Complex) => Float native '<real>';
  21. export function <imag>: &(Complex) => Float native '<imag>';
  22. export function <norm>: &(Complex) => Float native '<norm>';
  23. export function <arg>: &(Complex) => Float native '<arg>';
  24. export function <conj>: &(NormalComplex) => NormalFloat native '<conj>';
  25. export function <real>: &(NormalComplex) => NormalFloat native '<real>';
  26. export function <imag>: &(NormalComplex) => NormalFloat native '<imag>';
  27. export function <norm>: &(NormalComplex) => NormalFloat native '<norm>';
  28. export function <arg>: &(NormalComplex) => NormalFloat native '<arg>';
  29. export function =: &(Integer,Integer) => Bool native '=Integer';
  30. export function <: &(Integer,Integer) => Bool native '<Integer';
  31. export function <>: &(Integer,Integer) => Ordering native '<>Integer';
  32. export function <: &(NormalFloat,NormalFloat) => Bool native '<NormalFloat';