Hi Zhan,
It's better, thanks, but still needs more work.
On 04/25/13 23:37, Zhan Jianyu wrote:
> }
>
> +
> +
While we're at this, please put more attention into whitespace changes,
esp. useless ones.
> static HRESULT to_double(VARIANT *v, double *ret)
> {
> switch(V_VT(v)) {
> @@ -217,6 +221,27 @@ static HRESULT to_string(VARIANT *v, BSTR *ret)
> return S_OK;
> }
>
> +
> +static HRESULT banker_rounding(double dbval, int *result_val)
> +{
> + double frac_part;
> + double int_part;
> +
> + *result_val = round(dbval);
This has two problems:
- you don't handle values that are out of int range by assigning double
value to int
- round is not portable. As I mentioned you before, Wine needs to be C89
compatible. If we need some features that are not part of C89, we need
to be careful about that and it often requires things like configure
checks. In case of round, replacing it with floor(x+0.5) does the trick
pretty well.
Cheers,
Jacek