mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-12-12 15:33:44 +00:00
ad79ef48a2
* add tests * add bench
16 lines
615 B
Plaintext
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 -------^^^^ */
|
|
|