MCPcopy Create free account
hub / github.com/Gecode/gecode / tan

Function tan

gecode/third-party/boost/numeric/interval/transc.hpp:93–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93template<class T, class Policies> inline
94interval<T, Policies> tan(const interval<T, Policies>& x)
95{
96 typedef interval<T, Policies> I;
97 if (interval_lib::detail::test_input(x))
98 return I::empty();
99 typename Policies::rounding rnd;
100 typedef typename interval_lib::unprotect<I>::type R;
101
102 // get lower bound within [-pi/2, pi/2]
103 const R pi = interval_lib::pi<R>();
104 R tmp = fmod((const R&)x, pi);
105 const T pi_half_d = interval_lib::constants::pi_half_lower<T>();
106 if (tmp.lower() >= pi_half_d)
107 tmp -= pi;
108 if (tmp.lower() <= -pi_half_d || tmp.upper() >= pi_half_d)
109 return I::whole();
110 return I(rnd.tan_down(tmp.lower()), rnd.tan_up(tmp.upper()), true);
111}
112
113template<class T, class Policies> inline
114interval<T, Policies> asin(const interval<T, Policies>& x)

Callers

nothing calls this directly

Calls 5

test_inputFunction · 0.85
emptyFunction · 0.70
fmodFunction · 0.70
lowerMethod · 0.45
upperMethod · 0.45

Tested by

no test coverage detected