Complex Number Formats In Various Programming Languages
C99:
- input:
2.5+6.75I
- output:
2.50+6.75I
Fortran:
- input:
(2.5,6.75)
- output with decimal point:
(2.50, 6.75) or 2.50+I6.75
- output with decimal comma:
(2,50; 6,75) or 2,50+I6,75
Haskell:
- input:
2.5 :+ 6.75
- output:
2.5 :+ 6.75
Lisp:
- input:
c#(2.5 6.75)
- output:
C#(2.5 6.75)
Lua:
- input:
{2.5, 6.75} or complex "2.5+6.75i"
- output:
2.5+6.75i
Perl:
- input:
cplx(2.5, 6.75)
- output:
2.5+6.75i
Python:
- input:
c{2.5, 6.75}
- output:
(2.5+6.75j)
Ruby:
- input:
Complex(2.5, 6.75)
- output:
Complex(2.5, 6.75)
|