Comments (10)
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 [email protected]
on 31 Aug 2012 at 10:03
- Added labels: Priority-Critical
- Removed labels: Priority-Medium
from libfixmath.
Also fails with gcc 4.6.3 on x86_64.
Original comment by [email protected]
on 31 Aug 2012 at 10:04
from libfixmath.
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 | [email protected] | 2012-01-26 16:43:30 +0100 (Thu, 26 Jan 2012)
| 9 lines
Original comment by [email protected]
on 31 Aug 2012 at 10:07
from libfixmath.
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 [email protected]
on 31 Aug 2012 at 10:12
from libfixmath.
This issue was closed by revision r83.
Original comment by Petteri.Aimonen
on 31 Aug 2012 at 10:16
- Changed state: Fixed
from libfixmath.
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
from libfixmath.
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 [email protected]
on 31 Aug 2012 at 10:21
from libfixmath.
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 [email protected]
on 31 Aug 2012 at 10:23
from libfixmath.
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 [email protected]
on 31 Aug 2012 at 10:41
from libfixmath.
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 [email protected]
on 31 Aug 2012 at 11:28
from libfixmath.
Related Issues (20)
- div defect HOT 2
- Rounding broken for negative numbers HOT 5
- Problem with sdiv.. HOT 19
- C++ Fix16 cast operators should be const. HOT 1
- Optimize caching on trig functions
- Incorrect conversions from int to float and more HOT 4
- compiler error after setting #define FIXMATH_NO_OVERFLOW HOT 2
- left shift count >= width of type HOT 1
- >= 0 comparison might be more efficient than > 0 comparison HOT 1
- atan2 incorrect HOT 5
- fix16_str_unittests fails (MSYS/windows) HOT 1
- FIXMATH_FAST_SIN gives rounding error HOT 1
- libfixmath for cortex m0 HOT 2
- fix16_div bug due to __builtin_clzl HOT 4
- Probably error in log2 functions test for skipping decimal part
- Unary minus on unsigned type HOT 1
- 32-bit multiplication seems to be way off for some values HOT 3
- Fix16(const fix16_t inValue) should be removed
- lerp overflows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libfixmath.