(magnitude (make-rectangular 1e200 1e200)) overflows. This is because it directly calculates something of the form (sqrt (+ (square x) (square y))). The right way to fix this is to include hypot in the math functions imported from the math libraries, and use it appropriately. It might even be worth exposing to Scheme as its own function.
(magnitude (make-rectangular 1e200 1e200))
overflows. This is because it directly calculates something of the form(sqrt (+ (square x) (square y)))
. The right way to fix this is to includehypot
in the math functions imported from the math libraries, and use it appropriately. It might even be worth exposing to Scheme as its own function.