Ignore:
Timestamp:
Dec 23, 2011, 3:43:32 AM (9 years ago)
Author:
sam
Message:

core: fix the sign of a negative real number raised to an even power, and
add the corresponding unit test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/real.cpp

    r1115 r1116  
    327327        }
    328328    }
     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.0e-13);
     335
     336        double a2 = pow(-real::R_2, real::R_3);
     337        double b2 = -8.0;
     338        LOLUNIT_ASSERT_DOUBLES_EQUAL(a2, b2, 1.0e-13);
     339    }
    329340};
    330341
Note: See TracChangeset for help on using the changeset viewer.