^ (base exponent -- power)
Inputs
Outputs
power: Power object in the same real schema.
^ accepts only same-schema Real32 or Real64 operands. Both inputs are dereferenced and must be non-NIL.
Behavior
- If both operands are known at compile time, the result is computed at compile time.
- If
baseis known1andexponentis unknown, the result is known1of the same real schema. - If
exponentis known0andbaseis unknown, the result is known1of the same real schema. - If
exponentis known1andbaseis unknown, the result is an unknown value of the same real schema. - In all other cases with an unknown operand, the result is an unknown value of the same real schema.
- Known values follow real exponentiation semantics, including results such as
nanwhen the real operation does not produce a finite number.
Example
{} () {} [
"-- real32 --" printCompilerMessage
2.0r32 3.0r32 ^ printStack _:;
2.0r32 -1.0r32 ^ printStack _:;
-1.0r32 0.5r32 ^ printStack _:;
"-- known base or exponent --" printCompilerMessage
unknownExponent: 0.0r32 dynamic;
1.0r32 unknownExponent ^ printStack _:;
unknownBase: 0.0r32 dynamic;
unknownBase 0.0r32 ^ printStack _:;
unknownBase 1.0r32 ^ printStack _:;
] "main" exportFunction
Expected Output During Compilation
-- real32 --
8.0r32
0.5r32
nanr32
-- known base or exponent --
1.0r32
1.0r32
Real32
See also
castbuiltin(object schema -- convertedValue)Casts a Cond or numeric object to the numeric schema selected by theschemainput.ceilbuiltin(object -- ceilingValue)Rounds a Real object upward and keeps the same real schema.cosbuiltin(angle -- cosine)Computes the cosine of a Real object and keeps the same real schema.floorbuiltin(object -- floorValue)Rounds a Real object downward and keeps the same real schema.logbuiltin(argument -- naturalLogarithm)Computes the natural logarithm of a Real object and keeps the same real schema.log10builtin(argument -- decimalLogarithm)Computes the base-10 logarithm of a Real object and keeps the same real schema.negbuiltin(object -- negatedValue)Negates a signed Int or Real object and keeps the same schema.sinbuiltin(angle -- sine)Computes the sine of a Real object and keeps the same real schema.sqrtbuiltin(radicand -- squareRoot)Computes the square root of a Real object and keeps the same real schema.