New topic: 

double with 2 decimal

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

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        ccontreras          Post subject: double with 2 decimalPosted: 
Tue Dec 18, 2012 5:26 pm                         
Joined: Wed Nov 14, 2012 10:52 am
Posts: 7                hi!!
as I can do to get a double variable to 2 decimal places?   
                             Top                Stretch          Post subject: 
Re: double with 2 decimalPosted: Tue Dec 18, 2012 5:35 pm                       
Real Software Engineer          
Joined: Tue Jul 14, 2009 4:33 pm
Posts: 64
Location: Jacksonville, FL                If you need the result to be a 
number, you can do this:

dim d as double = 1.234567
dim n as double = round(d*100)/100

If you needed it to be a String, Use Format:

dim s as String = Format(d,"-0.00")      
_________________
Greg O'Lone
Software Engineer
Real Software  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 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