From 987e6890f78e54402b1355201d45e2fbce1fd992 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 16 Apr 2022 17:02:57 -0400 Subject: =?UTF-8?q?Allow=20higher-precision=20implementations=20of=20?= =?UTF-8?q?=E2=88=9A=20and=20|?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spec/primitive.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs/spec/primitive.html') diff --git a/docs/spec/primitive.html b/docs/spec/primitive.html index 05ed2dcc..728f473e 100644 --- a/docs/spec/primitive.html +++ b/docs/spec/primitive.html @@ -25,6 +25,7 @@

In the first two cases, if the result would not be a valid Unicode code point, then an error results. The remaining cases of + and - (adding two characters; negating a character or subtracting it from a number) are not allowed.

Additionally, the Floor function returns the largest integer smaller than or equal to the argument, or the argument itself if it is ¯∞ or . It's needed because the arithmetic operations give no fixed-time way to determine if a value is an integer. Floor gives an error if the argument is an atom other than a number.

+

The functions Modulus |, and Square Root and Root , defined in reference.bqn may also be implemented as basic arithmetic rather than using the definitions in terms of the functions above, as this can allow for higher precision (it shouldn't affect other definitions, as these only use integer |, which is exact). Any replacements should approximate the definition computed with infinite precision. This is particularly recommended for Modulus in a typical floating-point implementation, because the definition with ÷ loses precision when 𝕩 is much larger than 𝕨 and is less useful for some numerical applications.

Comparison

Two kinds of comparison are needed to define BQN's primitives: equality comparison and ordered comparison.

Ordered comparison is simpler and is provided by the dyadic Less than or Equal to () function. This function gives an error if either argument is an operation, so it needs to be defined only for numbers and characters. For numbers it is defined by the number system, and for characters it returns 1 if the left argument's code point is less than that of the right argument. Characters are considered greater than numbers, so that nc is 1 and cn is 0 if c is a character and n is a number.

@@ -100,13 +101,13 @@

Arithmetic functions not already provided are defined in layer 1. These definitions, like the provided functions, apply to atoms only; they should be extended to arrays using the _perv modifier from layer 2.

Iteration modifiers

-- cgit v1.2.3