0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2025-07-17 12:55:18 +00:00
Files
libsql/libsql-sqlite3/test/fixtures/fpconv1.test
2024-05-27 12:59:10 +02:00

16 lines
615 B
Plaintext

WITH RECURSIVE
/* Number of random floating-point values to try.
** On a circa 2016 x64 linux box, this test runs at
** about 80000 cases per second -------------------vvvvvv */
c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100000),
fp(y) AS MATERIALIZED (
SELECT CAST( format('%+d.%019d0e%+03d',
random()%10,abs(random()),random()%200) AS real)
FROM c
)
SELECT y FROM fp
WHERE -log10(abs(decimal_sub(dtostr(y,24),format('%!.24e',y))/y))<15.0;
/* Number of digits of accuracy required -------^^^^ */