1
0
Fork 0

floating point tests

This commit is contained in:
Arthur K. 2025-07-17 19:23:40 +03:00
parent aa81b3ea0b
commit cb0567f1d5
Signed by: wzray
GPG key ID: B97F30FDC4636357
522 changed files with 47766 additions and 235650 deletions

View file

@ -0,0 +1,6 @@
exit()
with open('all.tsv', 'w') as out:
for i in (1,2,3):
with open(f'./combined{i}.txt') as fq, open(f'./combined{i}_ans.txt') as fa:
for line in zip(fq, fa):
print('\t'.join(map(' '.join, map(str.split, map(str.strip, line)))), file=out)

View file

@ -0,0 +1,42 @@
TYPES = ('half', 'single')
TEST_TYPES = ("add", "sub", "div", "mul", "fma", "mad", "prn")
ROUND_TYPES = ("to_zero", "to_nearest_even", "to_positive_infinity", "to_negative_infinity")
fds = {
a: {
b: {
c: open(f'out/{a}/{b}/{c}.tsv', 'w')
for c in ROUND_TYPES
}
for b in TEST_TYPES
}
for a in TYPES
}
try:
with open('all_u.tsv') as f:
for line in f:
q = line.split('\t')[0].split()
ft = 'half' if q[0] == 'h' else 'single'
rt = ''
op = 'prn' if len(q) == 3 else q[2]
match q[1]:
case '0':
rt = 'to_zero'
case '1':
rt = 'to_nearest_even'
case '2':
rt = 'to_positive_infinity'
case '3':
rt = 'to_negative_infinity'
match op:
case '+': op = 'add'
case '-': op = 'sub'
case '*': op = 'mul'
case '/': op = 'div'
fds[ft][op][rt].write(line)
finally:
for a in fds:
for b in fds[a]:
for c in fds[a][b]:
fds[a][b][c].close()

56
float/tests/.gitattributes vendored Normal file
View file

@ -0,0 +1,56 @@
single/prn/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/fma/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
single/add/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/div/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/fma/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/prn/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
single/prn/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
half/add/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/prn/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/div/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
single/sub/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
single/sub/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/sub/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
half/mad/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/fma/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
single/fma/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/mad/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/mul/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/prn/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/add/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
half/div/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/div/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
half/mad/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/mul/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/sub/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
single/div/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
single/fma/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
half/add/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/add/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
half/mul/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/prn/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
single/mul/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
single/sub/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/fma/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/sub/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
single/add/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
single/add/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
single/mad/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
single/mad/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/mad/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
single/mul/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/sub/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/sub/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/div/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
half/div/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/fma/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
half/fma/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
half/mad/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
half/mul/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
half/mad/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
half/mul/to_zero.tsv filter=lfs diff=lfs merge=lfs -text
half/prn/to_nearest_even.tsv filter=lfs diff=lfs merge=lfs -text
half/prn/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/add/to_positive_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/div/to_negative_infinity.tsv filter=lfs diff=lfs merge=lfs -text
single/mul/to_zero.tsv filter=lfs diff=lfs merge=lfs -text

BIN
float/tests/half/add/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:aa5c92fe38e213e54777fc360da96051c3eb2b2f183d46865317ae5559de267f
3 size 3522341

BIN
float/tests/half/add/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:202da221ffc35f4a9c37bb7a808051c455da84e303784688704c53d80307568b
3 size 3524101

BIN
float/tests/half/add/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:f1901aa55f4c1e7de29aeae3031190f310c1d4816eb84668dbd94a7d67003195
3 size 3524734

BIN
float/tests/half/add/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:6ac11f8dea8a0877150014e146dda127214bcee7d9eeba73747320043f8895b5
3 size 3524663

BIN
float/tests/half/div/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:dbcd32b4ea5c4ca3749990fb7db2a2e7e34843de9123a96ceedba99d3a7424e7
3 size 3543351

BIN
float/tests/half/div/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:b9a6c2acc17b346a1c528b42a1c10441cb7dcc7b1f7327311bfb10198f2d9324
3 size 3585815

BIN
float/tests/half/div/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:fe705985e536be1ceb1858de06bde871ba3a3e2efc33fee9a55884279af61f51
3 size 3584552

