Close

SOME UPDATES

A project log for LIBCORDIC

OK this needs to be a separate thing here and well it may be on going for a bit. COORDINATE ROTATIONAL DIGITAL COMPUTER blame the 50's!

earl-tEARL T 09/25/2025 at 10:110 Comments

Ok so sin cos is working threw its entire range i tested it against math.h by writing executable that called CORDIC_fscx 4 times one for each quadrant same with math.h but sin /cos for each one neither one prints anything just calculates it running that with time so

time ./cordic
        ./cordic  0.00s user 0.00s system 35% cpu 0.008 total
time ./math
         ./math  0.00s user 0.00s system 82% cpu 0.003 total

 so there close and I've ran this test few times and my results have been all close some closer some I've even won  and I really haven't done any optimizing at all yet so. things like making CORDIC_Q part of the function should help also when i do that i could assign the . . ax ay varibles and the start for z all in one go in fact I think I could also use the cos_aprox and sin_aprox either directly or easier if i use pointer so that i don't have to assign them later . needless to say i have a game plan that I think should work also i changed the programs to print out the results and I cheated a bit i changed the input to fix point and i used the fix point result I'm going to make a makefile real quick and include this in my next commit 

et-hp% time ./math_bm
0.963558    0.267499 
0.973848    -0.227202 
-0.891207    0.453596 
-0.239249    -0.970958 
./math_bm  0.00s user 0.00s system 82% cpu 0.003 total
et-hp% time ./cordic_bm
1019096    282915 
1030025    -240089 
-1041933    181513 
-253250    -1026868 
./cordic_bm  0.00s user 0.00s system 81% cpu 0.003 total

as far as everything else goes. asin works acos works up to like ,4 and then the negative which use asin work. log exp work in a range that ends round 8 sq and sqrt i got those working to like  4 and 7  I'm using logarithmic math to get to these so  

this works but as said the limits of exp and log are also reflected here and for reasons I haven't really discovered yet they don't work at all below 1 witch kinda screws up the goal of haversine and other spherical geometry formulas. Good news math.h is no longer a dependency so there's   that and I'm going to link this project in the new README.md I'm working on now HERE THE LINK TO THE GITHUB PAGE AGAIN . \s hows that for seo work lol \s. TODO  besides what I've sad atan atan2 mod which i have no idea how I'm going to go about that but once i figure it out it will work for the trig formulas in question unlike c's fmod or mod functions . By the way if i need them  I will later 

some of these are needed once you begin to look at celestial navigation and maybe some other things I'm going to try later but that's how you can calculate all 6 trig ratios from sin and cos if ya happen to need that for homework your welcome .    

Discussions