cast (value schema -- convertedValue)value: Cond or numeric value to convert.schema: Numeric schema selector.convertedValue: Converted numeric value.cast converts a Cond or numeric value to the selected numeric schema.
The schema input is used only as a numeric schema selector. Its value is not read.
TRUE = 1 and FALSE = 0, then follows the selected numeric schema.{} 0 {} [
"-- schema selector value ignored --" printCompilerMessage
7 0n8 cast printStack _:;
7 255n8 cast printStack _:;
targetNat: 255n8 dynamic;
7 targetNat cast printStack _:;
TRUE 0i16 cast printStack _:;
TRUE -1i16 cast printStack _:;
FALSE 0i16 cast printStack _:;
FALSE -1i16 cast printStack _:;
"-- whole to whole width and signedness --" printCompilerMessage
-1 0n8 cast printStack _:;
255n8 0i8 cast printStack _:;
-1i8 0i16 cast printStack _:;
255n8 0n16 cast printStack _:;
"-- real to whole truncates toward zero --" printCompilerMessage
7.9r32 0 cast printStack _:;
-7.9r32 0 cast printStack _:;
"-- unknown value --" printCompilerMessage
value: 0 dynamic;
value 123.0r32 cast printStack _:;
0
] "main" exportFunction
-- schema selector value ignored --
7n8
7n8
7n8
1i16
1i16
0i16
0i16
-- whole to whole width and signedness --
255n8
-1i8
-1i16
255n16
-- real to whole truncates toward zero --
7
-7
-- unknown value --
Real32
^ builtin (base exponent -- power) Raises one Real value to another of the same schema and keeps that real schema in the result.ceil builtin (value -- ceilingValue) Rounds a Real value upward and keeps the same real schema.cos builtin (angle -- cosine) Computes the cosine of a Real value and keeps the same real schema.floor builtin (value -- floorValue) Rounds a Real value downward and keeps the same real schema.log builtin (argument -- naturalLogarithm) Computes the natural logarithm of a Real value and keeps the same real schema.log10 builtin (argument -- decimalLogarithm) Computes the base-10 logarithm of a Real value and keeps the same real schema.neg builtin (value -- negatedValue) Negates a signed Int or Real value and keeps the same schema.sin builtin (angle -- sine) Computes the sine of a Real value and keeps the same real schema.sqrt builtin (radicand -- squareRoot) Computes the square root of a Real value and keeps the same real schema.