From 7b81dc8b10dae66acf3209ad7cf5371932897595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= <daniel@turtleware.eu> Date: Thu, 22 Dec 2016 23:03:18 +0100 Subject: [PATCH] numbers: atan: remove extra map nesting previously we had two map, which were appended, now we have one lambda function, so there is no need for it. --- numbers/atan.lsp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/numbers/atan.lsp b/numbers/atan.lsp index 6c345c1f..8bce4ffb 100644 --- a/numbers/atan.lsp +++ b/numbers/atan.lsp @@ -134,17 +134,16 @@ ;; (atan +-0 +(anything-but-nan)) -> +-0 ;; (atan +-0 -(anything-but-nan)) -> +-pi ;; (atan +-(anything-but-0/nan) 0) -> +-pi/2 - (every #'identity - (map 'list (lambda (n) - ;; notice, that we don't test a case, where - ;; both arguments are 0.0, because if - ;; implementation doesn't support signed 0 - ;; result is undefined. - (and (zerop (atan 0.0 n)) - (+pi-p (atan 0.0 (- n))) - (+pi/2-p (atan n 0.0)) - (-pi/2-p (atan (- n) 0.0)))) - (remove-if-not #'plusp *floats*)))) + (every (lambda (n) + ;; notice, that we don't test a case, where + ;; both arguments are 0.0, because if + ;; implementation doesn't support signed 0 + ;; result is undefined. + (and (zerop (atan 0.0 n)) + (+pi-p (atan 0.0 (- n))) + (+pi/2-p (atan n 0.0)) + (-pi/2-p (atan (- n) 0.0)))) + (remove-if-not #'plusp *floats*))) T) (deftest atan.ieee.2 :description "Verify ATAN handling signed zero" @@ -162,13 +161,12 @@ (-zerop (atan -0.0 +0.0)) (+pi-p (atan +0.0 -0.0)) (-pi-p (atan -0.0 -0.0)) - (every #'identity - (map 'list (lambda (n) - (and (-zerop (atan -0.0 n)) - (+zerop (atan +0.0 n)) - (+pi-p (atan +0.0 (- n))) - (-pi-p (atan -0.0 (- n))))) - (remove-if-not #'plusp *floats*)))))) + (every (lambda (n) + (and (-zerop (atan -0.0 n)) + (+zerop (atan +0.0 n)) + (+pi-p (atan +0.0 (- n))) + (-pi-p (atan -0.0 (- n))))) + (remove-if-not #'plusp *floats*))))) T) ;;; We could have tested also for infinities and nan's, but there is -- GitLab