Re: Wrong cos() result
That "float", "double" and "long double" is a half thought after solution (from the stone age, dating back to K&R)
It is like that crappy "unsigned char" and "long long int". These types are compiler specific and utterly useless. Use "uint8_t" etc. to -once and forever- express exactly what you mean.
Now, by standard, it is defined what precision "float", "double" "long double" should have (6, 15 and 19 digits). BUT only if the implementers do follow the standard IEC 60995. And if -and only if- they follow that standard, there must be a #define __STD_IEC_599__.
MCHP doesn't define that, so the different sizes of floats are not what they pretend to be. They are only 6, 6 and 15 digits. So to be precise, a "long double" does not exist. Look at <float.h>