1/*===-------------------------------------------------------------------------- 2 * ROCm Device Libraries 3 * 4 * This file is distributed under the University of Illinois Open Source 5 * License. See LICENSE.TXT for details. 6 *===------------------------------------------------------------------------*/ 7 8#include "mathF.h" 9#include "trigredF.h" 10 11float 12MATH_MANGLE(sin)(float x) 13{ 14 int ix = AS_INT(x); 15 int ax = ix & 0x7fffffff; 16 17 struct redret r = MATH_PRIVATE(trigred)(AS_FLOAT(ax)); 18 19#if defined EXTRA_PRECISION 20 struct scret sc = MATH_PRIVATE(sincosred2)(r.hi, r.lo); 21#else 22 struct scret sc = MATH_PRIVATE(sincosred)(r.hi); 23#endif 24 25 float s = (r.i & 1) != 0 ? sc.c : sc.s; 26 s = AS_FLOAT(AS_INT(s) ^ (r.i > 1 ? 0x80000000 : 0) ^ (ix ^ ax)); 27 28 if (!FINITE_ONLY_OPT()) { 29 s = ax >= PINFBITPATT_SP32 ? AS_FLOAT(QNANBITPATT_SP32) : s; 30 } 31 32 return s; 33} 34 35