Home
Notes from a blog PDF Print E-mail
Perl Class - Free Perl Books
Written by Administrator   
Friday, 17 April 2009 16:32
Posted by Matt Makarczyk (Systems Analyst/Programmer)
on 04/15/2009 10:07:00 AM
you can round floats using floor or ceil (part of POSIX) or use printf..
for example printf("%.3f", 3.1415) would print 3.142. However, I suggest you not test the outer limits or put a heap of faith in its accuracy.
"Put in simple terms, you cannot rely on floating point to be free of rounding errors in some of the last few digits of precision. You're out at the limits there. Different versions of Perl, different architectures, and different alignment of planetary orbits will introduce minor rounding errors as the internal binary representation of floating point numbers manifests its limitations."
Best-
Matt Makarczyk
__._

Comments (0)

 
Copyright © 2010 Jeremy P. McKay. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.
 

 

Jeremy's Artist Blog

Jeremy P. McKay, Artist
"Creative work is not a selfish act or a bid for attention on the part of the actor. It is a gift to the world and every being in it. Don't cheat us of your contribution. Give us what you've got" -- The War of Art: Break Through the Blocks and Win Your Inner Creative Battles by Steven Pressfield.
  • Balboa Park Alcazar Garden 20100928
    What a fun day with San Diego Plein Air meet up group.   They are going out again this Saturday   September 4, 2010 to this same location.  It will be a great time, stop by and say hello. This painting is 9 x 12 oil.  It is available on Ebay http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=150486266735

Mark Joyner

Mark Joyner's Blog: Atomic Mind Bombs (Personal Development Brain Puzzle Cartoons)