Raymond Toy pushed to branch issue-425-correctly-rounded-math-functions at cmucl / cmucl Commits: 0996e320 by Raymond Toy at 2025-12-17T13:38:16-08:00 Adjust threshold for log-consistency test Change the threshold for the first test case to 1.42108548d-14 instead of 1.77635684d-15. This worst case value happens for k = 326. - - - - - 53b84f3d by Raymond Toy at 2025-12-17T13:41:47-08:00 Adjust expected value for asinh of most-positive-double-float The expected result has changed by a single bit with core-math. - - - - - 4c8b272e by Raymond Toy at 2025-12-17T13:43:47-08:00 Adjust expected value for acosh of most-positive-double-float The expected result has changed by a single bit with core-math. - - - - - 07fd3bac by Raymond Toy at 2025-12-17T13:45:23-08:00 Let's try gcc with -march=haswell An experiment to see if we can compile the code with gcc if we set -march=hashwell, which is the first processor with the FMA instruction. - - - - - 3 changed files: - .gitlab-ci.yml - src/lisp/Config.x86_linux - tests/fdlibm.lisp Changes: ===================================== .gitlab-ci.yml ===================================== @@ -147,7 +147,7 @@ linux:build: - job: linux:install artifacts: true variables: - CONFIG: "x86_linux_clang" + CONFIG: "x86_linux" # These rules is needed so that the static analyzer job can run on a # schedule because this is a prerequisite of the analyzer build. A # regular push or merge request does the normal stuff. @@ -171,7 +171,7 @@ linux:cross-build: - linux-4/lisp variables: # This must match the config used for the linux build! - CONFIG: "x86_linux_clang" + CONFIG: "x86_linux" needs: @@ -346,7 +346,7 @@ ubuntu:build: - job: ubuntu:install artifacts: true variables: - CONFIG: "x86_linux_clang" + CONFIG: "x86_linux" ubuntu:test: <<: *unit_test_configuration ===================================== src/lisp/Config.x86_linux ===================================== @@ -6,7 +6,8 @@ CORE_MATH = -DCORE_MATH_SUPPORT_ERRNO CFLAGS += $(COPT) CPPFLAGS += -m32 -CFLAGS += -rdynamic -march=pentium4 -mfpmath=sse -mtune=generic +#CFLAGS += -rdynamic -march=pentium4 -mfpmath=sse -mtune=generic +CFLAGS += -rdynamic -march=haswell -mfpmath=sse # ANALYZER flag should be set to -fanalyzer when doing the CI builds # for the C static analyzer. CFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(ANALYZER) ===================================== tests/fdlibm.lisp ===================================== @@ -349,7 +349,9 @@ ;; acosh(2^50), case 2^28 < x (assert-eql 35.35050620855721d0 (acosh (scale-float 1d0 50))) ;; No overflow for most positive - (assert-eql 710.4758600739439d0 (acosh most-positive-double-float))) + (assert-eql #-core-math 710.4758600739439d0 + #+core-math 710.475860073944d0 + (acosh most-positive-double-float))) (define-test asinh-basic-tests (:tag :fdlibm) @@ -378,8 +380,12 @@ (assert-eql -20.101268236238415d0 (asinh (- x)))) (let ((x most-positive-double-float)) ;; No overflow for most-positive-double-float - (assert-eql 710.4758600739439d0 (asinh x)) - (assert-eql -710.4758600739439d0 (asinh (- x))))) + (assert-eql #-core-math 710.4758600739439d0 + #+core-math 710.475860073944d0 + (asinh x)) + (assert-eql #-core-math -710.4758600739439d0 + #+core-math -710.475860073944d0 + (asinh (- x))))) (define-test atanh-basic-tests (:tag :fdlibm) @@ -517,34 +523,52 @@ ;; |log(x) + log(1/x)| < 1.77635684e-15, x = 1.2^k, 0 <= k < 2000 ;; The threshold is experimentally determined (let ((x 1d0) - (max-value -1d0)) + (max-value -1d0) + (worst-x 0d0)) (declare (double-float max-value) (type (double-float 1d0) x)) (dotimes (k 2000) (let ((y (abs (+ (log x) (log (/ x)))))) - (setf max-value (max max-value y)) + (when (> y max-value) + (setf worst-x x + max-value y)) (setf x (* x 1.4d0)))) - (assert-true (< max-value 1.77635684d-15))) + (assert-true (< max-value + #-core-math 1.77635684d-15 + #+core-math 1.42108548d-14) + max-value + worst-x)) ;; |exp(log(x)) - x|/x < 5.6766649d-14, x = 1.4^k, 0 <= k < 2000 (let ((x 1d0) - (max-error 0d0)) - (declare (double-float max-error) + (max-error 0d0) + (worst-x 0d0)) + (declare (double-float max-error worst-x worst-y) (type (double-float 1d0) x)) (dotimes (k 2000) (let ((y (abs (/ (- (exp (log x)) x) x)))) - (setf max-error (max max-error y)) + (when (> y max-error) + (setf worst-x x + max-error y)) (setf x (* x 1.4d0)))) - (assert-true (< max-error 5.6766649d-14))) + (assert-true (< max-error 5.6766649d-14) + max-error + worst-x + worst-y)) ;; |exp(log(x)) - x|/x < 5.68410245d-14, x = 1.4^(-k), 0 <= k < 2000 (let ((x 1d0) - (max-error 0d0)) - (declare (double-float max-error) + (max-error 0d0) + (worst-x 0d0)) + (declare (double-float max-error worst-x worst-y) (type (double-float (0d0)) x)) (dotimes (k 2000) (let ((y (abs (/ (- (exp (log x)) x) x)))) - (setf max-error (max max-error y)) + (when (> y max-error) + (setf worst-x x + max-error y)) (setf x (/ x 1.4d0)))) - (assert-true (< max-error 5.68410245d-14)))) + (assert-true (< max-error 5.68410245d-14) + max-error + worst-x))) (define-test sinh-basic-tests (:tag :fdlibm) View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/e174f34db37b03265640546... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/e174f34db37b03265640546... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)