Data update

This commit is contained in:
Ingy döt Net 2025-06-11 20:16:52 -04:00
parent 72eb4943cb
commit 4d5544505c
2347 changed files with 62432 additions and 16731 deletions

View file

@ -0,0 +1,22 @@
import ballerina/io;
public function main() {
float[][] pairs = [
[100000000000000.01, 100000000000000.011],
[100.01, 100.011],
[10000000000000.001 / 10000.0, 1000000000.0000001000],
[0.001, 0.0010000001],
[0.000000000000000000000101, 0.0],
[2.0.sqrt() * 2.0.sqrt(), 2.0],
[-2.0.sqrt() * 2.0.sqrt(), -2.0],
[3.14159265358979323846, 3.14159265358979324]
];
io:println("Approximate equality of test cases with a tolerance of 1 bit:");
int i = 0;
foreach float[] pair in pairs {
i += 1;
int bi0 = pair[0].toBitsInt();
int bi1 = pair[1].toBitsInt();
io:println(` ${i} -> ${(bi0 - bi1).abs() <= 1}`);
}
}

View file

@ -1,7 +1,7 @@
func aeq a b .
return if abs (a - b) <= abs a * 1e-14
.
proc test a b . .
proc test a b .
write a & " " & b & " -> "
if aeq a b = 1
print "true"
@ -9,7 +9,7 @@ proc test a b . .
print "false"
.
.
numfmt 10 0
numfmt 0 10
test 100000000000000.01 100000000000000.011
test 100.01 100.011
test 10000000000000.001 / 10000 1000000000.0000001