Repository navigation
Support the reworked degree trigonometry on Julia 1.15 - #41
Merged
Merged
Conversation
JuliaLang/julia#63544 replaced the Float32 reduction and kernels behind `sind`, `cosd`, `sincosd` and `tand`, which now reduce to multiples of π/16 and evaluate the kernels in Float64. The functions the existing overrides target are gone, so GPUToolbox failed to load on nightly. On 1.15, reduce to a multiple of 90° in Float32 instead, exactly after reducing by 360°, and override the new kernels for the wrapped argument to use `sin` and `cos` and rotate their results by the quadrant. Over all Float32 inputs, `sind` and `cosd` stay within 1 ulp of Base, with the same signs of zero; `tand` is their quotient, as it was before 1.15.
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.
JuliaLang/julia#63544 rewrote the Float16, Float32 and Float64 trigonometry on master (1.15.0-DEV.482). It removed
deg2rad_ext,sin_kernelandcos_kernel, which the overrides forsindand friends target, so GPUToolbox no longer precompiles on nightly:Under the rewrite, Float32
sind,cosd,sincosdandtandreduce the angle toπ/16 * nplus a remainder in Float64 (rem_deg16), then evaluatesincos16_kernelandtan16in Float64. On 1.15, this overridesrem_deg16(::Float32)to reduce to a multiple of 90° in Float32 instead. That is exact after the reduction by 360°, and it returns the angle in radians, wrapped inRadians32as before, withna multiple of 8. The kernels forRadians32callsinandcosand rotate their results by the quadrant. Older versions keep the existing overrides.Over all Float32 inputs, composed as
trig16does,sindandcosdstay within 1 ulp of Base on nightly, and zeros and infinities have the same signs as Base's.tandis within 3 ulp, as the quotient of the two, which is how Base computed Float32tandbefore 1.15. Tests pass on 1.10, 1.13 and nightly.