Click here to Skip to main content
15,918,343 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Complex numbers in C# Pin
Jörgen Andersson8-Sep-21 1:40
professionalJörgen Andersson8-Sep-21 1:40 
GeneralRe: Complex numbers in C# Pin
Rick York7-Sep-21 9:35
mveRick York7-Sep-21 9:35 
GeneralRe: Complex numbers in C# Pin
PIEBALDconsult7-Sep-21 10:11
mvePIEBALDconsult7-Sep-21 10:11 
GeneralRe: Complex numbers in C# Pin
Chris Maunder7-Sep-21 15:24
cofounderChris Maunder7-Sep-21 15:24 
GeneralRe: Complex numbers in C# Pin
Jon McKee7-Sep-21 11:10
professionalJon McKee7-Sep-21 11:10 
GeneralRe: Complex numbers in C# Pin
Gary R. Wheeler7-Sep-21 11:56
Gary R. Wheeler7-Sep-21 11:56 
GeneralRe: Complex numbers in C# Pin
obermd7-Sep-21 12:09
obermd7-Sep-21 12:09 
GeneralRe: Complex numbers in C# Pin
Stuart Dootson8-Sep-21 0:28
professionalStuart Dootson8-Sep-21 0:28 
Well, I had to try it in C++...
C++
 #include <complex>
 #include <iomanip>
 #include <iostream>

int main() {
  const auto a = std::complex<long double>{-1, 0};
  const auto b = std::sqrt(a);

  std::cout << std::setprecision(20) << "sqrt" << a << " -> " << b << "\n";
}

and that output
sqrt(-1,0) -> (0,1)

in gcc and clang.

And, as you have been a physicist, I figured maybe Fortran might be an alternative...
FORTRAN
program test
implicit none
COMPLEX*8 a,b

a = (-1,0)
b = sqrt(a)
write (*,*) a,b

endprogram test

Guess what - sqrt(-1) == i there too:
(-1.00000000,0.00000000)             (0.00000000,1.00000000)

And all the other non .NET languages I tried also gave the same answer... So I guess .NET is the outlier here!

With all that, though, they're still missing the negative root D'Oh! | :doh:
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Complex numbers in C# Pin
jsc428-Sep-21 2:50
professionaljsc428-Sep-21 2:50 
GeneralRe: Complex numbers in C# Pin
Chris Maunder8-Sep-21 4:03
cofounderChris Maunder8-Sep-21 4:03 
GeneralRe: Complex numbers in C# Pin
Stuart Dootson8-Sep-21 6:40
professionalStuart Dootson8-Sep-21 6:40 
GeneralRe: Complex numbers in C# Pin
Chris Maunder8-Sep-21 4:03
cofounderChris Maunder8-Sep-21 4:03 
GeneralRe: Complex numbers in C# Pin
Member 150893518-Sep-21 4:03
Member 150893518-Sep-21 4:03 
GeneralRe: Complex numbers in C# Pin
JAM_Mtvdeo9-Sep-21 4:51
JAM_Mtvdeo9-Sep-21 4:51 
GeneralI don't think I've ever seen this kind of thing on a web page before Pin
Kent Sharkey7-Sep-21 8:25
staffKent Sharkey7-Sep-21 8:25 
GeneralRe: I don't think I've ever seen this kind of thing on a web page before Pin
kmoorevs7-Sep-21 8:27
kmoorevs7-Sep-21 8:27 
GeneralRe: I don't think I've ever seen this kind of thing on a web page before Pin
jeron17-Sep-21 9:16
jeron17-Sep-21 9:16 
GeneralRe: I don't think I've ever seen this kind of thing on a web page before Pin
Chris Maunder7-Sep-21 8:32
cofounderChris Maunder7-Sep-21 8:32 
GeneralRe: I don't think I've ever seen this kind of thing on a web page before Pin
PIEBALDconsult7-Sep-21 8:46
mvePIEBALDconsult7-Sep-21 8:46 
GeneralRe: I don't think I've ever seen this kind of thing on a web page before Pin
Jacquers7-Sep-21 18:52
Jacquers7-Sep-21 18:52 
GeneralThought of the Day Pin
OriginalGriff7-Sep-21 5:00
mveOriginalGriff7-Sep-21 5:00 
GeneralRe: Thought of the Day Pin
Jacquers7-Sep-21 5:44
Jacquers7-Sep-21 5:44 
GeneralRe: Thought of the Day Pin
DRHuff7-Sep-21 6:43
DRHuff7-Sep-21 6:43 
GeneralRe: Thought of the Day Pin
pkfox7-Sep-21 7:33
professionalpkfox7-Sep-21 7:33 
GeneralRe: Thought of the Day Pin
  Forogar  7-Sep-21 7:53
professional  Forogar  7-Sep-21 7:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.