Live data from Hacker News

Complex numbers in JavaScript

beta.observablehq.com

11–12 of 12 posts

Re: Complex numbers in JavaScript

#11
post #7
post #3

Earlier quoted context omitted.

You might as well use WebAssembly for the task. C and C++ have good native complex number support.

They don't really, they tried to glue IEEE semantics onto their complex numbers, so they're largely broken in the modern era of auto-vectorizing compilers.

Interesting. Under what circumstances are they broken?. Inf, NaN?

Re: Complex numbers in JavaScript

#12
post #11
post #7

Earlier quoted context omitted.

They don't really, they tried to glue IEEE semantics onto their complex numbers, so they're largely broken in the modern era of auto-vectorizing compilers.

Interesting. Under what circumstances are they broken?. Inf, NaN?

Here's an article on it that was posted awhile back: https://medium.com/@smcallis_71148/complex-arithmetic-is-com...

The gist is that you can get Nan+jNan for some operations where you wanted "infinity", so to do things their way, you have to insert a NaN check after multiplication for example. This isn't too bad by itself (it's just a bit mask), but it completely borks the vectorizer.

Post reply on HN