JuliaMath / NaNMath.jl

Julia math built-ins which return NaN and accumulator functions which ignore NaN
Other
53 stars 28 forks source link

Fix order of promotion and `float` in `pow` #52

Closed devmotion closed 2 years ago

devmotion commented 2 years ago

Currently, pow(-1.5f0, 2) isa Float64 since both arguments are converted to floating point numbers before they are promoted. This PR changes the order of these two operations and hence ensures that pow(-1.5f0, 2) isa Float32.

mlubin commented 2 years ago

Seems reasonable, thanks!

codecov-commenter commented 2 years ago

Codecov Report

Merging #52 (5a6c514) into master (6436c4f) will increase coverage by 0.05%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #52      +/-   ##
==========================================
+ Coverage   94.84%   94.89%   +0.05%     
==========================================
  Files           1        1              
  Lines          97       98       +1     
==========================================
+ Hits           92       93       +1     
  Misses          5        5              
Impacted Files Coverage Δ
src/NaNMath.jl 94.89% <100.00%> (+0.05%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6436c4f...5a6c514. Read the comment docs.