1 /* EINA - EFL data type library
2 * Copyright (C) 2010 Cedric Bail
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
26 #include "eina_suite.h"
29 START_TEST(eina_fp_cos)
39 fail_if(!eina_init());
41 fl = eina_f32p32_scale(EINA_F32P32_PI, 4);
42 step = eina_f32p32_div(fl, eina_f32p32_int_from(2048));
44 for (fc = 0; fc < fl; fc += step)
46 fresult = eina_f32p32_cos(fc);
47 dc = eina_f32p32_double_to(fc);
50 delta = fabs(dresult - eina_f32p32_double_to(fresult));
51 fail_if(delta > 0.005);
58 START_TEST(eina_fp_sin)
68 fail_if(!eina_init());
70 fl = eina_f32p32_scale(EINA_F32P32_PI, 4);
71 step = eina_f32p32_div(fl, eina_f32p32_int_from(2048));
73 for (fc = 0; fc < fl; fc += step)
75 fresult = eina_f32p32_sin(fc);
76 dc = eina_f32p32_double_to(fc);
79 delta = fabs(dresult - eina_f32p32_double_to(fresult));
80 fail_if(delta > 0.005);
89 eina_test_fp(TCase *tc)
91 tcase_add_test(tc, eina_fp_cos);
92 tcase_add_test(tc, eina_fp_sin);