Commit ba154a60 authored by Daniel Kochmański's avatar Daniel Kochmański

complex-float: implement divide and times operations

parent 14156559
......@@ -168,6 +168,79 @@ ecl_divide(cl_object x, cl_object y)
return complex_divide(x->gencomplex.real, x->gencomplex.imag,
y->gencomplex.real, y->gencomplex.imag);
}
#ifdef ECL_COMPLEX_FLOAT
/* upgraded type csfloat */
CASE_CSFLOAT_FIXNUM;
CASE_CSFLOAT_BIGNUM;
CASE_CSFLOAT_RATIO;
CASE_CSFLOAT_SINGLE_FLOAT;
CASE_CSFLOAT_COMPLEX;
CASE_FIXNUM_CSFLOAT;
CASE_BIGNUM_CSFLOAT;
CASE_RATIO_CSFLOAT;
CASE_SINGLE_FLOAT_CSFLOAT;
CASE_COMPLEX_CSFLOAT;
CASE_CSFLOAT_CSFLOAT {
cl_object aux = ecl_alloc_object(t_csfloat);
ecl_csfloat(aux) = ecl_to_csfloat(x) / ecl_to_csfloat(y);
return aux;
}
/* upgraded type cdfloat */
CASE_CSFLOAT_DOUBLE_FLOAT;
CASE_DOUBLE_FLOAT_CSFLOAT;
CASE_CDFLOAT_FIXNUM;
CASE_CDFLOAT_BIGNUM;
CASE_CDFLOAT_RATIO;
CASE_CDFLOAT_SINGLE_FLOAT;
CASE_CDFLOAT_DOUBLE_FLOAT;
CASE_CDFLOAT_COMPLEX;
CASE_CDFLOAT_CSFLOAT;
CASE_FIXNUM_CDFLOAT;
CASE_BIGNUM_CDFLOAT;
CASE_RATIO_CDFLOAT;
CASE_SINGLE_FLOAT_CDFLOAT;
CASE_DOUBLE_FLOAT_CDFLOAT;
CASE_COMPLEX_CDFLOAT;
CASE_CSFLOAT_CDFLOAT;
CASE_CDFLOAT_CDFLOAT {
cl_object aux = ecl_alloc_object(t_cdfloat);
ecl_cdfloat(aux) = ecl_to_cdfloat(x) / ecl_to_cdfloat(y);
return aux;
}
/* upgraded type clfloat */
CASE_CSFLOAT_LONG_FLOAT;
CASE_LONG_FLOAT_CSFLOAT;
CASE_CDFLOAT_LONG_FLOAT;
CASE_LONG_FLOAT_CDFLOAT;
CASE_CLFLOAT_FIXNUM;
CASE_CLFLOAT_BIGNUM;
CASE_CLFLOAT_RATIO;
CASE_CLFLOAT_SINGLE_FLOAT;
CASE_CLFLOAT_DOUBLE_FLOAT;
CASE_CLFLOAT_LONG_FLOAT;
CASE_CLFLOAT_COMPLEX;
CASE_CLFLOAT_CSFLOAT;
CASE_CLFLOAT_CDFLOAT;
CASE_FIXNUM_CLFLOAT;
CASE_BIGNUM_CLFLOAT;
CASE_RATIO_CLFLOAT;
CASE_SINGLE_FLOAT_CLFLOAT;
CASE_DOUBLE_FLOAT_CLFLOAT;
CASE_LONG_FLOAT_CLFLOAT;
CASE_COMPLEX_CLFLOAT;
CASE_CSFLOAT_CLFLOAT;
CASE_CDFLOAT_CLFLOAT;
CASE_CLFLOAT_CLFLOAT {
cl_object aux = ecl_alloc_object(t_clfloat);
ecl_clfloat(aux) = ecl_to_clfloat(x) / ecl_to_clfloat(y);
return aux;
}
#endif
CASE_UNKNOWN(@[/],x,y,@[number]);
}
MATH_DISPATCH2_END;
......
......@@ -167,6 +167,80 @@ ecl_times(cl_object x, cl_object y)
cl_object z22 = ecl_times(x->gencomplex.real, y->gencomplex.imag);
return ecl_make_complex(ecl_minus(z11, z12), ecl_plus(z21, z22));
}
#ifdef ECL_COMPLEX_FLOAT
/* upgraded type csfloat */
CASE_CSFLOAT_FIXNUM;
CASE_CSFLOAT_BIGNUM;
CASE_CSFLOAT_RATIO;
CASE_CSFLOAT_SINGLE_FLOAT;
CASE_CSFLOAT_COMPLEX;
CASE_FIXNUM_CSFLOAT;
CASE_BIGNUM_CSFLOAT;
CASE_RATIO_CSFLOAT;
CASE_SINGLE_FLOAT_CSFLOAT;
CASE_COMPLEX_CSFLOAT;
CASE_CSFLOAT_CSFLOAT {
cl_object aux = ecl_alloc_object(t_csfloat);
ecl_csfloat(aux) = ecl_to_csfloat(x) * ecl_to_csfloat(y);
return aux;
}
/* upgraded type cdfloat */
CASE_CSFLOAT_DOUBLE_FLOAT;
CASE_DOUBLE_FLOAT_CSFLOAT;
CASE_CDFLOAT_FIXNUM;
CASE_CDFLOAT_BIGNUM;
CASE_CDFLOAT_RATIO;
CASE_CDFLOAT_SINGLE_FLOAT;
CASE_CDFLOAT_DOUBLE_FLOAT;
CASE_CDFLOAT_COMPLEX;
CASE_CDFLOAT_CSFLOAT;
CASE_FIXNUM_CDFLOAT;
CASE_BIGNUM_CDFLOAT;
CASE_RATIO_CDFLOAT;
CASE_SINGLE_FLOAT_CDFLOAT;
CASE_DOUBLE_FLOAT_CDFLOAT;
CASE_COMPLEX_CDFLOAT;
CASE_CSFLOAT_CDFLOAT;
CASE_CDFLOAT_CDFLOAT {
cl_object aux = ecl_alloc_object(t_cdfloat);
ecl_cdfloat(aux) = ecl_to_cdfloat(x) * ecl_to_cdfloat(y);
return aux;
}
/* upgraded type clfloat */
CASE_CSFLOAT_LONG_FLOAT;
CASE_LONG_FLOAT_CSFLOAT;
CASE_CDFLOAT_LONG_FLOAT;
CASE_LONG_FLOAT_CDFLOAT;
CASE_CLFLOAT_FIXNUM;
CASE_CLFLOAT_BIGNUM;
CASE_CLFLOAT_RATIO;
CASE_CLFLOAT_SINGLE_FLOAT;
CASE_CLFLOAT_DOUBLE_FLOAT;
CASE_CLFLOAT_LONG_FLOAT;
CASE_CLFLOAT_COMPLEX;
CASE_CLFLOAT_CSFLOAT;
CASE_CLFLOAT_CDFLOAT;
CASE_FIXNUM_CLFLOAT;
CASE_BIGNUM_CLFLOAT;
CASE_RATIO_CLFLOAT;
CASE_SINGLE_FLOAT_CLFLOAT;
CASE_DOUBLE_FLOAT_CLFLOAT;
CASE_LONG_FLOAT_CLFLOAT;
CASE_COMPLEX_CLFLOAT;
CASE_CSFLOAT_CLFLOAT;
CASE_CDFLOAT_CLFLOAT;
CASE_CLFLOAT_CLFLOAT
{
cl_object aux = ecl_alloc_object(t_clfloat);
ecl_clfloat(aux) = ecl_to_clfloat(x) * ecl_to_clfloat(y);
return aux;
}
#endif
CASE_UNKNOWN(@[*],x,y,@[number]);
}
MATH_DISPATCH2_END;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment