Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next/prevfloat(::BFloat16,::Integer) with tests #49

Merged
merged 4 commits into from
Oct 6, 2023

Conversation

milankl
Copy link
Member

@milankl milankl commented Jul 12, 2023

fixes #48

@codecov
Copy link

codecov bot commented Jul 12, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (630428a) 52.17% compared to head (e10709c) 65.41%.
Report is 7 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master      #49       +/-   ##
===========================================
+ Coverage   52.17%   65.41%   +13.23%     
===========================================
  Files           3        3               
  Lines         138      133        -5     
===========================================
+ Hits           72       87       +15     
+ Misses         66       46       -20     
Files Coverage Δ
src/bfloat16.jl 72.26% <91.89%> (+4.97%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maleadt
Copy link
Member

maleadt commented Oct 6, 2023

A recursive implementation like that isn't great, I think it's better to copy what Base has:

julia> @benchmark nextfloat(BFloat16(0), 9999)
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
 Range (min … max):  89.875 μs … 114.750 μs  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     90.083 μs               ┊ GC (median):    0.00%
 Time  (mean ± σ):   90.405 μs ±   1.361 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%

  ▂█▄▄▆▅▃▁                   ▁▂  ▁                             ▁
  ████████▆▅▃▃▁▃▁▁▁▁▁▁▃▁▁▁▁▁▇██▅▇█▆▃▅▅▅▄▄▃▄▄▃▃▁▃▁▁▅▁▃▄▁▁▃▃▁▁▆▆ █
  89.9 μs       Histogram: log(frequency) by time      96.4 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> @benchmark nextfloat(BFloat16(0), 9999)
BenchmarkTools.Trial: 10000 samples with 1000 evaluations.
 Range (min … max):  1.167 ns … 15.167 ns  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     1.250 ns              ┊ GC (median):    0.00%
 Time  (mean ± σ):   1.259 ns ±  0.273 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

                     ▂                  █                  ▂ ▁
  ▃▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█ █
  1.17 ns      Histogram: log(frequency) by time     1.29 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

@maleadt maleadt merged commit a42c4fa into JuliaMath:master Oct 6, 2023
18 checks passed
@milankl
Copy link
Member Author

milankl commented Oct 6, 2023

Awesome! Thanks Tim!

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.

nextfloat/prevfloat(::BFloat16,::Integer) missing
2 participants