Closed GoogleCodeExporter closed 8 years ago
For now try reverting to the r52 division code which I believe is tested, this
is a critical issue and I'll look into it as soon as I get time.
Original comment by Flatmush@googlemail.com
on 31 Aug 2012 at 10:03
Also fails with gcc 4.6.3 on x86_64.
Original comment by louizat...@gmail.com
on 31 Aug 2012 at 10:04
Hum, I tried
svn update -r52
and the tests still fail at that revision.
FAILED: fix16_unittests.c:194 failures == 0
make: *** [run_fix16_unittests] Error 1
12:06 louiz@abricot /tmp/libfixmath-read-only/unittests % svn log
------------------------------------------------------------------------
r52 | Petteri.Aimonen@gmail.com | 2012-01-26 16:43:30 +0100 (Thu, 26 Jan 2012)
| 9 lines
Original comment by louizat...@gmail.com
on 31 Aug 2012 at 10:07
I've not really had much todo with the testing so I'm not sure how it judges
success, but you should know that division in fixed point (like integer
division) has limited accuracy since the result has dynamic range.
If you divide by a small/large or small/large number then you'll likely
under/overflow. I know the old division code worked because it's been used in a
number of my projects so it may be the case that the tests just expect a higher
accuracy than is possible but I'll have a dig and see what I can find.
For cases where guaranteed accuracy isn't important it may be better to use
saturated divides (e.g. graphics/games), otherwise you must handle the under or
overflow cases.
Original comment by Flatmush@googlemail.com
on 31 Aug 2012 at 10:12
This issue was closed by revision r83.
Original comment by Petteri.Aimonen
on 31 Aug 2012 at 10:16
This was a real bug in my code; I had not realized that the return value of GCC
builtin clzl (count leading zeros) depends on the sizeof(long). Revision 83
fixes this.
Original comment by Petteri.Aimonen
on 31 Aug 2012 at 10:17
I need to have deterministic results (always the same result for a given
operation, whatever the arch, compiler, etc) for my non-integer operations.
That means that I need the guaranteed accuracy. I’ll handle the overflow
cases then.
I discovered this issue when some operation like 5.1/1.2 failed. I’ll try my
own tests with the r52 division code and tell you if I have more success with
that.
(And thank you very much for your fast and useful answers!)
Original comment by louizat...@gmail.com
on 31 Aug 2012 at 10:21
You’re too fast for me, you fix the issue before I can even respond to your
previous message!
And you’re awesome, the tests successfully pass! Thank you again! :)
Original comment by louizat...@gmail.com
on 31 Aug 2012 at 10:23
Wow, nice one Petteri :)
You mind telling us what you're using libfixmath for louizatakk? You don't have
to of-course but it's always interesting to see what people are using the code
for.
Original comment by Flatmush@googlemail.com
on 31 Aug 2012 at 10:41
Oh, I didn’t pay attention, you’re two different persons. So thanks to both
of you :)
I’m using it in an online RTS game, where only “commands” are passed from
the server to the client (for example “unit X move there”) and then the
whole game simulation runs in parallel on all machines. That’s why, for that
part of the game, I cannot use floats (result could be different on each
machine, and the games would be desynchronized).
Original comment by louizat...@gmail.com
on 31 Aug 2012 at 11:28
Original issue reported on code.google.com by
louizat...@gmail.com
on 31 Aug 2012 at 9:56Attachments: