diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-03 05:33:21 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-03 05:33:21 +0000 |
commit | 32fdb0651975fc8e2d4b926fd3bd5792b31acf57 (patch) | |
tree | 01c466e5ad08fc6610f100c9b26b71394eaff504 /pp.c | |
parent | 22adf171e6a33aa2d076b4a9a86b73487d6534c0 (diff) | |
download | perl-32fdb0651975fc8e2d4b926fd3bd5792b31acf57.tar.gz |
Use a macro for abs() to avoid the possible truncation to an int;
also make an explicit (double)cast for the arguments to fabs().
p4raw-id: //depot/perl@18813
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -1236,7 +1236,7 @@ PP(pp_divide) } RETURN; } /* tried integer divide but it was not an integer result */ - } /* else (abs(result) < 1.0) or (both UVs in range for NV) */ + } /* else (PERL_ABS(result) < 1.0) or (both UVs in range for NV) */ } /* left wasn't SvIOK */ } /* right wasn't SvIOK */ #endif /* PERL_TRY_UV_DIVIDE */ @@ -2483,9 +2483,7 @@ PP(pp_i_modulo_1) dPOPTOPiirl; if (!right) DIE(aTHX_ "Illegal modulus zero"); - if (right < 0) - right = -right; - SETi( left % right ); + SETi( left % PERL_ABS(right) ); RETURN; } #endif @@ -2522,8 +2520,7 @@ PP(pp_i_modulo) PL_ppaddr[OP_I_MODULO] = &Perl_pp_i_modulo_1; /* Make certain we work right this time, too. */ - if (right < 0) - right = -right; + right = PERL_ABS(right); } } #endif |