Rounding question

Michael D Gorsich gorsichm@dteenergy.com
Tue, 3 May 2005 14:16:41 -0400


<FONT face=3D"Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size=
=3D2><DIV>Guy,</DIV><DIV>&nbsp;</DIV><DIV>Is the round function always roun=
ding toward an&nbsp;odd thousandth's?&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>So {=
.0015, .0035. and .0055} round to {.001, .003, and .005}, respectively?</DI=
V><DIV>&nbsp;</DIV><DIV>I might have a clue (then again, it would be my fir=
st).</DIV><DIV>&nbsp;</DIV><DIV>Michael</DIV><DIV><BR>&nbsp;</DIV><FONT col=
or=3D#990099>-----powerh-l-admin@lists.sowder.com wrote: -----<BR><BR></FON=
T><blockquote style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: =
5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">To: "PH Mailing Lis=
t (E-mail)" &lt;powerh-l@lists.sowder.com&gt;<BR>From: Guy Werry &lt;guy.we=
rry@hbms.ca&gt;<BR>Sent by: powerh-l-admin@lists.sowder.com<BR>Date: 05/03/=
2005 11:47<BR>Subject: Rounding question<BR><BR><FONT face=3D"Default Monos=
pace,Courier New,Courier,monospace" size=3D2  >Ph 7.33.D3, Ux 10.20<BR><BR>=
The rounding function is giving me fits. &nbsp;Specifically, I have a value=
 in a<BR>FLOAT data item and was rounding it like this:<BR><SPAN style=3D"V=
ISIBILITY: hidden">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>round(inp=5Fval,3,near)<B=
R><BR>So I'm trying to round to 3 decimals. &nbsp;If I enter 0.0015, it rou=
nds DOWN to<BR>0.001!<BR><BR>I have tried various combinations of the "mult=
iply by 1000, round it, divide<BR>by 1000" rigamarole, with no success.<BR>=
<BR>Is there a clean, neat solution to this? &nbsp;Is there some way of tel=
ling the<BR>stupid thing to round UP on that 5? &nbsp;Note that the "UP" an=
d "DOWN" options<BR>don't give the results that I need.<BR><BR>[The frustra=
tion mirrored here is largely due to the fact that COBOL rounds<BR>wonderfu=
lly and predictably and I've NEVER found another language that could<BR>rou=
nd its way out of a wet paper bag!]<BR><BR>Thanks,<BR>Guy L. Werry<BR>Senio=
r Systems Analyst<BR>Hudson Bay Mining &amp; Smelting Co., Limited. <BR><BR=
><BR><BR>-- <BR>=3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D=
                =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D<BR>Mail=
ing list: powerh-l@lists.sowder.com<BR>Subscribe: "subscribe" in message bo=
dy to powerh-l-request@lists.sowder.com<BR>Unsubscribe: "unsubscribe &lt;pa=
ssword&gt;" in message body to powerh-l-request@lists.sowder.com<BR><A href=
=3D"http://lists.sowder.com/mailman/listinfo/powerh-l" target=3Dblank  >htt=
p://lists.sowder.com/mailman/listinfo/powerh-l</A><BR>This list is closed, =
thus to post to the list you must be a subscriber.<BR></FONT></blockquote><=
br></FONT>=