Jump to content

complex numbers

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
kenna

kenna

    Learning Programmer

  • Members
  • PipPipPip
  • 33 posts
How useful would complex numbers be in a programming language?

There are eight basic arithmetic operations in my language, more complex operations are in a separate mathematic library, so it wouldn't be a fully fledged system for using complex numbers.

  • addition
  • subtraction
  • multiplication
  • division
  • exponentiation
  • additive inverse
  • multiplicative inverse
  • absolute value

So far my language has only three data types, bit (b), integer (n), and fraction (n,d), but I've been wondering whether it would be useful to add a complex (a,bi) data type too.

#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Honestly I have no idea where complex numbers would be used in computer science, I've been programming for four years and haven't come across them - I am eagerly waiting WingedPanther's reply!

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Not to leave Sidewinder disappointed...

The usefulness of adding complex numbers will depend heavily on your target audience. If you are going after the scientific community, it would be nice to include. If you are targeting business/web apps, it probably wouldn't help much.

Another question would be: is this an OOP language which would allow you to define a new datatype. One of the first things I would do, however, is check on the IEEE specifications on data types, as this will give your language standards defined behavior.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
kenna

kenna

    Learning Programmer

  • Members
  • PipPipPip
  • 33 posts

WingedPanther said:

The usefulness of adding complex numbers will depend heavily on your target audience. If you are going after the scientific community, it would be nice to include. If you are targeting business/web apps, it probably wouldn't help much.

Another question would be: is this an OOP language which would allow you to define a new datatype. One of the first things I would do, however, is check on the IEEE specifications on data types, as this will give your language standards defined behavior.

I want to reach a wide audience, so while it wouldn't be of much use to ordinary programmers, it would be very useful for scientists, even if only basic arithmetic operations. Or perhaps complex numbers would have som engineering value.......or maybe not...(T_T) Anyway, it would widen the audience a bit.

The language is almost like C, but regular and very strict. It is also very minimalistic and has a few very useful features not found in C. And absolutely no OOP! Not even if hell froze over! For creating new types you have enum and struct, and so far I cannot see the need for anything more. The language is also purely procedural.

One of the main reasons I began creating this language (besides creating a language I myself am happy with) was to get away from everything OOP and away from bloated GCC, Visual Studio, .net, and whatnot. *drooool* I love TCC!

A minimalistic, strict, regular, simple, "universal" programming language, based on C...with a few twists (-_^)

#5
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts

kenna said:

And absolutely no OOP! Not even if hell froze over!

Thats blasphemy :rolleyes:

#6
G_Morgan

G_Morgan

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 537 posts
C99 has complex numbers. Good luck finding a good implementation of it.

#7
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It sounds like your language will be competing with C/Fortran, which seem to be the favorite languages for scientists/engineers. You may want to look at some of their language specifications to get some ideas for what to include.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog