Giter Club home page Giter Club logo

Comments (19)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024

Original comment by [email protected] on 3 May 2012 at 10:04

  • Added labels: Priority-Critical
  • Removed labels: Priority-Medium

from libfixmath.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
@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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
@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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
[deleted comment]

from libfixmath.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
Might take a while will try asap.. :)

Original comment by [email protected] on 4 May 2012 at 5:44

from libfixmath.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024

Original comment by [email protected] on 26 Jul 2012 at 4:00

  • Changed state: Invalid

from libfixmath.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.