Comments (19)
I've not had a chance to test these recent changes but I can confirm that the
r49 code works just fine, so you're best bet on a quick solution is to revert
your copy of fix16.c to revision 49 and work with that until this can be solved.
Sorry for the inconvenience.
Original comment by [email protected]
on 3 May 2012 at 10:01
from libfixmath.
Original comment by [email protected]
on 3 May 2012 at 10:04
- Added labels: Priority-Critical
- Removed labels: Priority-Medium
from libfixmath.
Could not reproduce bug on x86 using the attached test.c. I'll try with
cortex-m3 later today.
Original comment by Petteri.Aimonen
on 3 May 2012 at 10:17
Attachments:
from libfixmath.
@SHAGGYNEMISIS
Can you provide the compiler options you are using, and also the exact compiler
version?
Original comment by Petteri.Aimonen
on 3 May 2012 at 10:22
from libfixmath.
Some other temporary replacement code you could use is this fast-newton-raphson
algorithm:
fix16_t rcp(fix16_t b)
{
bool n = (b < 0);
if (n) b = -b;
int s = 0;
for (; b > fix16_one; b >>= 1, s--);
for (; b < (fix16_one >> 1); b <<= 1, s++);
fix16_t x
= 185043 - fix16_mul(b, 123362);
unsigned i;
for (i = 0; i < 3; i++)
x = fix16_mul(x, (0x00020000 - fix16_mul(b, x)));
x <<= s;
return (n ? -x : x);
}
fix16_t fdiv(fix16_t a, fix16_t b)
{
return fix16_mul(a, rcp(b));
}
Original comment by [email protected]
on 3 May 2012 at 10:36
from libfixmath.
@Flatmush
Fails for 15.0 / 5.0 etc. I don't think such temporary hacks are necessary, I
can fix the bug as soon as I can reproduce it. It is most probably some
compiler-specific issue, because the unittests would catch it otherwise.
Original comment by Petteri.Aimonen
on 3 May 2012 at 10:45
from libfixmath.
gimme me few mins ill provide the makefile and the code
Original comment by [email protected]
on 3 May 2012 at 10:49
from libfixmath.
the fpArith.c contains the part of the code that i need for my working..
Original comment by [email protected]
on 3 May 2012 at 10:51
Attachments:
from libfixmath.
[deleted comment]
from libfixmath.
Nope this didn't give the desired result
Div (-2) 0xfffe0000, (-1)0xffff0000 = 0x80000000
Original comment by [email protected]
on 3 May 2012 at 11:01
from libfixmath.
Try the test.c I attached in comment 3. Your code is too messy and I can't get
it easily to compile.
I tried the test.c on Cortex-M3 simulator also, the division works just fine.
Original comment by Petteri.Aimonen
on 3 May 2012 at 12:05
from libfixmath.
Yes i did try the test.c file the result is the same.. i.e. incorrect answer.
I will post the cleaned up test file soon.. Sorry to keep you waiting
Original comment by [email protected]
on 4 May 2012 at 5:18
from libfixmath.
Ok, good to know that test.c gives incorrect answer. Can you still give the gcc
version, you can get it with "arm-none-eabi-gcc --version".
Original comment by Petteri.Aimonen
on 4 May 2012 at 5:32
from libfixmath.
arm-none-eabi-gcc (Sourcery G++ Lite 2010q1-188) 4.4.1
Copyright (C) 2009 Free Software Foundation, Inc.
Original comment by [email protected]
on 4 May 2012 at 5:35
from libfixmath.
Hmm, I cannot repeat the bug using that compiler version either. Could you post
also the .elf file from your test.c compilation?
Original comment by Petteri.Aimonen
on 4 May 2012 at 5:41
from libfixmath.
Might take a while will try asap.. :)
Original comment by [email protected]
on 4 May 2012 at 5:44
from libfixmath.
fyi this is compilation command ...
arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -mfpu=vfp -msoft-float
-mfloat-abi=soft -O0 -Wl,-Map=main.map,--cref,--gc-sect
ions -lc -lm -lgcc -lstdc++ -T..//Common/LPC17xx.ld
I will post the elf.. soon
Original comment by [email protected]
on 4 May 2012 at 5:47
from libfixmath.
If there's nothing new on this thread then I'm going to close it since the bug
can't be reproduced and is very likely a compiler/code issue.
Original comment by [email protected]
on 29 May 2012 at 3:14
from libfixmath.
Original comment by [email protected]
on 26 Jul 2012 at 4:00
- Changed state: Invalid
from libfixmath.
Related Issues (20)
- div defect HOT 2
- Rounding broken for negative numbers HOT 5
- C++ Fix16 cast operators should be const. HOT 1
- Optimize caching on trig functions
- Unittests fail on division, on x86_64 architecture. HOT 10
- 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.