Repository navigation
Conversation
zcbenz
force-pushed
the
fix/cpu-float64-transcendentals
branch
from
November 1, 2026 10:55
6b9b8c3 to
9de9b7d
Compare
zcbenz
marked this pull request as ready for review
November 1, 2026 10:56
zcbenz
force-pushed
the
fix/cpu-float64-transcendentals
branch
from
November 1, 2026 12:51
9de9b7d to
458588b
Compare
zcbenz
approved these changes
Nov 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while investigating #4614.
On CPU,
exp,sin,cosanderfwith float64 inputs went through thefloat32 SIMD paths in
mlx/backend/cpu/simd/math.h. The input was truncatedto float32, giving about 1e-8 error, and the float32 range clamps applied:
exp(-94.8)returned 0.0 instead of 6.7e-42.Doubles now take the scalar
std::overloads per lane. The float32 andcomplex paths are unchanged.
erfinvstill computes in float32 for doubleinputs since there is no portable
std::erfinv, that can be a follow-up.test_unary_ops_keep_double_precisionintest_double.pyfails before thechange and passes after.
test_double.pyandtest_ops.pypass (187 tests,597 subtests).
Cost: float64
expon CPU goes from 0.50 to 4.84 ms per 1M elements,float32 is unchanged at 0.34 ms.