From 71d37429ba5b10ebe6999f06726ff768f60965f0 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 28 Mar 2013 18:02:55 -0700 Subject: [PATCH] math.functions: faster >rect by specializing for complex. --- basis/math/functions/functions.factor | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/basis/math/functions/functions.factor b/basis/math/functions/functions.factor index 72812764b2..b540d2b242 100644 --- a/basis/math/functions/functions.factor +++ b/basis/math/functions/functions.factor @@ -61,8 +61,11 @@ M: complex ^n (^n) ; PRIVATE> -: >rect ( z -- x y ) - [ real-part ] [ imaginary-part ] bi ; inline +GENERIC: >rect ( z -- x y ) + +M: real >rect 0 ; inline + +M: complex >rect [ real-part ] [ imaginary-part ] bi ; inline : >float-rect ( z -- x y ) >rect [ >float ] bi@ ; inline