Skip to content

Commit c200fbb

Browse files
committed
Only change rounding modes if they are different.
1 parent 9eef008 commit c200fbb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libc/src/__support/math/expf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ static constexpr float expf(float x) {
112112
// Directional rounding version of expf.
113113
LIBC_INLINE static float expf(float x, int rounding_mode) {
114114
int current_rounding_mode = fputil::get_round();
115+
if (rounding_mode == current_rounding_mode)
116+
return expf(x);
117+
115118
fputil::set_round(rounding_mode);
116119
float result = expf(x);
117120
fputil::set_round(current_rounding_mode);

0 commit comments

Comments
 (0)