I have a problem with the atan2 function.
I have 2 programs, one in C and one in Matlab. Both have an identical implementation.
My problem is that I am getting occasionally different values from the atan2 function in C and Matlab.
Matlab atan2= 2.8438364863237604
C atan2= 2.8438364863237608
So only the last digit is different (and not in all cases), but unfortunately, I would need the values to be identical.
Do you have any ideas it might be like this and how can I solve it?
Jump to Post
Matlab likely guarantees a higher precision than C, and what you're seeing is the round-off errors creeping into the C algorithm.
All 6 Replies
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.