in reply to Rounding With sprintf anomaly?

I dunno what to tell you, except you're dealing with floats... deal with ints instead ... (I have no insight, only code, well a little insight - perl has internal ways of distinguishing numbers from strings .... (s)printf are c functions, do stuff similar to (un)pack in fsking with the numbers ... that kinda it, vague ain't it )
#!/usr/bin/perl my $one = 7 + (2 - (0.5 * 9)); my $two = 7 + (2 - (0.5 * 9)); my $thr = 7 + (5 - (0.5 * 9)); for($one,$two,$thr) { printf "no_ROUND(%s) yes_ROUND(%d) foy_FLOAT(%f) foy_ROUND(%.0f)\n\n", $_,$_,$_,$_; =head2 UPDATE: uncomment this to add to the mistery print "pack i ".unpack('i*', pack('i*', $_))."\n"; print "pack l ".unpack('l*', pack('l*', $_))."\n"; print "pack f ".unpack('f*', pack('f*', $_))."\n"; print "pack d ".unpack('d*', pack('d*', $_))."\n"; =cut and don't forget cut# } __END__ =pod C:\>perl round.txt no_ROUND(4.5) yes_ROUND(4) foy_FLOAT(4.500000) foy_ROUND(5) no_ROUND(4.5) yes_ROUND(4) foy_FLOAT(4.500000) foy_ROUND(5) no_ROUND(7.5) yes_ROUND(7) foy_FLOAT(7.500000) foy_ROUND(8) =head1 that is an interesting way to get an int %% a percent sign %c a character with the given number %s a string %d a signed integer, in decimal %u an unsigned integer, in decimal %o an unsigned integer, in octal %x an unsigned integer, in hexadecimal %e a floating-point number, in scientific notation %f a floating-point number, in fixed decimal notation %g a floating-point number, in %e or %f notation =cut
update: guha brings up a good point, ints/floats will still vary from system 2 system

 
______crazyinsomniac_____________________________
Of all the things I've lost, I miss my mind the most.
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"