List Info

Thread: Re: how to round a floating-point value to an integer value




Re: how to round a floating-point value to an integer value
country flaguser name
United States
2007-03-20 00:22:28
At 04:34 AM 3/18/2007 +0000, mark.dootsonznix.com
wrote:
>Do 'human rounding principles' say that you would expect
10 / 3 rounded
>to 2 DP would produce 3.34 or 3.33? How about -10 / 3?

10/3 rounded to two places is 3.33.  3.34 is simply wrong. 
To say that 3.34
is 10/3 rouned to two places means that ur using another
rounding scheme
that people don't use.  Same with -10/3.

>I assume that if you asked someone to calculate the
digits of pi, you'd
>expect them to stop some time. How do 'human rounding
principles' say
>they should deal with that.

There's no rounding involved when u stop a calculation.  If
u calculate pi
to 100 digits and stop, the 100th digit has not been
rounded.  If u wanted
to round that to 90 digits then that's rounding.  The
criteria is pick the
value that has the least error from the actual value.

>My point was just that I can't think of a single
practical case where
>you would be worried about whether 1.5 displayed as 1 or
2, and floating
>point numbers would have any place in your calculation.
If your floating
>point answer is crud, then fiddling with it at the end
of your
>calculation so it looks pretty just makes it cruddier.

Rounding to an integer is just the current example. 
Rounding is usually
done to 2-3 places because that's all the precision most
things need.  A
case where rounding makes a huge difference is in
estimating.  If u round
wrong ur estimate will be no good.  Usually though rounding
is just for
human convenience.





--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911
>=--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Userslistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )