Hi,

>VT_R4: 7.850 -> VarRound(1) -> 7.800
>VT_R4: 7.851 -> VarRound(1) -> 7.900
>Is this the binary representation (in)accuracy?

MS state that rounding is dependent on the internal binary
representation of the number and thus VarRound doesn't always get it
right, i.e. you can't tell with any certainty what the result will
be. You have 2 choices: try and match their exact algorithm (v. hard
w/o reverse engineering) or use the dutch rounding method (this makes
more sense IMO).

>How can I test if the rounding worked ok when the numbers may
> differ in the last (invisible) bits?

As long as Wine does the right thing don't worry about it.

> And how should I round a currency? It's valid on Windows but I
> couldn't interpret the results. 
> Is this some kind of fixed comma type?

The currency value is multiplied by 10000 and stored in an I8 (See
the VarCy* functions). So it has 4 dp of precision. To round to:

4 dp or more => no op.
0 dp => / 10000, then * 10000
1 dp => / 1000, then * 1000
2 dp => / 100, then * 100
3 dp => / 10, then * 10

mults and divs should be done on the I8 directly (no float).

Cheers,
Jon


=====
"Don't wait for the seas to part, or messiahs to come;
 Don't you sit around and waste this chance..." - Live

[EMAIL PROTECTED]

__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

Reply via email to