PDA

View Full Version : Rounding Numbers



Lucky13
July 3rd, 2001, 20:56
I need to know how to round a decimal to the nearest whole number. If anyone can help me, I would really appreciate it. Thanks.

~Lucky13

lucifer
July 4th, 2001, 05:01
JavaScript

x=Math.round(x)

Perl

$x=sprintf("%d",$x + .5)

PHP

$x=round($x,0)

Lucky13
July 4th, 2001, 11:35
Awesome....thanks