Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
justinethier committed Mar 15, 2024
1 parent 07e747a commit 82b0f9f
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions scheme/inexact.sld
Original file line number Diff line number Diff line change
Expand Up @@ -121,30 +121,29 @@
assign_complex_num((&cn), result);
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)"
" double complex unboxed;
" double complex result;
Cyc_check_num(data, z);
if (obj_is_int(z)) {
unboxed = csqrt(obj_obj2int(z));
result = csqrt(obj_obj2int(z));
} 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) {
unboxed = csqrt(mp_get_double(&bignum_value(z)));
result = csqrt(mp_get_double(&bignum_value(z)));
} else if (type_of(z) == complex_num_tag) {
unboxed = csqrt(complex_num_value(z));
assign_complex_num(ptr, unboxed);
return ptr;
result = csqrt(complex_num_value(z));
} else {
unboxed = csqrt(((double_type *)z)->value);
result = csqrt(((double_type *)z)->value);
}
if (cimag(unboxed) == 0.0) {
assign_double(ptr, creal(unboxed));
if (cimag(result) == 0.0) {
if (obj_is_int(z) && creal(result) == round(creal(result))) {
return obj_int2obj(creal(result));
}
assign_double(ptr, creal(result));
} else {
assign_double(ptr, unboxed);
assign_complex_num(ptr, result);
}
return ptr; ")

return ptr;
")
))

0 comments on commit 82b0f9f

Please sign in to comment.