@@ -170,32 +170,31 @@ end
170170end
171171
172172
173- let
174- global expk
175- global expk2
176-
177- c10d = 2.51069683420950419527139e-08
178- c9d = 2.76286166770270649116855e-07
179- c8d = 2.75572496725023574143864e-06
180- c7d = 2.48014973989819794114153e-05
181- c6d = 0.000198412698809069797676111
182- c5d = 0.0013888888939977128960529
183- c4d = 0.00833333333332371417601081
184- c3d = 0.0416666666665409524128449
185- c2d = 0.166666666666666740681535
186- c1d = 0.500000000000000999200722
187-
188- c5f = 0.00136324646882712841033936f0
189- c4f = 0.00836596917361021041870117f0
190- c3f = 0.0416710823774337768554688f0
191- c2f = 0.166665524244308471679688f0
192- c1f = 0.499999850988388061523438f0
193-
194- global @inline expk_kernel (x:: Float64 ) = @horner x c1d c2d c3d c4d c5d c6d c7d c8d c9d c10d
195- global @inline expk_kernel (x:: Float32 ) = @horner x c1f c2f c3f c4f c5f
196-
197- global under_expk (:: Type{Float64} ) = - 1000.0
198- global under_expk (:: Type{Float32} ) = - 104f0
173+ const under_expk (:: Type{Float64} ) = - 1000.0
174+ const under_expk (:: Type{Float32} ) = - 104f0
175+
176+ @inline function expk_kernel (x:: Float64 )
177+ c10d = 2.51069683420950419527139e-08
178+ c9d = 2.76286166770270649116855e-07
179+ c8d = 2.75572496725023574143864e-06
180+ c7d = 2.48014973989819794114153e-05
181+ c6d = 0.000198412698809069797676111
182+ c5d = 0.0013888888939977128960529
183+ c4d = 0.00833333333332371417601081
184+ c3d = 0.0416666666665409524128449
185+ c2d = 0.166666666666666740681535
186+ c1d = 0.500000000000000999200722
187+ return @horner x c1d c2d c3d c4d c5d c6d c7d c8d c9d c10d
188+ end
189+
190+ @inline function expk_kernel (x:: Float32 )
191+ c5f = 0.00136324646882712841033936f0
192+ c4f = 0.00836596917361021041870117f0
193+ c3f = 0.0416710823774337768554688f0
194+ c2f = 0.166665524244308471679688f0
195+ c1f = 0.499999850988388061523438f0
196+ return @horner x c1f c2f c3f c4f c5f
197+ end
199198
200199@inline function expk (d:: Double{T} ) where {T<: Union{Float32,Float64} }
201200 q = round (T (d) * T (MLN2E))
@@ -232,28 +231,28 @@ end
232231 t = dadd (T (1.0 ), t)
233232 return scale (scale (t, T (2.0 )), pow2i (T, unsafe_trunc (Int, q - 1 )))
234233end
235- end
236234
237235
238- let
239- global logk2
240-
241- c8d = 0.13860436390467167910856
242- c7d = 0.131699838841615374240845
243- c6d = 0.153914168346271945653214
244- c5d = 0.181816523941564611721589
245- c4d = 0.22222224632662035403996
246- c3d = 0.285714285511134091777308
247- c2d = 0.400000000000914013309483
248- c1d = 0.666666666666664853302393
249236
250- c4f = 0.240320354700088500976562f0
251- c3f = 0.285112679004669189453125f0
252- c2f = 0.400007992982864379882812f0
253- c1f = 0.666666686534881591796875f0
237+ @inline function logk2_kernel (x:: Float64 )
238+ c8d = 0.13860436390467167910856
239+ c7d = 0.131699838841615374240845
240+ c6d = 0.153914168346271945653214
241+ c5d = 0.181816523941564611721589
242+ c4d = 0.22222224632662035403996
243+ c3d = 0.285714285511134091777308
244+ c2d = 0.400000000000914013309483
245+ c1d = 0.666666666666664853302393
246+ return @horner x c1d c2d c3d c4d c5d c6d c7d c8d
247+ end
254248
255- global @inline logk2_kernel (x:: Float64 ) = @horner x c1d c2d c3d c4d c5d c6d c7d c8d
256- global @inline logk2_kernel (x:: Float32 ) = @horner x c1f c2f c3f c4f
249+ @inline function logk2_kernel (x:: Float32 )
250+ c4f = 0.240320354700088500976562f0
251+ c3f = 0.285112679004669189453125f0
252+ c2f = 0.400007992982864379882812f0
253+ c1f = 0.666666686534881591796875f0
254+ return @horner x c1f c2f c3f c4f
255+ end
257256
258257@inline function logk2 (d:: Double{T} ) where {T<: Union{Float32,Float64} }
259258 e = ilogbk (d. hi * T (1.0 / 0.75 ))
@@ -266,28 +265,30 @@ global @inline logk2_kernel(x::Float32) = @horner x c1f c2f c3f c4f
266265
267266 dadd (dmul (MDLN2 (T), T (e)), dadd (scale (x, T (2.0 )), dmul (dmul (x2, x), t)))
268267end
268+
269+
270+
271+ @inline function logk_kernel (x:: Double{Float64} )
272+ c10d = 0.116255524079935043668677
273+ c9d = 0.103239680901072952701192
274+ c8d = 0.117754809412463995466069
275+ c7d = 0.13332981086846273921509
276+ c6d = 0.153846227114512262845736
277+ c5d = 0.181818180850050775676507
278+ c4d = 0.222222222230083560345903
279+ c3d = 0.285714285714249172087875
280+ c2d = 0.400000000000000077715612
281+ c1dd = Double (0.666666666666666629659233 , 3.80554962542412056336616e-17 )
282+ dadd2 (c1dd, dmul (x, @horner x. hi c2d c3d c4d c5d c6d c7d c8d c9d c10d))
269283end
270284
271- let
272- global logk
273- c10d = 0.116255524079935043668677
274- c9d = 0.103239680901072952701192
275- c8d = 0.117754809412463995466069
276- c7d = 0.13332981086846273921509
277- c6d = 0.153846227114512262845736
278- c5d = 0.181818180850050775676507
279- c4d = 0.222222222230083560345903
280- c3d = 0.285714285714249172087875
281- c2d = 0.400000000000000077715612
282- c1dd = Double (0.666666666666666629659233 , 3.80554962542412056336616e-17 );
283-
284- c4f = 0.240320354700088500976562f0
285- c3f = 0.285112679004669189453125f0
286- c2f = 0.400007992982864379882812f0
287- c1fd = Double (0.66666662693023681640625f0 , 3.69183861259614332084311f-9 )
288-
289- global @inline logk_kernel (x:: Double{Float64} ) = dadd2 (c1dd, dmul (x, @horner x. hi c2d c3d c4d c5d c6d c7d c8d c9d c10d))
290- global @inline logk_kernel (x:: Double{Float32} ) = dadd2 (c1fd, dmul (x, @horner x. hi c2f c3f c4f))
285+ @inline function logk_kernel (x:: Double{Float32} )
286+ c4f = 0.240320354700088500976562f0
287+ c3f = 0.285112679004669189453125f0
288+ c2f = 0.400007992982864379882812f0
289+ c1fd = Double (0.66666662693023681640625f0 , 3.69183861259614332084311f-9 )
290+ dadd2 (c1fd, dmul (x, @horner x. hi c2f c3f c4f))
291+ end
291292
292293@inline function logk (d:: T ) where {T<: Union{Float32,Float64} }
293294 o = d < realmin (T)
@@ -305,6 +306,3 @@ global @inline logk_kernel(x::Double{Float32}) = dadd2(c1fd, dmul(x, @horner x.h
305306
306307 dadd (dmul (MDLN2 (T), T (e)), dadd (scale (x, T (2.0 )), dmul (dmul (x2, x), t)))
307308end
308-
309-
310- end
0 commit comments