Click here to Skip to main content
15,891,805 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: A lesson in bug testing. Pin
Paul Harris8-Sep-21 21:40
Paul Harris8-Sep-21 21:40 
GeneralRe: A lesson in bug testing. Pin
darktrick5449-Sep-21 1:59
darktrick5449-Sep-21 1:59 
GeneralRe: A lesson in bug testing. Pin
Daniel Pfeffer9-Sep-21 3:22
professionalDaniel Pfeffer9-Sep-21 3:22 
GeneralRe: A lesson in bug testing. Pin
Kirk 103898219-Sep-21 3:56
Kirk 103898219-Sep-21 3:56 
GeneralRe: A lesson in bug testing. Pin
Cpichols9-Sep-21 5:14
Cpichols9-Sep-21 5:14 
GeneralRe: A lesson in bug testing. Pin
Oscar Luis Vera Pérez17-Sep-21 0:56
Oscar Luis Vera Pérez17-Sep-21 0:56 
GeneralRe: A lesson in bug testing. Pin
CHill6017-Sep-21 1:01
mveCHill6017-Sep-21 1:01 
GeneralComplex numbers in C# PinPopular
Chris Maunder7-Sep-21 8:29
cofounderChris Maunder7-Sep-21 8:29 
I was reading about complex numbers in C# and saw this
Complex minusOne = new Complex(-1, 0);
Console.WriteLine(Complex.Sqrt(minusOne));
// The example displays the following output:
//    (6.12303176911189E-17, 1) on 32-bit systems.
//    (6.12323399573677E-17,1) on IA64 systems.

I'm curious: is there any reason one would not simply hardcode Complex.Sqrt(-1) to equal new Complex(0, 1);?

The whole thing about complex numbers is they are based on the fundamental concept that i2 = -1. Why wouldn't you bake that in as an absolute and let the representational errors happen elsewhere?

I get that actually detecting all cases of √-1 is tricky and messy at best, but it's not like you can actually compare, with arbitrary precision, two floating point values anyway.

Future warning: if I ever get access to the .NET code in a way that lets me sneak in a change, then this will happen. It may cause manned spacecraft to veer off course and crash into the moon, or nuclear reactors to overheat and take out half a continent. But, dammit, √-1 will equal i.
cheers
Chris Maunder

GeneralRe: Complex numbers in C# PinPopular
Jörgen Andersson7-Sep-21 9:21
professionalJörgen Andersson7-Sep-21 9:21 
GeneralRe: Complex numbers in C# Pin
Eric R Johansson8-Sep-21 0:34
Eric R Johansson8-Sep-21 0:34 
GeneralRe: Complex numbers in C# Pin
Jörgen Andersson8-Sep-21 1:27
professionalJörgen Andersson8-Sep-21 1:27 
GeneralRe: Complex numbers in C# Pin
Eric R Johansson8-Sep-21 1:41
Eric R Johansson8-Sep-21 1:41 
GeneralRe: Complex numbers in C# Pin
Jörgen Andersson8-Sep-21 1:48
professionalJörgen Andersson8-Sep-21 1:48 
GeneralRe: Complex numbers in C# Pin
Eric R Johansson8-Sep-21 1:51
Eric R Johansson8-Sep-21 1:51 
GeneralRe: Complex numbers in C# Pin
Jörgen Andersson8-Sep-21 1:57
professionalJörgen Andersson8-Sep-21 1:57 
GeneralRe: Complex numbers in C# Pin
Eric R Johansson8-Sep-21 2:03
Eric R Johansson8-Sep-21 2:03 
GeneralRe: Complex numbers in C# Pin
Reelix8-Sep-21 19:38
Reelix8-Sep-21 19:38 
GeneralRe: Complex numbers in C# Pin
Luca Cestola8-Sep-21 1:24
Luca Cestola8-Sep-21 1:24 
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 

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.