@@ -914,6 +914,52 @@ protected AcoshNode create() {
914914 }
915915 }
916916
917+ @ Builtin (name = "asin" , fixedNumOfArguments = 1 , doc = "Return the arc sine (measured in radians) of x." )
918+ @ TypeSystemReference (PythonArithmeticTypes .class )
919+ @ ImportStatic (MathGuards .class )
920+ @ GenerateNodeFactory
921+ public abstract static class AsinNode extends PythonUnaryBuiltinNode {
922+
923+ public abstract double executeObject (Object value );
924+
925+ @ Specialization
926+ public double asinInt (long value ,
927+ @ Cached ("createBinaryProfile()" ) ConditionProfile doNotFit ) {
928+ return asinDouble (value , doNotFit );
929+ }
930+
931+ @ Specialization
932+ @ TruffleBoundary
933+ public double asinPInt (PInt value ,
934+ @ Cached ("createBinaryProfile()" ) ConditionProfile doNotFit ) {
935+ return asinDouble (value .intValue (), doNotFit );
936+ }
937+
938+ @ Specialization
939+ public double asinDouble (double value ,
940+ @ Cached ("createBinaryProfile()" ) ConditionProfile doNotFit ) {
941+ if (doNotFit .profile (value < -1 || value > 1 )) {
942+ throw raise (ValueError , "math domain error" );
943+ }
944+ return Math .asin (value );
945+ }
946+
947+ @ Specialization (guards = "!isNumber(value)" )
948+ public double acosh (Object value ,
949+ @ Cached ("create(__FLOAT__)" ) LookupAndCallUnaryNode dispatchFloat ,
950+ @ Cached ("create()" ) AsinNode asinNode ) {
951+ Object result = dispatchFloat .executeObject (value );
952+ if (result == PNone .NO_VALUE ) {
953+ throw raise (TypeError , "must be real number, not %p" , value );
954+ }
955+ return asinNode .executeObject (result );
956+ }
957+
958+ protected AsinNode create () {
959+ return MathModuleBuiltinsFactory .AsinNodeFactory .create (new PNode [0 ]);
960+ }
961+ }
962+
917963 @ Builtin (name = "cos" , fixedNumOfArguments = 1 )
918964 @ GenerateNodeFactory
919965 public abstract static class CosNode extends PythonBuiltinNode {
0 commit comments