m Fix category |
Added link. |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
A float is a [[Value Type | value]] type that that can store a floating-point decimal number in the approximate range '''±1.5 x 10^−45''' to '''±3.4 x 10^38''' | A float is a [[Value Type | value]] type that that can store a [[Floating Point|floating-point]] decimal number in the approximate range '''±1.5 x 10^−45''' to '''±3.4 x 10^38''' | ||
In the underlying runtime (.net), this takes up 4 [[Type:Byte | bytes]] of memory. For more information, refer to the [https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types Microsoft documentation on floating-point numeric types] | In the underlying runtime (.net), this takes up 4 [[Type:Byte | bytes]] of memory. For more information, refer to the [https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types Microsoft documentation on floating-point numeric types] | ||
Line 5: | Line 5: | ||
== Usage == | == Usage == | ||
Use this type whenever you need to store decimal numbers, but don't need high precision. Generally, you should try using one of the float variants first, before moving on to [[Type:Double| double]], which uses twice the memory. | Use this type whenever you need to store decimal numbers, but don't need high precision. Generally, you should try using one of the float variants first, before moving on to [[Type:Double| double]], which uses twice the memory. | ||
{{Template:FloatTypes}} | |||
Latest revision as of 08:53, 30 July 2024
A float is a value type that that can store a floating-point decimal number in the approximate range ±1.5 x 10^−45 to ±3.4 x 10^38
In the underlying runtime (.net), this takes up 4 bytes of memory. For more information, refer to the Microsoft documentation on floating-point numeric types
Usage
Use this type whenever you need to store decimal numbers, but don't need high precision. Generally, you should try using one of the float variants first, before moving on to double, which uses twice the memory.