SQLite Forum

Test 3.39.0 fails on x86 32bit
Login

Test 3.39.0 fails on x86 32bit

(1) By anonymous on 2022-06-26 12:49:43 [link] [source]

Log:

SQLite 2022-06-25 14:57:57 14e166f40dbfa6e055543f8301525f2ca2e96a02a57269818b9e69e162e9alt1
1 errors out of 249495 tests on localhost.localdomain Linux 32-bit little-endian
!Failures on these tests: func7-pg-181
All memory allocations freed - no leaks
Maximum memory usage: 9187504 bytes
Current memory usage: 0 bytes
Number of malloc()  : -1 calls
make: *** [Makefile:1281: tcltest] Error 1
make: Leaving directory '/usr/src/RPM/BUILD/sqlite-3.39.0'-

But it succeed on x86_64, arm32, aarch64 and ppc64le.

(2) By anonymous on 2022-07-01 20:53:26 in reply to 1 [link] [source]

This is from c48a735b

(3) By Richard Hipp (drh) on 2022-07-02 00:00:36 in reply to 1 [link] [source]

The func7-pg-181 test case is this:

do_execsql_test func7-pg-181 {
  SELECT format('%.30f', log10(100.0) );
} {2.000000000000000000000000000000}

What answer (other than 2.000000000000000000000000000000) are you getting?

(4) By anonymous on 2022-07-02 18:38:49 in reply to 3 [link] [source]

From test-out.txt:

func7-pg-181...
! func7-pg-181 expected: [2.000000000000000000000000000000]
! func7-pg-181 got:      [1.999999999999999000000000000000]

(5) By Harald Hanche-Olsen (hanche) on 2022-07-02 20:58:37 in reply to 4 [link] [source]

That looks like two minus one ulp. My first impulse is to blame the test, not the code. Floating point is hard.

(6) By Donal Fellows (dkfellows) on 2022-07-04 12:11:15 in reply to 5 [source]

The implementation in SQLite is apparently in terms of the standard log() function instead of calling log10() directly, so being ulp out is possible. (The same will also potentially apply to log2(), but with different input values.) That's why there's a direct implementation of log10() and log2() in C, so that appropriate tables are used and error minimised.

(7) By anonymous on 2022-07-05 13:05:09 in reply to 4 [link] [source]

func7-pg-182 fails for the same reason

(9) By Reinhard Max (reimax) on 2022-11-17 14:20:44 in reply to 4 [link] [source]

I can reproduce this with version 3.40.0.

(10) By Richard Hipp (drh) on 2022-11-17 14:47:47 in reply to 9 [link] [source]

Please try again with https://sqlite.org/src/info/7c572d02e60a83b3 (pull a tarball from the "Downloads:" link near the top) and let me know if this clears your problem.

(8) By drjdpowell on 2022-07-05 16:28:08 in reply to 1 [link] [source]

I was seeing similar with 3.38: see Log10(100) = 1.9999999999999998 ?!?

But with 3.39.0 I get 2 as the exact answer, in 32-bit and 64-bit.