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,457 of 10,840    |
|    DoppelHerz to Allcomp    |
|    Re: Very strange thing in VB6    |
|    01 May 05 09:58:09    |
      From: doppelherz@telia.com              Hi,              The fucntion you use (Int) does exactly what it is supposed to do. The       VB helpfile sais:              Int, Fix Functions       Returns the integer portion of a number.       Syntax       Int(number)              Int performs the "return integer" stuff on all bits and bobs of the       calculation not just the result, so int reads your calculation as       (5 * 1)              The way around it is to pass values, not calculations to the Int       function. You should have written              lngResult = (5 * 1.2)       Int(lngResult)              Regards DP                            Allcomp wrote:       > Hello,       >       > I have seen something really strange in VB6       >       > If I do a Int ( (5 * 1.2)) , I receive the value 5, but I should receive 6?       > Is this a bug or something really "normal".       > I can see that if I do       > ? int ((5 * 1.2 + 0.0000000000000003))       > I receive 6. If I add something smaller, I have 5 as a result       > What is strange is that If I do a ? 5*1.2, I receive 6 so (5 * 1.2)       > should do 6       > If I do Int ( (5 * 12 / 10)), the result is OK (6)       > What can I do to have it correct?       > Is there an option in VB6?       >       > Thank you       > Marc Allard       > Allcomp              --- 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