I had an assignment that dealt with calculating pi by a few different iterative methods and comparing it with the value calculated by pi = acos(static_cast<long double>(-1.0))
(storing as a long double). For some reason, NetBeans gives me -8.8796093704934495e+043
. From my limited knowledge, it seems like there is a signed/unsigned disagreement somewhere. I've set the compiler to use the C++11 standards. What am I missing?
Asked
Active
Viewed 90 times
0

spartanhooah
- 183
- 4
- 15
-
`acos()` accepts `double` as its parameter. Why do you cast the _parameter_ into `long double`? – timrau Oct 01 '13 at 00:19
-
1Can you show us a short complete example? Not failing in Visual Studio or here: http://ideone.com/UKbUm8 – Retired Ninja Oct 01 '13 at 00:25
-
Here's the complete code: http://pastebin.com/RTdaGxF6 @timrau, I'm casting it into `long double` because that's how the instructor did it. Yes, it works fine in Visual Studio, which is what I tend to use because it's less problematic. – spartanhooah Oct 01 '13 at 10:22