Apr 14, 2004 #1 nfaber Technical User Oct 22, 2001 446 US Greetings, I have a int variable I wish to round off. an example is: $num = 171.674560185185 This represents: 171 days .674560185185 % of one day I wish to round off .674560185185 in this case to .675 Any ideas?
Greetings, I have a int variable I wish to round off. an example is: $num = 171.674560185185 This represents: 171 days .674560185185 % of one day I wish to round off .674560185185 in this case to .675 Any ideas?
Apr 14, 2004 1 #2 ishnid Programmer Aug 29, 2003 1,422 IE Straight from perlfaq4: Code: printf("%.3f", 3.1415926535); # prints 3.142 # alternatively $rounded_num = sprintf("%.3f", 3.1415926535); Upvote 0 Downvote
Straight from perlfaq4: Code: printf("%.3f", 3.1415926535); # prints 3.142 # alternatively $rounded_num = sprintf("%.3f", 3.1415926535);
Apr 14, 2004 Thread starter #3 nfaber Technical User Oct 22, 2001 446 US Thanks ishnid that did it. Upvote 0 Downvote