131914882SAlex Richardson /* 231914882SAlex Richardson * Data definition for sinf, cosf and sincosf. 331914882SAlex Richardson * 431914882SAlex Richardson * Copyright (c) 2018-2019, Arm Limited. 5*072a4ba8SAndrew Turner * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception 631914882SAlex Richardson */ 731914882SAlex Richardson 831914882SAlex Richardson #include <stdint.h> 931914882SAlex Richardson #include <math.h> 1031914882SAlex Richardson #include "math_config.h" 1131914882SAlex Richardson #include "sincosf.h" 1231914882SAlex Richardson 1331914882SAlex Richardson /* The constants and polynomials for sine and cosine. The 2nd entry 1431914882SAlex Richardson computes -cos (x) rather than cos (x) to get negation for free. */ 1531914882SAlex Richardson const sincos_t __sincosf_table[2] = 1631914882SAlex Richardson { 1731914882SAlex Richardson { 1831914882SAlex Richardson { 1.0, -1.0, -1.0, 1.0 }, 1931914882SAlex Richardson #if TOINT_INTRINSICS 2031914882SAlex Richardson 0x1.45F306DC9C883p-1, 2131914882SAlex Richardson #else 2231914882SAlex Richardson 0x1.45F306DC9C883p+23, 2331914882SAlex Richardson #endif 2431914882SAlex Richardson 0x1.921FB54442D18p0, 2531914882SAlex Richardson 0x1p0, 2631914882SAlex Richardson -0x1.ffffffd0c621cp-2, 2731914882SAlex Richardson 0x1.55553e1068f19p-5, 2831914882SAlex Richardson -0x1.6c087e89a359dp-10, 2931914882SAlex Richardson 0x1.99343027bf8c3p-16, 3031914882SAlex Richardson -0x1.555545995a603p-3, 3131914882SAlex Richardson 0x1.1107605230bc4p-7, 3231914882SAlex Richardson -0x1.994eb3774cf24p-13 3331914882SAlex Richardson }, 3431914882SAlex Richardson { 3531914882SAlex Richardson { 1.0, -1.0, -1.0, 1.0 }, 3631914882SAlex Richardson #if TOINT_INTRINSICS 3731914882SAlex Richardson 0x1.45F306DC9C883p-1, 3831914882SAlex Richardson #else 3931914882SAlex Richardson 0x1.45F306DC9C883p+23, 4031914882SAlex Richardson #endif 4131914882SAlex Richardson 0x1.921FB54442D18p0, 4231914882SAlex Richardson -0x1p0, 4331914882SAlex Richardson 0x1.ffffffd0c621cp-2, 4431914882SAlex Richardson -0x1.55553e1068f19p-5, 4531914882SAlex Richardson 0x1.6c087e89a359dp-10, 4631914882SAlex Richardson -0x1.99343027bf8c3p-16, 4731914882SAlex Richardson -0x1.555545995a603p-3, 4831914882SAlex Richardson 0x1.1107605230bc4p-7, 4931914882SAlex Richardson -0x1.994eb3774cf24p-13 5031914882SAlex Richardson } 5131914882SAlex Richardson }; 5231914882SAlex Richardson 5331914882SAlex Richardson /* Table with 4/PI to 192 bit precision. To avoid unaligned accesses 5431914882SAlex Richardson only 8 new bits are added per entry, making the table 4 times larger. */ 5531914882SAlex Richardson const uint32_t __inv_pio4[24] = 5631914882SAlex Richardson { 5731914882SAlex Richardson 0xa2, 0xa2f9, 0xa2f983, 0xa2f9836e, 5831914882SAlex Richardson 0xf9836e4e, 0x836e4e44, 0x6e4e4415, 0x4e441529, 5931914882SAlex Richardson 0x441529fc, 0x1529fc27, 0x29fc2757, 0xfc2757d1, 6031914882SAlex Richardson 0x2757d1f5, 0x57d1f534, 0xd1f534dd, 0xf534ddc0, 6131914882SAlex Richardson 0x34ddc0db, 0xddc0db62, 0xc0db6295, 0xdb629599, 6231914882SAlex Richardson 0x6295993c, 0x95993c43, 0x993c4390, 0x3c439041 6331914882SAlex Richardson }; 64