Hacker News new | ask | show | jobs
by dragonwriter 1037 days ago
As well as python noted in a sibling, Ruby handles this quite well out-of-the box.

Is your complaint just that some popular languages don’t have complex numbers as part of the core/stdlib?

1 comments

The issue is that lots of languages don't make complex numbers part of what Lispers call the numeric tower, fully integrated into numeric operations, even if there is a complex library. Here's Guy Steele's 3-part smoke test for early Common Lisp implementations:

1. At the REPL, if you type `T` (true), and you get back `T`, the test passes.

2. Define factorial. Then type `(/ (factorial 100) (factorial 99))`. If you get back 100, the test passes.

3. Type `(atanh -2)`. If you get a complex number, the test passes. If you get the correct complex number [namely -0.5493061443340549+1.5707963267948966i] extra credit. Far too many non-Lisp languages return NaN or throw an exception.