BIN
float/tests/half/div/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:db4351cbdec535e4268ecb4aeabc6d6118c6941b367412d1edccf0a5a5e40e4f
3 size 3626561

BIN
float/tests/half/fma/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:9e2d1b18d182769b797ca0e1e77299183531fd501663b4d578eb4b0656ba32c7
3 size 4129592

BIN
float/tests/half/fma/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:f13473e0f61a363d444ddc2296a14fe38e8695997a0850c03156b092987efa70
3 size 4170330

BIN
float/tests/half/fma/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:26c616cc39d4a8209cac53cd4f7b449dc4cede858f48c5e8d522ab36155aa305
3 size 4172748

BIN
float/tests/half/fma/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:2d0fbdf509f4a35237fea1461022c4eb7f9a435f3d776e204af3f0e14f30fda7
3 size 4216000

BIN
float/tests/half/mad/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:b018169b9794c5c0c273276f44da1eba196ddd0c3684e5f44106372f7df9d4b6
3 size 4129292

BIN
float/tests/half/mad/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:f386ce1f0100427e4c6e72cd781e2372edf5e5b65e2121d0ab00fb7b0e40a775
3 size 4171516

BIN
float/tests/half/mad/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:db8b43eff785f6dc462c29c16228b10a635a743a170dda5c9362cf55663f0403
3 size 4172480

BIN
float/tests/half/mad/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:d74d673f60ea99b9e222f8d118e6d69342c68b7d26cc89c3df7a792eff69e7ae
3 size 4216177

BIN
float/tests/half/mul/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:2e48c081d5f15879a956d8a14f0d61431fef50e3317d6046397ce46f02d6d1be
3 size 3531146

BIN
float/tests/half/mul/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:0658a3879e25f8d45ee44ac43f72fa53fdd50854207fdea639d87054ecebba2c
3 size 3579990

BIN
float/tests/half/mul/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:d93733f0a3549a31ab9745e5eefb4b56bc83fbbaa60aaa447320af5e5a2882b1
3 size 3580502

BIN
float/tests/half/mul/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:98411b3d0c3f52c8fce9e735071bdf51a7b7622c3b2b99c59c6c57fc5b7c52b2
3 size 3627896

BIN
float/tests/half/prn/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:0674377699ede68996a6fc1d0f3ee438ded54707b263e777c15c908eede55012
3 size 2830691

BIN
float/tests/half/prn/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:39ed2689bbee5209f5e8a2a6e219fbe418e145c361b80eaae3ec11cff168b39c
3 size 2831852

BIN
float/tests/half/prn/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:f77c3307221f1f28be9a35d9fd6b623fabab677c62ce9cbe5444502f5d62ed53
3 size 2831270

BIN
float/tests/half/prn/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:029818a7355fc5b191d6a47a1de992d1569e2a42a61216b6453d744bab24266c
3 size 2831606

BIN
float/tests/half/sub/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:b0c2c6031a2122919b84fe645f9154e52d4883c0fa0ac11441ac0b3906610a4c
3 size 3522386

BIN
float/tests/half/sub/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:333eae992b45abcc94118f68fcafaa4c6f53501ac2ff569b272afb2d0ef533f3
3 size 3523860

BIN
float/tests/half/sub/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:24bb81983c9a98af6bf65862ca7142928218c8f5aff170be31f39d3a61d48d81
3 size 3523690

BIN
float/tests/half/sub/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:7b95a2683173ceb64a591e1a0ab53fd982fa9b99ee1302389503efd168b621a4
3 size 3525759

BIN
float/tests/single/add/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:c4f3590f775be678637599b6c05ec0b31e57a3b9772f7e67beab009d755f8eee
3 size 24523962

BIN
float/tests/single/add/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:0e9fe60f5d51b30685d0e8c1a0d7485ae9cb71f45a7b9eacae2db0fe23f18f34
3 size 24467595

BIN
float/tests/single/add/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:aa5b59dbd6074f334f1b9b007158e42f2632b37e403dab16907274f55ef654cd
3 size 24535835

BIN
float/tests/single/add/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:a65bd71789fea4ef801a4dc1764d47b7c7612f3cafe1d56e9f9dcf1521deeb32
3 size 24515720

