/* * Copyright (C) 2020 Linux Studio Plugins Project * (C) 2020 Vladimir Sadovnikov * * This file is part of lsp-dsp-lib * Created on: 31 мар. 2020 г. * * lsp-dsp-lib is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * lsp-dsp-lib is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with lsp-dsp-lib. If not, see . */ #include #include #include #include namespace lsp { namespace generic { float ipowf(float x, int deg); float irootf(float x, int deg); } IF_ARCH_X86 ( namespace sse { float ipowf(float x, int deg); float irootf(float x, int deg); } ) typedef float (* ipowrootf_t)(float x, int deg); } UTEST_BEGIN("dsp.smath", ipowroot) void check_generic() { for (int i=-16; i <= 16; ++i) { float x1 = generic::ipowf(M_PI, i); float x2 = 1; for (size_t j=0, k=(i<0) ? -i: i; j