mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-18 21:29:18 +02:00
Cleanup
This commit is contained in:
parent
07e747a08f
commit
82b0f9f3e2
1 changed files with 14 additions and 15 deletions
|
@ -121,30 +121,29 @@
|
||||||
assign_complex_num((&cn), result);
|
assign_complex_num((&cn), result);
|
||||||
return_closcall1(data, k, &cn);
|
return_closcall1(data, k, &cn);
|
||||||
} "
|
} "
|
||||||
; "(void *data, object ptr, object z)"
|
|
||||||
; " return_inexact_double_or_cplx_op_no_cps(data, ptr, sqrt, csqrt, z);"
|
|
||||||
"(void *data, object ptr, object z)"
|
"(void *data, object ptr, object z)"
|
||||||
" double complex unboxed;
|
" double complex result;
|
||||||
Cyc_check_num(data, z);
|
Cyc_check_num(data, z);
|
||||||
if (obj_is_int(z)) {
|
if (obj_is_int(z)) {
|
||||||
unboxed = csqrt(obj_obj2int(z));
|
result = csqrt(obj_obj2int(z));
|
||||||
} else if (type_of(z) == integer_tag) {
|
} else if (type_of(z) == integer_tag) {
|
||||||
unboxed = csqrt(((integer_type *)z)->value);
|
result = csqrt(((integer_type *)z)->value);
|
||||||
} else if (type_of(z) == bignum_tag) {
|
} else if (type_of(z) == bignum_tag) {
|
||||||
unboxed = csqrt(mp_get_double(&bignum_value(z)));
|
result = csqrt(mp_get_double(&bignum_value(z)));
|
||||||
} else if (type_of(z) == complex_num_tag) {
|
} else if (type_of(z) == complex_num_tag) {
|
||||||
unboxed = csqrt(complex_num_value(z));
|
result = csqrt(complex_num_value(z));
|
||||||
assign_complex_num(ptr, unboxed);
|
|
||||||
return ptr;
|
|
||||||
} else {
|
} else {
|
||||||
unboxed = csqrt(((double_type *)z)->value);
|
result = csqrt(((double_type *)z)->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cimag(unboxed) == 0.0) {
|
if (cimag(result) == 0.0) {
|
||||||
assign_double(ptr, creal(unboxed));
|
if (obj_is_int(z) && creal(result) == round(creal(result))) {
|
||||||
|
return obj_int2obj(creal(result));
|
||||||
|
}
|
||||||
|
assign_double(ptr, creal(result));
|
||||||
} else {
|
} else {
|
||||||
assign_double(ptr, unboxed);
|
assign_complex_num(ptr, result);
|
||||||
}
|
}
|
||||||
return ptr; ")
|
return ptr;
|
||||||
|
")
|
||||||
))
|
))
|
||||||
|
|
Loading…
Add table
Reference in a new issue