home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,443 of 10,840   
   Rick Rothstein to All   
   Re: Very strange thing in VB6   
   27 Apr 05 22:51:45   
   
   From: rickNOSPAMnews@NOSPAMcomcast.net   
      
   > > I suggest you write your own rounding routine.   
   >   
   > Not necessary... see below.   
      
   Whoops! I forgot to cover this in my last posting. The Format function   
   avoids all of the problems shown...   
      
   > For example, if you do   
   >   
   > ? round (68.505,2)   
   >   
   > you get 68.5, which is incorrect; for if you round 68.505   
   > to two decimal points you should get 68.51.   
      
   ? Format(68.505, "0.00")   ==>   68.51   
      
   > A more serious error can be seen here:   
   >   
   > ? int(68.505 * 1000 + 5)   
   > 68509 !!! (should have been 68510)   
      
   ? Format(68.505 * 1000 + 5, "0")   ==>   68510   
      
   Rick - MVP   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca