Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

A few facts about Lisp and Haskell

Name: Anonymous 2011-04-18 6:59

Lisp:

* (expt -1 (exp 1))
#C(-0.6332554 0.7739428)


Haskell:

Prelude Data.Complex> (-1) ** exp 1 :: Complex Double
(-0.6332556513148192) :+ (-0.773942685266709)

Name: Anonymous 2011-04-18 8:19

>>1
Works fine here (SBCL)

CL-USER> (expt -1 (exp 1))
#C(-0.6332554 0.7739428)
CL-USER> (expt -1 (exp 1.0d0))
#C(-0.6332556513148192d0 0.773942685266709d0)

If you want greater precision, you can get as much as you need if you use some implementation allowing for arbitrary precision (CLISP is one of them, but some may have it available as a library):

[1]> (setf (ext:long-float-digits) 1000)
[2]> (expt -1 (exp 1.0l0))
#C(-0.63325565131482003455221586387628567735988639211576341886045825804185702937821272120217359205393699036520823387683267699270474817719212534837635481841755448651254337491258807459118945922827840765642041394120264007413089579012984077420253480706874872203972770809833002187599896043439198998164240413021982194503L0
  0.77394268526670827825793271720774866145099893995475277126734359502621407976384339614987376269525171149625703363986531499024438903176103407856114984354038551419553115983909019787027150488923326085167062760431552788722548239917674407477700517719629900454875079046934080927802993869382237345209632790390374185827L0)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List