diff options
author | Otto Moerbeek <otto@openbsd.org> | 2007-08-23 21:59:25 +0200 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-08-31 09:59:53 -0700 |
commit | a964d541283e93b1096150275ba2d95594bf77ea (patch) | |
tree | 9a2fd42891efb1d9f29a193cc28007c1de60e12d /dix | |
parent | bcd6708895e5c2fda423bb13fe42b078ef293b13 (diff) |
A high resolution device that's moving fast can potentially generate
an int overflow, making dx*dx+dy*dy negative. Now pow(negative,
non-integer) yields NaN, so you loose. Use fp math to avoid that.
(cherry picked from commit 12d27cf33c6d963eae77795c0d247175907162a5)
Diffstat (limited to 'dix')
-rw-r--r-- | dix/getevents.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index 2a10038bc..52b74bd30 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -250,7 +250,7 @@ acceleratePointer(DeviceIntPtr pDev, int first_valuator, int num_valuators, } } else { - mult = pow((float)(dx * dx + dy * dy), + mult = pow((float)((float)dx * (float)dx + (float)dy * (float)dy), ((float)(pDev->ptrfeed->ctrl.num) / (float)(pDev->ptrfeed->ctrl.den) - 1.0) / 2.0) / 2.0; |