??!?
  I get exactly 27 on Calculator.App... :O
Even if I refactor as (72 * 2000) / 750, I still get 27 exactly. Which makes sense as - in base 10 - dividing by 2000 will produce a rational, non-repeating decimal (unless you start with an irrational number in the numerator - like pi, say, or sqrt(2) - or the numerator is itself a repeating decimal fraction like 1/3.)

On Jul 27, 2006, at 1:40 PM, Norman Palardy wrote:


On Jul 27, 2006, at 12:32 PM, [EMAIL PROTECTED] wrote:

  dim d as double
  dim i as integer

  d = 72.0 / 2000.0
  d = d * 750.0

  i = d

  MsgBox str(d)
  msgbox str(i)

Why does this code produce a 26 for the second message box instead of a 27? How can I make RB produce a 27 like every other language/calculator
that I tried?

OS X calculator gives 26.999999999

Since i is an integer and d is a double you effectively truncated the .999999 portion

So try rounding it when you assign it

        i = round(d)
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


William H Squires Jr
4400 Horizon Hill #4006
San Antonio, TX 78229
[EMAIL PROTECTED] <- remove the .nospam

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to