Precizia numerelor complexe
Versiunea din 29 martie 2020 10:48, autor: Yo3iti (Discuție | contribuții) (Pagină nouă: The real and imaginary parts of a complex number are represented by two double-precision floating-point values. This means that Complex values, like double-precision floating-point...)
The real and imaginary parts of a complex number are represented by two double-precision floating-point values. This means that Complex values, like double-precision floating-point values, can lose precision as a result of numerical operations. This means that strict comparisons for equality of two Complex values may fail, even if the difference between the two values is due to a loss of precision. For more information, see Double.
For example, performing exponentiation on the logarithm of a number should return the original number. However, in some cases, the loss of precision of floating-point values can cause slight differences between the two values, as the following example illustrates.
Complex value = new Complex(Double.MinValue/2, Double.MinValue/2);
Complex value2 = Complex.Exp(Complex.Log(value));
Console.WriteLine("{0} \n{1} \nEqual: {2}", value, value2,
value == value2);
// The example displays the following output:
// (-8.98846567431158E+307, -8.98846567431158E+307)
// (-8.98846567431161E+307, -8.98846567431161E+307)
// Equal: False