Open
Description
I was hoping to write some specific functions for DoubleFloats using evalpoly
routines but it appears that using BigFloats is significantly faster...
using DoubleFloats, BenchmarkTools
function d64_test(x::Double64)
c = (
df64"3.133239376997663645548490085151484674892E16", df64"-5.479944965767990821079467311839107722107E14",
df64"6.290828903904724265980249871997551894090E12", df64"-3.633750176832769659849028554429106299915E10",
df64"1.207743757532429576399485415069244807022E8", df64"-2.107485999925074577174305650549367415465E5"
)
return evalpoly(x, c)
end
function big_test(x::BigFloat)
c = (
big"3.133239376997663645548490085151484674892E16", big"-5.479944965767990821079467311839107722107E14",
big"6.290828903904724265980249871997551894090E12", big"-3.633750176832769659849028554429106299915E10",
big"1.207743757532429576399485415069244807022E8", big"-2.107485999925074577174305650549367415465E5"
)
return evalpoly(x, c)
end
julia> @benchmark d64_test(df64"1.0"*rand())
BenchmarkTools.Trial: 10000 samples with 5 evaluations.
Range (min … max): 6.167 μs … 430.017 μs ┊ GC (min … max): 0.00% … 97.86%
Time (median): 6.283 μs ┊ GC (median): 0.00%
Time (mean ± σ): 6.459 μs ± 5.374 μs ┊ GC (mean ± σ): 1.16% ± 1.38%
julia> @benchmark big_test(big"1.0"*rand())
BenchmarkTools.Trial: 10000 samples with 10 evaluations.
Range (min … max): 1.262 μs … 240.604 μs ┊ GC (min … max): 0.00% … 99.32%
Time (median): 1.304 μs ┊ GC (median): 0.00%
Time (mean ± σ): 1.355 μs ± 3.362 μs ┊ GC (mean ± σ): 3.50% ± 1.40%
Is there a better way to set up this problem using Double64?
Thank you!
Metadata
Metadata
Assignees
Labels
No labels