Got a perl question for y'all.  I rarely have to do anything with perl,
and I'm sure perl has a good reason for behaving like the following, but
heck if I can figure it out.

The perl cookbook suggestions using sprintf for rounding floats.  This
seemingly works fine:

[EMAIL PROTECTED]:~$ perl -e 'print sprintf( "%.2f\n", 0.562 )'
0.56
[EMAIL PROTECTED]: perl -e 'print sprintf( "%.2f\n", 0.567 )'
0.57

However, I'm extremely confused by the following:

[EMAIL PROTECTED]:~$ perl -e 'print sprintf( "%.2f\n", 0.565 )'
0.56

Can anybody explain why this is not rounding up?  Thanks in advance...

-- 
We are Linux.  Resistance is an indication that you have missed the 
point.

Cole Tuininga
Lead Developer
Code Energy, Inc
[EMAIL PROTECTED]
PGP Key ID: 0x43E5755D


_______________________________________________
gnhlug-discuss mailing list
[EMAIL PROTECTED]
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss

Reply via email to