# bend-float64 IEEE 754 binary64 (`double`, NumPy's `float64`) for Bend 2, in pure Bend. Bend has no 64-bit types, so a float64 is two `U32` words and every operation is integer arithmetic on them. Each result is **correctly rounded** (to nearest, ties to even, unless you pick another of IEEE 754's five rounding modes) and has **the bits x86-64 gives**, NaNs included. 36.7 million random cases were checked bit for bit against NumPy and glibc on x86-64, and the NaN rules are proved for every input. NumPy's float64 math functions are here too, from `exp`, `log` and `sin` to `power` and `hypot`. Every one is correctly rounded, which NumPy and glibc are not everywhere. Each matched mpmath on all 65,536 test inputs. Text goes both ways, as Python's `repr` and `float()` do it: `show` prints the shortest digits that read back to the same float64, and `parse` reads any decimal text, rounding it correctly however many digits it has. Every rounding operation, math functions included, also comes as an `_m` version that takes the rounding mode first: `RNearEven{}`, `RNearAway{}`, `RZero{}`, `RUp{}` or `RDown{}`. Interval arithmetic is the usual reason: `add_m(RDown{}, a, b)` and `add_m(RUp{}, a, b)` bound the exact sum from both sides. ```bend import bend-float64@0.1.7.0/float64.bend as F import bend-float64@0.1.7.0/text.bend as T import bend-float64@0.1.7.0/math.bend as M def sum_text(r: Result<&2, &2, String, F.F64>) -> String: match r: case Done{x}: T.show(F.add(x, F.div(F.from_i32(1), F.from_i32(5)))) case Fail{why}: why def main() -> IO(Unit): do IO: IO.print(sum_text(T.parse("0.1"))) # 0.30000000000000004 IO.print(sum_text(T.parse("1__0"))) # could not convert string to float: '1__0' IO.print(T.show(M.sin(F.of_bits(2146435071, 4294967295)))) # sin(1.7976931348623157e+308): 0.004961954789184062 IO.print(T.show(F.div_m(F.RUp{}, F.from_i32(1), F.from_i32(3)))) # 1/3 rounded up: 0.33333333333333337 ``` ## What it has | | | | --- | --- | | type | `F64{hi, lo}`: `hi` holds the sign, the 11-bit exponent and the top 20 fraction bits, `lo` the low 32; `of_bits(hi, lo)`, `hi_bits`, `lo_bits` | | arithmetic | `add`, `sub`, `mul`, `div`, `sqrt`, `fma(a, b, c)` (a * b + c, rounded once) | | sign | `neg`, `abs`, `copysign(x, y)`, `signbit` | | compare | `eq`, `ne`, `lt`, `le`, `gt`, `ge` (IEEE: NaN is unordered, -0.0 == +0.0), `minimum`, `maximum` (NumPy's `np.minimum`, `np.maximum`) | | classify | `is_nan`, `is_inf`, `is_finite` | | to an integer value | `trunc`, `floor`, `ceil`, `rint` (ties to even, as `np.round`), or `round_int(mode, x)` with `RTrunc{}`, `RFloor{}`, `RCeil{}`, `REven{}` | | conversions | `from_i32`, `from_u32` (a `U32` holding the integer), `from_f32` / `from_f32_bits` (exact), `to_f32` / `to_f32_bits` (rounded), `to_i32`, `to_u32` (toward zero) | | 64-bit integers | `from_i64`, `from_u64` (rounded to nearest, ties to even), `to_i64`, `to_u64` (toward zero), on `W.W64{hi, lo}` from `wide.bend` (signed values in two's complement) | | rounding modes | `add_m`, `sub_m`, `mul_m`, `div_m`, `sqrt_m`, `fma_m`, `to_f32_m` / `to_f32_bits_m`, `from_i64_m`, `from_u64_m` with the mode first (`RNearEven{}`, `RNearAway{}`, `RZero{}`, `RUp{}`, `RDown{}`); `T.parse_m(mode, text)`; every math function as `exp_m(mode, x)` and so on | | constants | `zero(s)`, `inf(s)` with `s` = 0 or 2147483648 (the sign bit), `dnan()` (the default NaN), `quiet(x)` | | math (`math.bend`) | `exp`, `exp2`, `expm1`, `log`, `log2`, `log10`, `log1p`, `sin`, `cos`, `tan`, `arcsin`, `arccos`, `arctan`, `arctan2(y, x)`, `sinh`, `cosh`, `tanh`, `arcsinh`, `arccosh`, `arctanh`, `power(x, y)`, `cbrt`, `hypot(x, y)`: NumPy's float64 set, every result correctly rounded | | format spec (`spec.bend`) | `format(x, spec) -> Result<&2, &2, String, String>`: Python's `format(x, spec)`, the whole mini-language but `'n'` | | formats (`format.bend`) | `fixed(x, n)`, `sci(x, n)`, `general(x, n)`: Python's `'%.nf'`, `'%.ne'`, `'%.ng'`, any `n` | | text (`text.bend`) | `show(x) -> String`, `parse(text) -> Result<&2, &2, String, F64>` (`Done{x}`, or `Fail{why}` with Python's message), and `shortest(e, m)`, the digits and the point's place behind `show` | ## The exact rules - **Rounding.** Every operation without a mode rounds to nearest, ties to even, as NumPy does, and handles subnormals in full (no flush to zero). The `_m` versions round as IEEE 754 says for the mode given: - `RNearEven{}` is the default; `RNearAway{}` breaks ties away from zero; `RZero{}` truncates; `RUp{}` and `RDown{}` round toward +inf and -inf. - Past the largest float64, a result is infinity except when the mode rounds toward zero on that side, which gives the largest finite number (`RZero{}` both ways, `RUp{}` for negatives, `RDown{}` for positives). - A nonzero result below every subnormal is the smallest subnormal when the mode rounds away from zero on its side, else zero. - An exact zero sum of opposite operands (`x - x`, `1 + -1`, and the same in `fma`) is `-0.0` rounding down and `+0.0` otherwise; the sum of two zeros of one sign keeps that sign. - The plain functions are proved to be their `_m` versions with `RNearEven{}`, for every input. - **NaN results** are x86's: - a NaN operand passes through with its quiet bit set; - of two NaNs, the first operand's is returned, as `addsd`, NumPy's scalar path, `np.subtract` and `np.divide` do; - `fma` takes b's NaN, then a's, then c's, as glibc's `fma` does on x86-64, even for `0 * inf + NaN`; - an invalid operation gives the default NaN `0xFFF8000000000000`: `inf - inf`, `0 * inf`, `0 / 0`, `inf / inf`, and the square root of a number below zero; - `sqrt(-0.0)` is `-0.0`; - `neg`, `abs` and `copysign` change only the sign bit, NaN or not. - **NumPy's own `add` and `multiply` are not consistent.** For arrays of 9 or more elements their vector loop swaps the operands, so of two NaNs they return the second. bend-float64 always returns the first. - **`minimum`/`maximum`** pass a NaN through unchanged (not quieted), the first if both are NaN. Otherwise they return the second of two equal values, so `minimum(+0.0, -0.0)` is `-0.0`. These are NumPy's answers. - **`to_i32`** truncates, and NaN and values out of range give -2^31 (x86's "integer indefinite"). - **`to_u32`** follows NumPy's `astype(np.uint32)` on x86-64. It truncates to a signed 64-bit integer and keeps the low 32 bits, so `-1.0` gives 4294967295; NaN and values beyond the 64-bit range give 0. - **`to_i64`** truncates, and NaN and values outside [-2^63, 2^63) give -2^63. - **`to_u64`** follows NumPy's `astype(np.uint64)` on x86-64. Below 2^63 it converts as `to_i64` does, so `-1.0` gives 2^64 - 1. From 2^63 it converts x - 2^63 and sets the top bit, so values from 2^64 up, and inf, give 0. - **`from_i64`** and **`from_u64`** round to nearest, ties to even, as the hardware's conversions do (any mode through `from_i64_m` and `from_u64_m`). - **`to_f32`** rounds to nearest, ties to even (any mode through `to_f32_m`). A NaN keeps the top 22 bits of its payload, quieted. ## Text - **`show`** is Python's `repr`. It prints the fewest digits that read back to the same float64, and of those the nearest. The layout is Python's: an exponent below 1e-4 and from 1e16 up (`1e-05`, `0.0001`, `1000000000000000.0`, `1e+16`). A whole number keeps `.0`, the exponent has at least two digits, and the specials are `-0.0`, `inf`, `-inf` and `nan` (every NaN prints as `nan`). It uses Burger and Dybvig's algorithm on exact big integers. - **`parse`** is Python's `float()`: - an optional sign, digits with an optional point, and an optional exponent; - underscores, but only between digits; - `inf`, `infinity` and `nan` in any case (`-nan` keeps its sign bit); - whitespace around the number, the set `float()` strips; - rounding to nearest, ties to even, at any length: past 800 significant digits the rest only says "nonzero", which decides the same way; - `1e400` gives inf and `1e-400` gives 0.0, as in Python. - `parse_m(mode, text)` rounds in the mode given, on the fast path and the exact one alike; past the range it follows the arithmetic's rules (`1e400` toward zero is the largest finite number, `1e-400` rounding up is the smallest subnormal). - Text it refuses gives `Fail{"could not convert string to float: '...'"}`. - One difference: only ASCII digits count, where Python also takes other scripts' digits (`'١٢'`). - Short numbers (at most 15 digits, exponent within ±22) take Clinger's fast path: one correctly rounded multiply or divide. Everything else is exact big-integer arithmetic. ## Fixed-digit formats - `fixed(x, n)`, `sci(x, n)` and `general(x, n)` give exactly what Python's `'%.nf' % x`, `'%.ne' % x` and `'%.ng' % x` give. Some examples: - `fixed(0.125, 2)` is `0.12` and `fixed(2.5, 0)` is `2` (ties go to even); - `fixed(0.1, 20)` is `0.10000000000000000555`; - `sci(9.9999e22, 3)` is `1.000e+23`; - `general(1234567, 6)` is `1.23457e+06`. - The digits are those of the exact binary value, rounded half to even, using big integers. Any `n` works: `fixed(5e-324, 1100)` prints every one of its digits. - `fixed` puts no point when `n` is 0 and keeps the sign of a negative that rounds to zero (`-0.0`). - `sci` writes at least two exponent digits. - `general` uses `n` significant digits (1 for 0). It is fixed-point when the exponent after rounding is from -4 up to below `n`, and scientific otherwise, with trailing zeros and a bare point dropped. - Infinities print as `inf` and `-inf`, and every NaN as `nan`, as in Python. - Speed, one thread, at 6 digits: `fixed` about 5 µs, `sci` and `general` about 16 µs (they first find the decimal exponent from the shortest digits). Long precisions cost more, in proportion to the digits. ## The format mini-language - `format(x, spec)` is Python's `format(x, spec)` for a float. It covers every field of `[[fill]align][sign][z][#][0][width][grouping][.precision][type]` and every float type (`e E f F g G %`, and none) except `'n'`, which depends on the locale. For example, `format(1234.5, "*^15,.2f")` is `***1,234.50****`, and `format(1234.5, "010,.1f")` is `0,001,234.5`. - Python's rules, all of them: - zero padding (`0`, or a `0` fill with `=`) groups its zeros, and adds digits until the number reaches the width; - `0` sets only the fill when an alignment is given; - centring puts the odd fill character on the right; - a NaN never shows `-`; `+` and space still apply; - `z` drops the sign of a zero after rounding; - `#` keeps the point and, for `g`, the trailing zeros; - `%` multiplies by 100 in float64 first, and follows `inf` and `nan` too; - with no type, no precision is repr; a precision gives %g that keeps a `.0` and switches to an exponent one place sooner (`format(12.0, ".2")` is `1.2e+01`). - A spec Python refuses returns `Fail{message}` with Python's message, checked in Python's order: - `Format specifier missing precision`, `Cannot specify both ',' and '_'.`; - `Cannot specify ',' with 'x'.` (the grouping check comes before the type's); - `Unknown format code 'x' for object of type 'float'`, with unprintable codes written `\x20`; - `Invalid format specifier '...' for object of type 'float'`, and `Too many decimal digits in format string`. - `'n'` is refused with `format type 'n' is not supported (it depends on the locale)`. - Widths and precisions from 2^31 are refused as too many digits, where Python would try to allocate them. - Speed: about 40 µs for a call like `format(x, "*>12,.2f")`, one thread (parsing the spec each time). ## Math functions - **Every result is correctly rounded**: the exact mathematical value, rounded to nearest with ties to even, for every input. Results are the same on every machine, and need no error bounds in the docs. NumPy and glibc are not correctly rounded everywhere. On the test inputs NumPy's `cbrt` differs in about half the cases, and `arcsinh`, `arccosh`, `sinh`, `tanh` and `log10` in thousands. - **How it gets there (Ziv's strategy on balls).** Each function is evaluated on *balls*: values carrying a rigorous error bound, which every operation widens by everything it drops. If every point of the ball rounds to the same float64, that float64 is the answer. - **The fast path** comes first (`fast.bend`, `fb.bend`). Its balls have a fixed 128-bit mantissa and an error count in units of the last place; there are no lists, only native word operations. - It uses tables generated with mpmath (`fbconsts.bend`, from `test/gen_fast.py`): 2^(j/64) for exp, reciprocals and their logarithms for log, atan(j/16) for atan. - Its polynomials have literal coefficients, and each adds its own truncation bound, computed by the generator. - It decides on nearly every ordinary input. Huge trigonometric arguments (from 2^30), inputs near a hard case, and arguments whose ball fails (for example under heavy cancellation) go on to the slow path. - **The slow path** (`ball.bend`) uses big-integer balls. It starts at 128 bits and doubles the precision (256, 512, 1024, 2048) until the ball decides. - Range reductions are exact. On the slow path, `sin`, `cos` and `tan` use 3600 bits of 2/π, so `sin(1e300)` is right; the fast path splits π/2 into three parts. `exp` takes out powers of two, and `log` splits off the exponent. - Division and square root use Newton's method on both paths, with the exact residual bounding the error. - **Exact and halfway answers** can never be settled by refining a ball, so they are found first and computed exactly: - `cbrt` and `hypot` always are: an integer cube or square root with its remainder. - `exp2` of an integer, `log2` of a power of two, and `log10` of 10^0 to 10^22. - In `power`: x a power of two, y an integer up to 64, or y an odd multiple of 2^-j (j ≤ 5) with x's odd part a perfect 2^j-th power. - **Rounding modes.** `exp_m(mode, x)`, `power_m(mode, x, y)`, `hypot_m`, `arctan2_m` and the rest are correctly rounded in the mode given. The balls decide in that mode; exact answers stay exact. A ball cannot settle an answer that sits a hair off a float64, so those are found by rule, before any evaluation: - below 2^-60, `exp` and `exp2` are 1 plus a hair of x's sign, `expm1` is x plus a hair, `log1p` x minus one; - below 2^-40, `sin`, `arctan`, `tanh` and `arcsinh` are x a hair toward zero, `tan`, `arcsin`, `sinh` and `arctanh` x a hair away from zero, `cos` 1 a hair below, `cosh` 1 a hair above; - `tanh` past 22 is ±1 a hair toward zero, `expm1` below -40 is -1 a hair above, and overflow and underflow follow the arithmetic's rules; - `power(x, y)` with |y| below 2^-80 is 1 a hair above or below, by the sign of y log x; `hypot` of legs more than 2^64 apart is the larger a hair above; `arctan2(y, x)` with x > 0 and y / x exactly a float64 below 2^-40 is that float64 a hair toward zero. - "A hair" means the next float64 that way when the mode rounds that way, and the float64 itself otherwise. - **Special values** follow C99's Annex F, as NumPy does. NaN bits are NumPy's on x86-64: - a NaN passes through quieted, except that `tanh` gives the plain `0x7FF8000000000000`; - an invalid input gives `0xFFF8...`, except that `log10`, `arcsin` and `arccos` give `0x7FF8...`; - `arctan2` takes x's NaN before y's; - `power(NaN, y)` clears the NaN's sign when y is an odd integer; - `hypot` returns inf when the other operand is a quiet NaN, but quiets a signalling NaN. - **Speed**: on one thread, per call, on ordinary arguments (`test/math_bench.bend`, which includes making each argument). The slow path alone is shown for comparison: | function | fast path first (µs) | slow path only (µs) | | --- | --- | --- | | `exp`, `expm1` | 13 | 90 | | `log`, `log1p` | 14 | 190–200 | | `sin`, `cos` | 14 | 235 | | `tan` | 24 | 358 | | `arcsin`, `arccos` | 30–33 | 390 | | `arctan`, `arctan2` | 21–24 | 340–380 | | `sinh`, `cosh`, `tanh` | 17 | 135–140 | | `arcsinh`, `arccosh`, `arctanh` | 16–25 | 235–255 | | `power` | 19 | 370 | That is 7–19 times faster. glibc takes tens of nanoseconds; these functions are for programs that need the same bits everywhere, not for bulk arrays. `hypot` (25 µs) and `cbrt` are exact integer roots and did not change. ## How it is checked - `LAWS.bend` / `PROOF.bend` hold the arithmetic's 20 laws, gated by `./bend-check PROOF.bend --verdict`. - The NaN rules above are proved for **every** input: first and second operand for add, sub, mul and div; the order b, a, c for fma; sqrt and the four roundings; all six comparisons; minimum and maximum. - Correct rounding is pinned at about 90 literal inputs, each chosen to exercise a rounding path: ties, overflow thresholds, gradual underflow, exact cancellation, the sign of zero, fma's single rounding, and conversion edges. Every expected value comes from the hardware. - `TEXT_LAWS.bend` / `TEXT_PROOF.bend` hold the text's 4 laws, gated by `./bend-check TEXT_PROOF.bend --verdict`. It is a separate gate so that each file stays within the checker's 10-second limit. The laws are literal: repr's layout on both sides of each switch, shortest digits (1e+23 needs the even-boundary rule), Python's values for signs, whitespace, underscores, inf and nan, halfway ties through both conversion paths, and ten refused texts with their messages. - `MATH_LAWS.bend` / `MATH_PROOF.bend` (7 laws) and `POWER_LAWS.bend` / `POWER_PROOF.bend` (2) cover the math functions. They are gated by `./bend-check MATH_PROOF.bend --verdict` and `./bend-check POWER_PROOF.bend --verdict`, two files so that each stays within the checker's limit. - For every input, a NaN passes through the 20 one-argument functions as NumPy passes it. `arctan2` takes x's NaN, then y's. - At literal inputs: 21 special values; 14 exact answers (including exp2(-1075), halfway to 0, rounding to 0); power's C99 table, 15 entries; arctan2's signed zeros. The ball evaluations themselves are too slow for the checker, so their correctness rests on the tests. The fast path is out of reach too: the formal kernel behind `--verdict` runs out of fuel evaluating even `exp(1)`. Its own tests and mutants are below. - `FORMAT_LAWS.bend` / `FORMAT_PROOF.bend` hold the formats' 3 laws, gated by `./bend-check FORMAT_PROOF.bend --verdict`. They pin ties to even (both by shifting and by dividing), the exponent correction across a power of ten, %g's thresholds and zero stripping, signs and specials. - `INT64_LAWS.bend` / `INT64_PROOF.bend` hold the 64-bit conversions' law (13 literal cases, NumPy's answers), gated by `./bend-check INT64_PROOF.bend --verdict`. - `SPEC_LAWS.bend` / `SPEC_PROOF.bend` hold the mini-language's 2 laws (11 layouts and 7 refusals, Python's results), gated by `./bend-check SPEC_PROOF.bend --verdict`. - `MODE_LAWS.bend` / `MODE_PROOF.bend` (4 laws) and `MODE_MATH_LAWS.bend` / `MODE_MATH_PROOF.bend` (5) cover the rounding modes, gated by `./bend-check MODE_PROOF.bend --verdict` and `./bend-check MODE_MATH_PROOF.bend --verdict`. - For every input, each function without a mode equals its `_m` version with `RNearEven{}`: the arithmetic, the conversions, `parse` and all 23 math functions. The NaN laws above hold in every mode. - At literal inputs: each mode's direction (on a sum, a tie and a square root, positive and negative), overflow and underflow in each mode, the sign of an exact zero sum, float32 and parsing by mode, and the math functions' rules for answers a hair off a float64, past the range, and exact. - `mutants.sh` plants 98 single bugs, and the laws catch all 98. - 27 are in the arithmetic: ties rounding up, a lost sticky bit, a lost carry, a NaN that is not quieted, and others. - 12 are in the text: the layout switch moved, the exponent's padding lost, a boundary taken whatever the significand's parity, a trailing underscore accepted, halfway text rounding up, and others. - 16 are in the math functions: a NaN not quieted, the wrong NaN first, an exact path off by a power of two, a C99 table entry wrong, and others. - 5 are in the 64-bit conversions: the 2^63 threshold moved, a sign dropped, the top bit forgotten. - 9 are in the mini-language: zeros not grouped, `0` overriding an alignment, the odd fill on the left, `z` ignored, the no-type threshold moved, `%` forgotten after inf, both separators accepted, the checks out of order, a code not escaped. - 8 are in the formats: ties rounding up, the exponent not corrected, %g's threshold moved, zeros kept, a point for no digits, leading zeros lost, a negative zero's sign lost. - 21 are in the rounding modes: a direction ignoring the sign, ties away rounding to even, overflow or underflow ignoring the mode, the zero sum's sign, a default in the wrong mode, parsing's fast path or float32 ignoring the mode, and each of the math functions' rules pointing the wrong way. - `test/check.py` runs `test/cases`, a Bend program that prints random cases of all 35 operations. It recomputes each case with NumPy and glibc's `fma` on the machine and compares the bits. - The inputs mix special values, subnormals, both ends of the exponent range, sparse and dense significands, exact ties, and pairs close enough to cancel. - `python3 check.py 20` runs 2^20 cases per operation, 36.7 million in all; every one matched on x86-64. - `test/text_check.py` checks the text in both directions. For `show`, 2^20 random float64s were printed, and every one equals Python's `repr`. For `parse`, a million strings were read, and every one gives `float()`'s bits or is refused as `float()` refuses it. The strings include exact halfway points between neighbouring floats and the values just either side, texts past 800 digits, both thresholds, whitespace, underscores and malformed text. - `test/math_check.py` compares the math functions with mpmath on 65,536 inputs per function, 1,507,328 in all, and every one is correctly rounded. Values are computed at 300 bits, at 600 when the two disagree, and rounded through an exact fraction, so subnormal results round once. Special and NaN results are compared with NumPy's bits. The inputs mix the general set above with each function's own hard cases: arguments near 1 for the logs, near multiples of π/2 for the trigonometry, near ±1 for arcsin and arctanh, perfect powers, cubes and Pythagorean triples. mpmath is only needed for this test (`pip install mpmath`). - The fast path's error bounds are tested directly, not only through its answers. A bound that is too small would rarely change an answer, but it would make one wrong eventually. - `test/fb_check.py` runs random operations on random full-width balls, with and without errors. Using exact fractions, it checks that every corner of the operands gives a true result inside the result ball. The largest error / bound seen is 1.000 for multiplication and addition, 0.68 for division and 0.37 for square root. - `test/fast_check.py` evaluates every function's fast ball on the test inputs. It checks with mpmath that the true value lies inside; the largest error / bound seen is 0.64. - `test/fast_mutants.sh` plants 9 bugs in the fast path, and these checks catch all 9. The bugs include a dropped error term, a product wrongly taken as exact, an off table entry, a dropped truncation bound, and a missing part of π/2. The unmutated code passes. - `test/format_check.py` compares the three formats with Python's `%` on 2^20 random cases each, 3,145,728 in all; every string is equal. The inputs mix the general set above with exact ties, odd numbers over 2^(n+1). `n` is mostly 0 to 20, and a sixteenth of the time up to 400. - `test/spec_check.py` formats a million random specs over every field, malformed specs included, on random floats. Every result equals Python's `format(x, spec)`, and every refusal Python's message. - The rounding modes are tested in all five modes against exact references: - `test/mode_check.py` checks add, sub, mul, div, sqrt, fma, to_f32, from_i64 and from_u64 against the exact result (fractions, integer square roots) rounded in each mode: 16,384 cases per operation and mode, 737,280 in all, every one equal. The reference is itself checked against the CPU in the four modes x86 has (`fesetround`, with NumPy and glibc's `fma`), and agrees on all 524,288 of those cases. - `test/parse_mode_check.py` parses 100,000 random strings in each mode, and every one equals `Fraction(text)` rounded in that mode. - `test/math_mode_check.py` checks the 23 math functions in each mode on 16,384 inputs per function, 376,832 in all, against mpmath at a precision that grows with how tiny the inputs are (so x^2 and x^3 terms are resolved), rounded exactly. Its inputs add tiny arguments from 2^-1022 to 2^-23, tiny exponents for `power`, and `arctan2` inputs whose ratio is exactly a tiny float64. - `test/run.sh` runs everything. ## Speed It is software floating point, so expect it to be about 100 times slower than the hardware. On a 32-thread CPU, summing op(i/7, (i+1)/3) over 2^20 values of i in parallel took 0.32 s for add, 0.33 s for mul, 0.47 s for div, 0.49 s for sqrt and 0.51 s for fma. That includes making the inputs, which takes 0.17 s on its own. NumPy does one of these operations over 2^20 elements in about 1.5 ms on one thread (`test/bench.bend`). Text, on the same machine: - `show`: 2^20 values in 2.45 s on 32 threads, about 10 times slower than Python's `repr`. - `parse`, one thread: about 2.7 µs for a short number like `%.6g` gives; about 15 µs for a 17-digit `repr`; about 45 µs for exponents out to ±300. Python's `float()` takes about 0.1 µs. ## Not yet A fast path for very large trigonometric arguments (from 2^30 they take the exact, slower reduction).