File indexing completed on 2024-12-22 04:10:15

0001 /*
0002  *  SPDX-FileCopyrightText: 2010 Cyrille Berger <cberger@cberger.net>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "kis_fast_math_test.h"
0008 
0009 #include <simpletest.h>
0010 #include "kis_fast_math.h"
0011 
0012 void KisFastMathTest::testAtan2()
0013 {
0014     const int COUNT = 1000;
0015 
0016     for (int i = 0 ; i < COUNT; ++i) {
0017         double x = i;
0018         for (int j = 0 ; j < COUNT; ++j) {
0019 
0020             double y = j;
0021 
0022             double v1 = atan2(y, x);
0023             double v2 = KisFastMath::atan2(y, x);
0024 
0025             QVERIFY(fabs(v1 - v2) < 0.0001);
0026         }
0027     }
0028 }
0029 
0030 
0031 SIMPLE_TEST_MAIN(KisFastMathTest)