New topic: 

Rounding Problem -- Anyone Have a Solution?

<http://forums.realsoftware.com/viewtopic.php?t=34537>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        applesource          Post subject: Rounding Problem -- Anyone 
Have a Solution?Posted: Wed Jul 07, 2010 5:53 pm                                
 
Joined: Thu Aug 06, 2009 2:25 pm
Posts: 241
Location: Oregon                I've researched a lot about rounding, and for a 
long time have had no problems. Now, I'm writing a specific routine in my 
software that must be able to perform logical rounding on numbers to two 
decimals. Here are some examples:

865.81 needs to be 865.80
355.98 needs to be 356.00
1035.67 needs to be 1035.70

I've tried the following methods, with no success:

Code:dim e as currency=1035.67
e=ceil(e*100)/100 // this still reports 1035.67

I've also tried e=floor(e*100)/100 and e=round(e*100)/100

Nothing seems to be working. I'm sure I've overlooked something simple in 
solving this problem. Has anyone else dealt with a similar situation?

Thank you to anyone who can provide some insight.      
_________________
AppleSource Software
http://www.applesource.biz  
                             Top                 timhare          Post subject: 
Re: Rounding Problem -- Anyone Have a Solution?Posted: Wed Jul 07, 2010 5:56 pm 
                        
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 8009
Location: Portland, OR  USA                You're actually rounding to one 
decimal, so use 10 instead of 100.   
                             Top                applesource          Post 
subject: Re: Rounding Problem -- Anyone Have a Solution?Posted: Wed Jul 07, 
2010 5:58 pm                                 
Joined: Thu Aug 06, 2009 2:25 pm
Posts: 241
Location: Oregon                Brilliant, thank you Tim. I knew it was 
something simple. Of course reflecting upon it now is a serious DUH moment. Of 
course it's one decimal. Works a treat. Thanks again.      
_________________
AppleSource Software
http://www.applesource.biz  
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to