diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-03-09 11:42:11 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-03-09 11:42:11 -0800 |
commit | 285e3a5c375774135c29c6b7ff3b4b811b6cacd1 (patch) | |
tree | c032fa7aae6fcc31aef3d62d9a452d6f6d9822fc /txr.1 | |
parent | e844d3a602af4380c196d896b803b67d58ecbcea (diff) | |
download | txr-285e3a5c375774135c29c6b7ff3b4b811b6cacd1.tar.gz txr-285e3a5c375774135c29c6b7ff3b4b811b6cacd1.tar.bz2 txr-285e3a5c375774135c29c6b7ff3b4b811b6cacd1.zip |
expt: handle negative integer exponents with integer bases.
* arith.c (expt): The function overhauled. Raising integers to
negative integers now works. Raising zero to a negative is
diagnosed as a division by zero for operands of all kinds.
* txr.1: Documentation updated for expt, and also division by
zero error is documented for the / function.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -35531,6 +35531,9 @@ follows, then that value is divided by that subsequent divisor. This process repeats until all divisors are exhausted, and the value of the last division is returned. +A division by zero throws an exception of type +.codn numeric-error . + .coNP Functions @ sum and @ prod .synb .mets (sum < sequence <> [ keyfun ]) @@ -36037,8 +36040,16 @@ similarly to the way nested exponents work in standard algebraic notation. Exponentiation is done pairwise using a binary operation. -If both operands to this binary operation are integers, then the -result is an integer. If either operand is a float, then the other +If both operands to this binary operation are non-negative integers, then the +result is an integer. + +If the exponent is negative, and the base is zero, the situation is +treated as a division by zero: an exception of type +.code numeric-error +is thrown. Otherwise, a negative exponent is converted to floating-point, +if it already isn't, and a floating-point exponentiation is performed. + +If either operand is a float, then the other operand is converted to a float, and a floating point exponentiation is performed. Exponentiation that would produce a complex number is not supported. |