]> gitweb.factorcode.org Git - factor.git/commitdiff
fixed a stupid implementation of nth-root
authorDoug Coleman <erg@trifocus.net>
Sat, 28 Jan 2006 18:41:45 +0000 (18:41 +0000)
committerDoug Coleman <erg@trifocus.net>
Sat, 28 Jan 2006 18:41:45 +0000 (18:41 +0000)
contrib/math/analysis.factor

index 064f3f4088bf2e09ca1ae6ed8a54eb7f816a0355..75cc732565839c0e3bf0547e82112dd5154068b7 100644 (file)
@@ -56,7 +56,7 @@ IN: math-contrib
     ] if ;
 
 : nth-root ( n x -- )
-    log >r recip r> * e swap ^ ;
+    over 0 = [ "0th root is undefined" throw ] when >r recip r> swap ^ ;
 
 ! Forth Scientific Library Algorithm #1
 !