/ (dividend divisor -- quotient)

Inputs

Outputs

/ computes numeric division. Both inputs are dereferenced, must be non-NIL, and must have the same numeric schema.

Behavior

Example: / on Whole and Real32 values

/ truncates whole quotients toward zero, so 7 gives 3 and -7 gives -3, divides Real32 values as reals, and gives an unknown result for an unknown dividend.

{} () {} [
  "-- int32 --" printCompilerMessage
  8 2 / printStack _:;
  7 2 / printStack _:;
  -7 2 / printStack _:;

  "-- nat32 --" printCompilerMessage
  7n32 2n32 / printStack _:;

  "-- real32 --" printCompilerMessage
  7.5r32 2.5r32 / printStack _:;

  "-- unknown int32 --" printCompilerMessage
  value: 0 dynamic;
  value 2 / printStack _:;
] "main" exportFunction

Expected Output During Compilation

-- int32 --
4
3
-3
-- nat32 --
3n32
-- real32 --
3.0r32
-- unknown int32 --
Int32

See also