[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    drem() (was: Re: [PATCH] KJS - fix toInt32 with some negativevalues
From:       Harri Porten <harri () froglogic ! com>
Date:       2003-07-24 11:55:09
[Download RAW message or body]

Hi,

Maks Orlovich wrote:
>
> Currently, KJS mis-calculates toInt32 values for some negative numbers. For
> example, -2478659068 is converted to 0x80000000, aka MIN_INT. This is because
> the remainder for dividing this by 2^32 is negative, so we don't readjust it
> (as it's certainly < 2^31) and below MIN_INT, so casting from floating point
> to integer in ValueImp::toInt32 clamps. The attached diff appears to be the
> proper fix to me. If this is OK,

Hmmm. You are right. Hadn't expected the result to become negative. How
about drem() ? I didn't knew about it before. It seems to does the job
nicely without the extra check. Is is portable ?

> is there anywhere where I can/should add a
> testcase for this?

I've added a test to khtmltests/js/operators.js

Harri.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic