Truncate
Matt Sherrill
mmsv45 at yahoo.com
Wed Dec 11 14:15:49 PST 2013
Ken,
Thank you so much for your help. Your solution will work great!
Issue: Rounding with truncating the decimal.
Thanks!
Matt Sherrill
>________________________________
> From: ken white <kenwhite at verizon.net>
>To: Matt Sherrill <mmsv45 at yahoo.com>
>Sent: Wednesday, December 11, 2013 4:06 PM
>Subject: Re: Truncate
>
>
>for clarity:
>(104053.14 + 130939.172) = 234992.312 'number to round
>the result should be 235000
>
>But what if 234942.312 was the number to round to the nearest hundreds?
>It should show rounded as 234900
>
>I believe the code provided does what you want.
>::na(12,.5) = "234992.312"
>::nn(8,.0)=int(na) '234992:
>::no(8,.0)=mod(nn,"100"): '92
>::nn=nn-no: '234900
>:no ge "50":nn=nn+"100": '+100
>::msgbox nn: '235000
>::end:
>
>::na(12,.5) = "234942.312"
>::nn(8,.0)=int(na) '234942:
>::no(8,.0)=mod(nn,"100"): '42
>::nn=nn-no: '234900
>:no ge "50":nn=nn+"100": '+0
>::msgbox nn: '234900
>
>::end:
>
>wu(8,.0) = nn
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.celestial.com/pipermail/filepro-list/attachments/20131211/73184680/attachment.html
More information about the Filepro-list
mailing list