MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / ASin

Function ASin

extern/ttmath/ttmath.h:849–894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

847 */
848 template<class ValueType>
849 ValueType ASin(ValueType x, ErrorCode * err = 0)
850 {
851 using namespace auxiliaryfunctions;
852
853 ValueType result, one;
854 one.SetOne();
855 bool change_sign = false;
856
857 if( x.IsNan() )
858 {
859 if( err )
860 *err = err_improper_argument;
861
862 return x;
863 }
864
865 if( x.GreaterWithoutSignThan(one) )
866 {
867 if( err )
868 *err = err_improper_argument;
869
870 return result; // NaN is set by default
871 }
872
873 if( x.IsSign() )
874 {
875 change_sign = true;
876 x.Abs();
877 }
878
879 one.exponent.SubOne(); // =0.5
880
881 // asin(-x) = -asin(x)
882 if( x.GreaterWithoutSignThan(one) )
883 result = ASin_1(x);
884 else
885 result = ASin_0(x);
886
887 if( change_sign )
888 result.ChangeSign();
889
890 if( err )
891 *err = err_ok;
892
893 return result;
894 }
895
896
897 /*!

Callers 1

ACosFunction · 0.85

Calls 7

ASin_1Function · 0.85
ASin_0Function · 0.85
SetOneMethod · 0.80
IsSignMethod · 0.80
AbsMethod · 0.80
ChangeSignMethod · 0.80
SubOneMethod · 0.45

Tested by

no test coverage detected