Skip to content

Support the reworked degree trigonometry on Julia 1.15 - #41

Merged
maleadt merged 1 commit into
mainfrom
tb/nightly-trig
Nov 5, 2026
Merged

maleadt merged 1 commit into
mainfrom
tb/nightly-trig

Conversation

@maleadt

@maleadt maleadt commented Nov 5, 2026

Copy link
Copy Markdown
Member

JuliaLang/julia#63544 rewrote the Float16, Float32 and Float64 trigonometry on master (1.15.0-DEV.482). It removed deg2rad_ext, sin_kernel and cos_kernel, which the overrides for sind and friends target, so GPUToolbox no longer precompiles on nightly:

ERROR: LoadError: UndefVarError: `deg2rad_ext` not defined in `Base.Math`

Under the rewrite, Float32 sind, cosd, sincosd and tand reduce the angle to π/16 * n plus a remainder in Float64 (rem_deg16), then evaluate sincos16_kernel and tan16 in Float64. On 1.15, this overrides rem_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 in Radians32 as before, with n a multiple of 8. The kernels for Radians32 call sin and cos and rotate their results by the quadrant. Older versions keep the existing overrides.

Over all Float32 inputs, composed as trig16 does, sind and cosd stay within 1 ulp of Base on nightly, and zeros and infinities have the same signs as Base's. tand is within 3 ulp, as the quotient of the two, which is how Base computed Float32 tand before 1.15. Tests pass on 1.10, 1.13 and nightly.

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.
@maleadt
maleadt merged commit ba25d77 into main Nov 5, 2026
10 checks passed
@maleadt
maleadt deleted the tb/nightly-trig branch November 5, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant