SQRT_LAWS.bend open laws/TODOs
raw source on the hub · import bend-float64@0.1.8.0/SQRT_LAWS.bend as SQRT_LAWS
The square root's rounding law (float64.bend), at literal inputs, in a gate of its own: the checker's evaluation of the square root's 62 steps is the costliest in the arithmetic, and with LAWS.bend's other laws it came too close to the checker's 10-second limit. Gate: ./bend-check SQRT_PROOF.bend --verdict
2 imports
import Base import ./float64.bend as F
Laws
law sqrt_rounding provedin SQRT_PROOF.bendsource · line 11 · raw
{[0x72aa159312099184b98e33378b057a0a/float64.sqrt(0x72aa159312099184b98e33378b057a0a/float64.of_bits(1073741824, 0)), 0x72aa159312099184b98e33378b057a0a/float64.sqrt(0x72aa159312099184b98e33378b057a0a/float64.of_bits(1074790400, 0)), 0x72aa159312099184b98e33378b057a0a/float64.sqrt(0x72aa159312099184b98e33378b057a0a/float64.of_bits(2147483648, 0)), 0x72aa159312099184b98e33378b057a0a/float64.sqrt(0x72aa159312099184b98e33378b057a0a/float64.of_bits(3220176896, 0)), 0x72aa159312099184b98e33378b057a0a/float64.sqrt(0x72aa159312099184b98e33378b057a0a/float64.of_bits(0, 1)), 0x72aa159312099184b98e33378b057a0a/float64.sqrt(0x72aa159312099184b98e33378b057a0a/float64.of_bits(2146435071, 4294967295)), 0x72aa159312099184b98e33378b057a0a/float64.sqrt(0x72aa159312099184b98e33378b057a0a/float64.of_bits(1071644672, 0))] == [0x72aa159312099184b98e33378b057a0a/float64.F64{1073127582, 1719614413}, 0x72aa159312099184b98e33378b057a0a/float64.F64{1073741824, 0}, 0x72aa159312099184b98e33378b057a0a/float64.F64{2147483648, 0}, 0x72aa159312099184b98e33378b057a0a/float64.F64{4294443008, 0}, 0x72aa159312099184b98e33378b057a0a/float64.F64{509607936, 0}, 0x72aa159312099184b98e33378b057a0a/float64.F64{1609564159, 4294967295}, 0x72aa159312099184b98e33378b057a0a/float64.F64{1072079006, 1719614413}] : List<&2, 0x72aa159312099184b98e33378b057a0a/float64.F64>}Guarantees: sqrt(2) and sqrt(0.5) round to nearest, sqrt(4) = 2 exactly, sqrt(-0) = -0, sqrt(-1) = default NaN, sqrt of the smallest subnormal is 2^-537 exactly, sqrt(max) rounds to nearest. Why it matters: an odd exponent (2, 0.5) and a subnormal input take the core's two alignment paths.