inline void sincos()

in include/half.hpp [3465:3520]


	inline void sincos(half arg, half *sin, half *cos)
	{
	#ifdef HALF_ARITHMETIC_TYPE
		detail::internal_t f = detail::half2float<detail::internal_t>(arg.data_);
		*sin = half(detail::binary, detail::float2half<half::round_style>(std::sin(f)));
		*cos = half(detail::binary, detail::float2half<half::round_style>(std::cos(f)));
	#else
		int abs = arg.data_ & 0x7FFF, sign = arg.data_ >> 15, k;
		if(abs >= 0x7C00)
			*sin = *cos = half(detail::binary, (abs==0x7C00) ? detail::invalid() : detail::signal(arg.data_));
		else if(!abs)
		{
			*sin = arg;
			*cos = half(detail::binary, 0x3C00);
		}
		else if(abs < 0x2500)
		{
			*sin = half(detail::binary, detail::rounded<half::round_style,true>(arg.data_-1, 1, 1));
			*cos = half(detail::binary, detail::rounded<half::round_style,true>(0x3BFF, 1, 1));
		}
		else
		{
			if(half::round_style != std::round_to_nearest)
			{
				switch(abs)
				{
				case 0x48B7:
					*sin = half(detail::binary, detail::rounded<half::round_style,true>((~arg.data_&0x8000)|0x1D07, 1, 1));
					*cos = half(detail::binary, detail::rounded<half::round_style,true>(0xBBFF, 1, 1));
					return;
				case 0x598C:
					*sin = half(detail::binary, detail::rounded<half::round_style,true>((arg.data_&0x8000)|0x3BFF, 1, 1));
					*cos = half(detail::binary, detail::rounded<half::round_style,true>(0x80FC, 1, 1));
					return;
				case 0x6A64:
					*sin = half(detail::binary, detail::rounded<half::round_style,true>((~arg.data_&0x8000)|0x3BFE, 1, 1));
					*cos = half(detail::binary, detail::rounded<half::round_style,true>(0x27FF, 1, 1));
					return;
				case 0x6D8C:
					*sin = half(detail::binary, detail::rounded<half::round_style,true>((arg.data_&0x8000)|0x0FE6, 1, 1));
					*cos = half(detail::binary, detail::rounded<half::round_style,true>(0x3BFF, 1, 1));
					return;
				}
			}
			std::pair<detail::uint32,detail::uint32> sc = detail::sincos(detail::angle_arg(abs, k), 28);
			switch(k & 3)
			{
				case 1: sc = std::make_pair(sc.second, -sc.first); break;
				case 2: sc = std::make_pair(-sc.first, -sc.second); break;
				case 3: sc = std::make_pair(-sc.second, sc.first); break;
			}
			*sin = half(detail::binary, detail::fixed2half<half::round_style,30,true,true,true>((sc.first^-static_cast<detail::uint32>(sign))+sign));
			*cos = half(detail::binary, detail::fixed2half<half::round_style,30,true,true,true>(sc.second));
		}
	#endif
	}