diff options
author | TAKAI Kousuke <62541129+t-a-k@users.noreply.github.com> | 2021-01-27 23:53:48 +0900 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2021-09-22 15:59:35 +1000 |
commit | 644e3ee3290a8de5f7fc90ae85ae5c96a2a00039 (patch) | |
tree | 4db9a8ea95918f08581b222c393b66ed09bdcdff /pp.c | |
parent | 23cca2d1f4544cb47f1124d98c308ce1f31f09a6 (diff) | |
download | perl-644e3ee3290a8de5f7fc90ae85ae5c96a2a00039.tar.gz |
Use fabs/fabsl/fabsq for NVs in pp_abs.
In many floating point formats, fabs*() are rather simple operations
such as just clearing the sign bit, and will be slightly faster
than a conditional negation (especially with optimizing compilers).
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -3057,10 +3057,7 @@ PP(pp_abs) } } else{ const NV value = SvNV_nomg(sv); - if (value < 0.0) - SETn(-value); - else - SETn(value); + SETn(Perl_fabs(value)); } } return NORMAL; |