Re: [pure-lang-users] math.pure
Status: Beta
Brought to you by:
agraef
From: Eddie R. <er...@bm...> - 2008-08-22 23:54:48
|
On Fri 22/08/08 5:34 PM , John Cowan co...@cc... sent: > Eddie Rucker scripsit: > > > The user must determine the domain they are > going work in. No different> than working with OCaml. > > A running joke was an acceptance test for nascent Common Lisp > implementations developed by Guy Steele. It was in three > parts. First you type T; if it responds T, it passes part > 1. Second, you define the factorial function and then calculate > (/ (factorial 1000) (factorial 999)). If it responds 1000, > it passes part 2. Third, you try (atanh -2). If it returns > a complex number, it passes; extra credit if it returns the > correct complex number. It was a long time before any Common > Lisp implementation passed the third part. > --Steele and Gabriel, "The Evolution of Lisp" LOL! I noticed atanh is not defined in mzscheme so had to look it up. (define (atanh x) (* .5 (log (/ (+ 1.0 x) (- 1.0 x))))) > Common Lisp: The Language lays down explicitly that (expt -8 1/3) must > not return -2, as -2 is not the *principal* cube root of -8; instead it > should return #C(1.0 1.7320508). Very good point! Hmmm... I guess this is another good reason for not duplicating the functionality of ^ and pow. (-8+0i)^(1%3) = 1.0000000000000002+:1.7320508075688772 pow (-8) (1%3) = -2 I noticed in mzscheme, > (expt -8 1/3) 1 > (expt (expt -8 1/3) 2) -1.9999999999999991+3.4641016151377553i > (expt (expt -8 1/3) 3) -8.0+3.1086244689504383e-015i Compare with 1 + i sqrt(3), -2 + 2 sqrt 3, and -8. e.r. |