toadi has asked for the wisdom of the Perl Monks concerning the following question:
I solved it the following way:my $pad_len_sum = my $som_rekening = "2147483648"; my $pad_len_sum = 15; my $padded_som = sprintf("%0${pad_len}d", $sum); print "PADDED SOM: $padded_sum - $sum\n";
Does this show me that I need to use inline C or something if I want to trust adding numbers together??my $som_rekening = "2147483648"; my $i = 15-length($som_rekening); $i = 0 if( $i < 0 ); my $padded_som = "0"x$i.$som_rekening; print "PADDED SOM: $padded_som - $som_rekening\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perls long number problem
by davorg (Chancellor) on Dec 10, 2001 at 16:21 UTC | |
by toadi (Chaplain) on Dec 10, 2001 at 16:29 UTC | |
by gbarr (Monk) on Dec 10, 2001 at 21:24 UTC | |
|
Re: perls long number problem
by rob_au (Abbot) on Dec 10, 2001 at 16:08 UTC | |
|
Re: perls long number problem
by sparkyichi (Deacon) on Dec 11, 2001 at 22:44 UTC | |
by tilly (Archbishop) on Dec 15, 2001 at 06:02 UTC |