Skip to content

Commit

Permalink
Add branchHint to std.math.pow
Browse files Browse the repository at this point in the history
NaN is an unlikely case, and a branchHint `.unlikely` could be appropriate.
  • Loading branch information
LiamSwayne authored and andrewrk committed Dec 18, 2024
1 parent 4ae101c commit f857bf7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/std/math/pow.zig
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {
// pow(nan, y) = nan for all y
// pow(x, nan) = nan for all x
if (math.isNan(x) or math.isNan(y)) {
@branchHint(.unlikely);
return math.nan(T);
}

Expand Down

0 comments on commit f857bf7

Please sign in to comment.