• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 7. Number() > Example: Implementing Complex Numbers in JavaScript

Example: Implementing Complex Numbers in JavaScript

I noted earlier in this chapter JavaScript's inability to directly handle numbers outside the decimal number system. This is one aspect about JavaScript I actually dislike. I have experimented quite a bit with creating new extensions to JavaScript's decimal number system, and recently I have begun formalizing these extensions under the MozCalc project at http://mozcalc.mozdev.org. Those of you who are curious may look it up under the eXtensible Number System, or XNS.

Although the scope of my work is far beyond the simple example here, I can give demonstrations of how to implement complex numbers in JavaScript without too much technical wizardry. A complex number, in the simplest terms, is a number of the form (a + b * i), where i = Math.sqrt(-1).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint