System.Single Struct
Summary
Represents a single-precision floating-point number.
Description
The System.Single
structure represents a 32-bit floating-point number.
It is used to represent real numbers with a wide range and precision, suitable for scientific and engineering calculations where a balance between range and memory usage is required.
The Single
type conforms to the IEEE 754 standard for floating-point arithmetic.
Syntax
[StructLayout(LayoutKind.Sequential)] [Serializable] public struct Single : IConvertible, IComparable, IFormattableFields
MaxValue
Represents the largest possible value of a Single
. This field is constant.
MinValue
Represents the smallest possible positive, normalized value of a Single
. This field is constant.
Epsilon
The difference between 1.0 and the next greater Single
number. This field is constant.
NaN
Represents a Not-a-Number (NaN) value. This field is constant.
NegativeInfinity
Represents negative infinity. This field is constant.
PositiveInfinity
Represents positive infinity. This field is constant.
Methods
CompareTo
Compares the current instance to another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Equals
Returns a value indicating whether this instance is equal to a specified Single
value.
Parse
Converts the string representation of a number to its single-precision floating-point equivalent.
string numberString = "123.45";
float result = float.Parse(numberString); // result is 123.45f
ToString
Converts the numeric value of this instance to its equivalent string representation.