calc_rational

CLI calculator for rational numbers.
git clone https://git.philomathiclife.com/repos/calc_rational
Log | Files | Refs | README

commit f553f55703f3681704c9193a1404f61c8a190b4a
parent e352471950c398864ae93e315534887680fb5abb
Author: Zack Newman <zack@philomathiclife.com>
Date:   Tue,  2 May 2023 12:38:27 -0600

doc sqrt is only defined when solution is a rational

Diffstat:
MREADME.md | 3++-
Mlang.tex | 1+
Msrc/lib.rs | 3++-
Msrc/main.rs | 3++-
4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md @@ -85,7 +85,8 @@ will result in an error message. however the expression right of the operator must evaluate to an integer or ±1/2 unless the expression on the left evaluates to `0` or `1`. In the event of the former, the expression right of the operator must evaluate to a non-negative rational number. In the event of the latter, the expression right of the operator can evaluate to -any rational number. Note that `0^0` is defined to be 1. +any rational number. Note that `0^0` is defined to be 1. When the operand right of `^` evaluates to ±1/2, then +the left operand must be the square of a rational number. The unary operator `-` represents negation. diff --git a/lang.tex b/lang.tex @@ -56,6 +56,7 @@ and \(mod\) to mean absolute value, negation, factorial, exponentiation, and mod Note that this means for \(mult / exp\), \(exp\) does not evaluate to 0. Similarly, \(term\string^exp\) is valid iff \(term\) evaluates to 1, \(term\) evaluates to 0 and \(exp\) evaluates to a non-negative rational number—\(0^{0}\) is defined to be 1—or \(term\) evaluates to any other rational number and \(exp\) evaluates to an integer or \(\pm1/2\). +In the event that \(exp\) is \(\pm1/2\), then \(term\) must be the square of a rational number. \(!\) is only defined for non-negative integers. \(@prev\) is only defined iff at least \(prev\) number of previous \(store\) expressions have been evaluated. diff --git a/src/lib.rs b/src/lib.rs @@ -32,7 +32,8 @@ //! however the expression right of the operator must evaluate to an integer or ±1/2 unless the expression on //! the left evaluates to `0` or `1`. In the event of the former, the expression right of the operator must evaluate //! to a non-negative rational number. In the event of the latter, the expression right of the operator can evaluate to -//! any rational number. Note that `0^0` is defined to be 1. +//! any rational number. Note that `0^0` is defined to be 1. When the operand right of `^` evaluates to ±1/2, then +//! the left operand must be the square of a rational number. //! //! The unary operator `-` represents negation. //! diff --git a/src/main.rs b/src/main.rs @@ -84,7 +84,8 @@ //! however the expression right of the operator must evaluate to an integer or ±1/2 unless the expression on //! the left evaluates to `0` or `1`. In the event of the former, the expression right of the operator must evaluate //! to a non-negative rational number. In the event of the latter, the expression right of the operator can evaluate to -//! any rational number. Note that `0^0` is defined to be 1. +//! any rational number. Note that `0^0` is defined to be 1. When the operand right of `^` evaluates to ±1/2, then +//! the left operand must be the square of a rational number. //! //! The unary operator `-` represents negation. //!