Changeset 1116
 Timestamp:
 Dec 23, 2011, 3:43:32 AM (11 years ago)
 Location:
 trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/real.cpp
r1115 r1116 693 693 else /* x < 0 */ 694 694 { 695 /* Odd integer exponent */ 696 if (y == (round(y >> 1) << 1)) 697 return exp(y * log(x)); 698 699 /* Even integer exponent */ 695 700 if (y == round(y)) 696 701 return exp(y * log(x)); 702 697 703 /* FIXME: negative nth root */ 698 704 return real::R_0; 
trunk/test/unit/real.cpp
r1115 r1116 327 327 } 328 328 } 329 330 LOLUNIT_TEST(Pow) 331 { 332 double a1 = pow(real::R_2, real::R_2); 333 double b1 = 4.0; 334 LOLUNIT_ASSERT_DOUBLES_EQUAL(a1, b1, 1.0e13); 335 336 double a2 = pow(real::R_2, real::R_3); 337 double b2 = 8.0; 338 LOLUNIT_ASSERT_DOUBLES_EQUAL(a2, b2, 1.0e13); 339 } 329 340 }; 330 341
Note: See TracChangeset
for help on using the changeset viewer.