BIN
float/tests/single/div/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:f7542e0b3d5f7b78b7124e68a170e7a4088a2d9f0dfe2ebfae0a76daa2f34f17
3 size 23972752

BIN
float/tests/single/div/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:d9c402d6bf7b973b484d283f3dd16a63584b5485dc7b8ce70d00b3e7384c6868
3 size 24352062

BIN
float/tests/single/div/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:a224213b1b1aa29712c347e50eebca1c52d8008f7db02ff66bec2828e3650a4d
3 size 24368620

BIN
float/tests/single/div/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:5770992a2113c82311724ff978ebc113eca92d8b432efbd63c949f7d1fedc645
3 size 24604722

BIN
float/tests/single/fma/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:61485e89a1aebfda6f760b30104f3bec7ac3f632183bd1c3af6d61d214a83f8e
3 size 29478186

BIN
float/tests/single/fma/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:718751596abcb00e313da3d0d525ebcacbce3c6a7a4d66abebb4a26be641b227
3 size 29799628

BIN
float/tests/single/fma/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:d5a777ff761de2e5d44a1fdfcd22084223f2f752731bf4644e8ac3d90df4c8e2
3 size 29828304

BIN
float/tests/single/fma/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:7ea874e1aaea7896d676c0056e611dae209bb05d61fe7cb86815b71b624ae0f8
3 size 30152662

BIN
float/tests/single/mad/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:fff24c5941f30cc54108358c1cfa356502ebb11c882f152a5b9c5a31d7b73622
3 size 29516088

BIN
float/tests/single/mad/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:67127b15287496e1f8f1db2f4f4e27a66cc36a7db2d39e7aadec88ebaaa52994
3 size 29782687

BIN
float/tests/single/mad/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:07cb4d525483dd38a9e3024e95c0c6da6ca4f8a7cddef5a7eae9220f754eb391
3 size 29839005

BIN
float/tests/single/mad/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:bb0ea33168579756d9f3b27bca2549e9b36a2defe787631479e7f80466a9f852
3 size 30261102

BIN
float/tests/single/mul/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:431158d08b64e796a48b4ba67816b1842299a4ec7997514f3ae21e1bbe17da84
3 size 23859020

BIN
float/tests/single/mul/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:ae8d9d79562a3bded5debbbf2ede336061e816204c12770d55f96e84d1fba687
3 size 24341289

BIN
float/tests/single/mul/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:47fed07975fe0d0b2a7be1eba67b6381006d49f21a11bda4431a4eb9b47ef9fb
3 size 24362529

BIN
float/tests/single/mul/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:ff9696341b13cad81161ae831790dc2b43531a519dc3c0d2fe1003599c59fe18
3 size 24587486

BIN
float/tests/single/prn/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:3fd5fd9bf15187cb4117c53a32a77f505c173b0db57d4dee41e75a39d744974f
3 size 18826913

BIN
float/tests/single/prn/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:a8e48af6f3679c60b6364e21197eca96c0cabbe3012a71276548420fa9fe420b
3 size 18825403

BIN
float/tests/single/prn/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:7b8ed4edee6b670550d6389fa1625dd7718f436ceea9726b4e1edb646433396f
3 size 18782074

BIN
float/tests/single/prn/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:20cee7cc22598c26e9ff62629f23f8d8febc2336c0cbc385ae1a303c69399bc4
3 size 18773719

BIN
float/tests/single/sub/to_nearest_even.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:3b58618d19bd05b59374e5d6f4bcfdd9ca26c4d8246b1bf07865eddfe8962872
3 size 24492503

BIN
float/tests/single/sub/to_negative_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:131a605b0d24e4a758926a8c6e28ef7a7ed81005933bf3fad6610176cdab190b
3 size 24527075

BIN
float/tests/single/sub/to_positive_infinity.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:3b5cfd2b88c6e23d26a3b6b11e63e7174fc545c4a69919167b4ca34ff255525b
3 size 24511145

BIN
float/tests/single/sub/to_zero.tsv (Stored with Git LFS) Normal file

Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:7c8722aa41e8b75990b9a46994a182d8e2d0d269f0eaf1c242b1fa766496ec94
3 size 24515826