
30 Jun
2014
30 Jun
'14
9:59 p.m.
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