Yes, all my data types are used to represent money. Oh well, I wish MS had
put in their documentation on the Single type somewhere that it should not
be used for currencies. They should have put it right here:-
Represents a single-precision floating point number.
For a list of all members of this type, see Single Members.
System.Object
System.ValueType
System.Single
[Visual Basic]
<Serializable>
Public Structure Single
Implements IComparable, IFormattable, IConvertible
[C#]
[Serializable]
public struct Single : IComparable, IFormattable, IConvertible
[C++]
[Serializable]
public __value struct Single : public IComparable, IFormattable,
IConvertible
[JScript] In JScript, you can use the structures in the .NET Framework, but
you cannot define your own.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are safe for
multithreaded operations. Any instance members are not guaranteed to be
thread safe.
Remarks
The Single value type represents a single-precision 32-bit number with
values ranging from negative 3.402823e38 to positive 3.402823e38, as well as
positive or negative zero, PositiveInfinity, NegativeInfinity, and not a
number (NaN).
Single complies with the IEC 60559:1989 (IEEE 754) standard for binary
floating-point arithmetic.
Single provides methods to compare instances of this type, convert the value
of an instance to its string representation, and convert the string
representation of a number to an instance of this type.
For information about how format specification codes control the string
representation of value types, see Formatting Overview.This type implements
interfaces IComparable, IFormattable, and IConvertible. Use the Convert
class for conversions instead of this type's explicit interface member
implementation of IConvertible.
When performing binary operations, if one of the operands is a
floating-point type, Single or Double, then the other operand is required to
be an integral type or a floating-point type. The operation is evaluated as
follows:
a.. If one of the operands is of an integral type, then that operand is
converted to the floating-point type of the other operand.
b.. Then, if either of the operands is Double, the other operand is
converted to Double, and the operation is performed using at least the range
and precision of the Double. For numeric operations, the type of the result
is Double.
c.. Otherwise, the operation is performed using at least the range and
precision of the Single type and, for numeric operations, the type of the
result is Single.
The floating-point operators, including the assignment operators, do not
throw exceptions. Instead, in exceptional situations, the result of a
floating-point operation is zero, infinity, or NaN, as described below:
a.. If the result of a floating-point operation is too small for the
destination format, the result of the operation is zero.
b.. If the magnitude of the result of a floating-point operation is too
large for the destination format, the result of the operation is
PositiveInfinity or NegativeInfinity, as appropriate for the sign of the
result.
c.. If a floating-point operation is invalid, the result of the operation
is NaN.
d.. If one or both operands of a floating-point operation are NaN, the
result of the operation is NaN.
Requirements
Namespace: System
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows
2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003
family, .NET Compact Framework - Windows CE .NET
Assembly: Mscorlib (in Mscorlib.dll)
See Also
thanks!