Thank you everyone for your input... I forgot the basics... This was
only happening in about 1 in 150 cases... 

Solution was:

sub IFormat_num{
    #
    #   value = number to format, required
    #   places= decimal places, required
    #   float = character to prefix string with
    #   credit= credit format, (<1>,2,3) = ("surround string with <>",
"CR suffix", "- suffix")
    #
    my ($value, $places, $float, $credit) = @_;
        $credit = 1 unless $credit =~ /[1-3]/;
        my $is_credit = 1 if $value < 0;
        my $format = '%.' . $places . 'f';
# 12-Mar-08
#my $formated = $float . &commify(sprintf('%.*f',$places,abs($value)));#
12-Mar-08 don't know what this was doing!
        my $formated = $float . &commify(sprintf($format,abs($value)));
# 12-Mar-08
        if ($credit == 1) {
            return $is_credit?'<' . $formated . '>':$formated . ' ';
            }
        elsif ($credit == 2) {
            return $is_credit?$formated . 'CR':$formated;
            }
        else {
            return $is_credit?$formated . '-':$formated . ' ';
            }
    }

John W Moon 


  
http://dmspulsesurvey.myflorida.com/is
 
 
 
-----Original Message-----
 
 
From: John W. Krahn [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2008 9:05 AM
To: Perl Beginners
Subject: Re: Sum not producing zero

Moon, John wrote:
>  
> Below is a small script and results... Can someone example what I am
> doing wrong - the sum should produce zero but does not.

http://perlmonks.org/?node_id=665673

perldoc -q 99999999

perldoc perlnumber



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to