jclaudio has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm running the simple code above:
where CALCUL_DIV is a subroutine doing the operation: $col1/10^($col2) ( I put It in a subroutine 'cause the operation is very often done) the result is printed in a file, and here's my problem:if ($col3=~'D'){ $result=-1*CALCUL_DIV($col1,$col2); } else {$result = CALCUL_DIV($col1,$col2);}
It occurs when $col3="D", when $col1="0.0" , CALCUL_DIV returns normally "0" but cause of the "D" , I have "-0" printed in the file, when edited with VI, (UNIX)
I edited the file with VIM on windows, and I don't have "-0", but the right "0" printed !
I must be missing something, but I don't see what.
Has anybody already noticed something like that ?
20031030 Edit by Corion: Added formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: calcul returns "-0"
by Abigail-II (Bishop) on Oct 30, 2003 at 10:07 UTC |