1 Jul
2014
1 Jul
'14
7:41 a.m.
Thanks Nathan. I just read it in a book but dont remeber when necessary :(. And thanks for the operator precedence tip.
Cheers, Jabier.
El mar, 01-07-2014 a las 07:59 +1000, Nathan Hurst escribió:
On Mon, Jun 30, 2014 at 11:56:15PM +0200, Jabiertxo Arraiza Cenoz wrote:
Hi to all.
I try this in my debian calculator: "4 / 3 * (sqrt(2) - 1)" and return 0,55228475 in C++ return 0.414214
I want 0,55228475. Where i lost? I have the cmath header
4/3 = 1 because the type of both arguments is int. 4.0/3 fixes your problem. I would put (4./3) * sqrt() because operator precedence for divide is not always clear.
njh