+ 1
we know that tan(π/2)= infinity. but this code in description prints it's value, 16331239480885248.000000. Why?
#include <stdio.h> #include <math.h> int main(){ float x = tan(M_PI/2); printf("%f", x); return 0; } output: 16331239480885248.000000
4 ответов
+ 2
I think that's because the program is only using π's approximation.
tan(1.5707963267948966) is not infinity, because it's not tan(π/2).
+ 3
Jayakrishna🇮🇳 I think you mean *Radians* instead of radius
+ 2
M_PI value you get 3.14 (may it in radians, if not then also not equal to 90° degrees) .
+ 1
Yes. Arsenic ...
Edited