Summary

improve handling of mixed complex arithmetic

Metadata

Attachments

Description

Peter McGoron reported that the handling of mixed complex with flonum arithmetic gives unsatisfying results like nan's in places where other Scheme implementations return more meaningful results.

Currently we just convert all arguments to complex and perform the "FOIL" formula, but by utilizing certain cases with mixed args, the results can be improved upon. Specifically, WG14/N1256 of the ISO C standard suggests some rules, screenshots of the relevant rules are attached.

Changes and comments

[2026-07-14 20:45:10 UTC] felix attached p1.png

[2026-07-14 20:45:10 UTC] felix attached p2.png

[2026-07-15 08:17:53 UTC] felix wrote:

Some information: the necessary code change are likely to be made in C_s_a_i_times, where the dispatch for arg types takes place.

Here an example from Peter McGoron where the FOIL algorithm is insufficient:

(* 1.0 +inf.0+1.0i) => +inf.0+nan.0i