reciprocal in cmath

Dec 27, 2010 at 2:46am
what is the reciprocal in the cmath library.

isn't (1.0/(tan (59.0))* 1.0/7.0)
the same as 1 / (RECIPROCAL(tan 59)) * 1 / 7

however I get different answers when I use the calculator and then write the program. please can someone tell me why c++ is not following my calculator
Dec 27, 2010 at 4:39am
Doesn't look the same to me. In the second part, you have added RECIPROCAL() around the tangent, which would make the result different from the previous code which doesn't have that.
Dec 27, 2010 at 5:02am
tan(59.0)/7.0 //try this
The reciprocal of x is 1/x.
therefore
1/reciprocal(tan(59)) *1/7
= 1/(1/tan(59))/7
= 1*(tan(59)/1)/7
= tan(59)/7
Use your middle-school algebra skills before writing code.
Dec 27, 2010 at 1:08pm
closed account (D80DSL3A)
Another possibility... 59.0 looks like an angle in degrees. The cmath function uses radians. Are you using angle in degrees on your calculator?
Topic archived. No new replies allowed.