File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,26 @@ VALUE cbasic_mul(VALUE self, VALUE operand2)
7373
7474VALUE cbasic_div (VALUE self , VALUE operand2 )
7575{
76- return cbasic_binary_op (self , operand2 , basic_div );
76+ basic_struct * this , * cresult ;
77+ VALUE result ;
78+
79+ basic cbasic_operand2 ;
80+ basic_new_stack (cbasic_operand2 );
81+
82+ Data_Get_Struct (self , basic_struct , this );
83+ sympify (operand2 , cbasic_operand2 );
84+
85+ cresult = basic_new_heap ();
86+ int error_code = basic_div (cresult , this , cbasic_operand2 );
87+
88+ if (error_code == 0 ) {
89+ result = Data_Wrap_Struct (Klass_of_Basic (cresult ), NULL ,
90+ cbasic_free_heap , cresult );
91+ basic_free_stack (cbasic_operand2 );
92+ return result ;
93+ } else {
94+ rb_raise (rb_eRuntimeError , "Runtime Error" );
95+ }
7796}
7897
7998VALUE cbasic_pow (VALUE self , VALUE operand2 )
You can’t perform that action at this time.
0 commit comments