-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Description
Comparisons seem to involve BigFloat conversions, which makes them way slower than Base.Irrational
julia> @btime 3.0 ≤ pi
1.287 ns (0 allocations: 0 bytes)
true
julia> @btime 3.0 ≤ invsqrt2
471.291 ns (8 allocations: 352 bytes)
falseThis seems to be causing JuliaMath/SpecialFunctions.jl#484
In contrast, it's way faster to compare after conversion of the irrational value to floating point:
julia> @btime 3.0 ≤ oftype(3.0, invsqrt2)
1.287 ns (0 allocations: 0 bytes)
falseI'm guessing this is some type of pedantry where you want to check that the exact rational floating-point value is ≤ the exact irrational value? Even so, can't you just compare to the RoundDown conversion?
(Why didn't you just use Base.Irrational, anyway?)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels