From 25774ccd709159bc6a4a64a9fbee33492df41389 Mon Sep 17 00:00:00 2001 From: henz Date: Mon, 1 Jul 2024 20:23:52 +0800 Subject: [PATCH] fixes #1006 --- xml/chapter2/section4/subsection2.xml | 4 ++-- xml/chapter2/section4/subsection3.xml | 12 ++++++------ xml/chapter2/section5/subsection2.xml | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/xml/chapter2/section4/subsection2.xml b/xml/chapter2/section4/subsection2.xml index 8467084e1..86c6a7bd5 100644 --- a/xml/chapter2/section4/subsection2.xml +++ b/xml/chapter2/section4/subsection2.xml @@ -230,7 +230,7 @@ function magnitude_rectangular(z) { square(imag_part_rectangular(z))); } function angle_rectangular(z) { - return math_atan(imag_part_rectangular(z), + return math_atan2(imag_part_rectangular(z), real_part_rectangular(z)); } function make_from_real_imag_rectangular(x, y) { @@ -297,7 +297,7 @@ function angle_polar(z) { return tail(z); } function make_from_real_imag_polar(x, y) { return attach_tag("polar", pair(math_sqrt(square(x) + square(y)), - math_atan(y, x))); + math_atan2(y, x))); } function make_from_mag_ang_polar(r, a) { diff --git a/xml/chapter2/section4/subsection3.xml b/xml/chapter2/section4/subsection3.xml index daa18ad52..f5c3003e4 100644 --- a/xml/chapter2/section4/subsection3.xml +++ b/xml/chapter2/section4/subsection3.xml @@ -362,7 +362,7 @@ function install_rectangular_package() { return math_sqrt(square(real_part(z)) + square(imag_part(z))); } function angle(z) { - return math_atan(imag_part(z), real_part(z)); + return math_atan2(imag_part(z), real_part(z)); } function make_from_mag_ang(r, a) { return pair(r * math_cos(a), r * math_sin(a)); @@ -508,7 +508,7 @@ function install_polar_package() { } function make_from_real_imag(x, y) { return pair(math_sqrt(square(x) + square(y)), - math_atan(y, x)); + math_atan2(y, x)); } // interface to the rest of the system @@ -1551,7 +1551,7 @@ function make_from_real_imag(x, y) { : op === "magnitude" ? math_sqrt(square(x) + square(y)) : op === "angle" - ? math_atan(y, x) + ? math_atan2(y, x) : error(op, "unknown op -- make_from_real_imag"); } return dispatch; @@ -1567,7 +1567,7 @@ function make_from_real_imag(x, y) { : op === "magnitude" ? math_sqrt(square(x) + square(y)) : op === "angle" - ? math_atan(y, x) + ? math_atan2(y, x) : error(op, "unknown op -- make_from_real_imag"); } return dispatch; @@ -1696,7 +1696,7 @@ function install_rectangular_package() { square(imag_part(z))); } function angle(z) { - return math_atan(imag_part(z), real_part(z)); + return math_atan2(imag_part(z), real_part(z)); } function make_from_mag_ang(r, a) { return pair(r * math_cos(a), r * math_sin(a)); @@ -1730,7 +1730,7 @@ function install_polar_package() { } function make_from_real_imag(x, y) { return pair(math_sqrt(square(x) + square(y)), - math_atan(y, x)); + math_atan2(y, x)); } // interface to the rest of the system diff --git a/xml/chapter2/section5/subsection2.xml b/xml/chapter2/section5/subsection2.xml index 400f28c10..f0dffa50e 100644 --- a/xml/chapter2/section5/subsection2.xml +++ b/xml/chapter2/section5/subsection2.xml @@ -481,7 +481,7 @@ function install_rectangular_package() { square(imag_part(z))); } function angle(z) { - return math_atan(imag_part(z), real_part(z)); + return math_atan2(imag_part(z), real_part(z)); } function make_from_mag_ang(r, a) { return pair(r * math_cos(a), r * math_sin(a)); @@ -515,7 +515,7 @@ function install_polar_package() { } function make_from_real_imag(x, y) { return pair(math_sqrt(square(x) + square(y)), - math_atan(y, x)); + math_atan2(y, x)); } // interface to the rest of the system