In message <200310072341.47898@bloodgate.com> (on 7 October 2003 23:41:46 +0200), perl_dummy@bloodgate.com (Tels) wrote: >But why does > > perl -le "print +(81**3)**(1/3)" > >print 81 and not 80.99999999999999? perldoc print only says that it will >print "a string or list of strings" but doesn't mention how print creates >the strings. I guess it uses sprintf ("%.0f") or something internally when >it sees a scalar containing a float, but I couldn't find the place where is >documented how print converts floats to a string. (I am not saying that it >isn't in the doc - I just don't know where to look for it. Where is >perlgoogle when you need it...) Quite. It's buried in one of the deprecated variables in perlvar: $# The output format for printed numbers. This variable is a half-hearted attempt to emulate awk's OFMT variable. There are times, however, when awk and Perl have differing notions of what is in fact numeric. The initial value is %.ng, where n is the value of the macro DBL_DIG from your system's float.h. This is different from awk's default OFMT setting of %.6g, so you need to set "$#" explicitly to get awk's value. (Mnemonic: # is the number sign.) -Allen -- Allen Smith http://cesario.rutgers.edu/easmith/ February 1, 2003 Space Shuttle Columbia Ad Astra Per Aspera To The Stars Through Asperity