You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/nanoFramework.CoreLibrary/System/Convert.cs
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -202,6 +202,18 @@ public static double ToDouble(string value)
202
202
returnNativeToDouble(value);
203
203
}
204
204
205
+
#pragma warning disable S4200// Native methods should be wrapped
206
+
/// <summary>
207
+
/// Converts the specified string representation of a number to an equivalent single-precision floating-point number.
208
+
/// </summary>
209
+
/// <param name="value">A string that contains the number to convert.</param>
210
+
/// <returns>A single-precision floating-point number that is equivalent to the number in value, or 0 (zero) if value is <see langword="null"/>.</returns>
211
+
publicstaticfloatToSingle(stringvalue)
212
+
#pragma warning restore S4200// Native methods should be wrapped
213
+
{
214
+
return(float)NativeToDouble(value);
215
+
}
216
+
205
217
/// <summary>
206
218
/// Converts an array of 8-bit unsigned integers to its equivalent String representation encoded with base 64 digits.
/// Represents the smallest positive Double value that is greater than zero. This field is constant.
35
40
/// </summary>
36
41
/// <remarks>The value of this constant is 4.94065645841247e-324.</remarks>
37
42
publicconstdoubleEpsilon=4.9406564584124650E-324;
43
+
38
44
/// <summary>
39
45
/// Represents negative infinity. This field is constant.
40
46
/// </summary>
41
47
publicconstdoubleNegativeInfinity=-1.0/0.0;
48
+
42
49
/// <summary>
43
50
/// Represents positive infinity. This field is constant.
44
51
/// </summary>
45
52
publicconstdoublePositiveInfinity=1.0/0.0;
53
+
54
+
#pragma warning disable S1764// Identical expressions should not be used on both sides of a binary operator
55
+
// intended as the purpose is to a NaN value
56
+
46
57
/// <summary>
47
58
/// Represents a value that is not a number (NaN). This field is constant.
48
59
/// </summary>
49
60
publicconstdoubleNaN=0.0/0.0;
61
+
#pragma warning restore S1764// Identical expressions should not be used on both sides of a binary operator
50
62
51
63
/// <summary>
52
-
/// Documentation missing
64
+
/// Compares this instance to a specified double-precision floating-point number and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified double-precision floating-point number.
/// <param name="d">A double-precision floating-point number to compare.</param>
67
+
/// <param name="value">A double-precision floating-point number to compare.</param>
68
+
/// <returns>A signed number indicating the relative values of this instance and value.
69
+
/// Less than zero: This instance is less than value. -or- This instance is not a number (<see cref="NaN"/>) and value is a number.
70
+
/// Zero: This instance is equal to value. -or- Both this instance and value are not a number (<see cref="NaN"/>), <see cref="PositiveInfinity"/>, or <see cref="NegativeInfinity"/>.
71
+
/// Greater than zero: This instance is greater than value. -or- This instance is a number and value is not a number (<see cref="NaN"/>).
72
+
/// </returns>
73
+
publicintCompareTo(doublevalue)
74
+
{
75
+
returnCompareTo(this,value);
76
+
}
77
+
57
78
[MethodImpl(MethodImplOptions.InternalCall)]
58
-
#pragma warning disable S4200// Native methods should be wrapped
/// <see langword="true"/> if d evaluates to <see cref="PositiveInfinity"/>; otherwise, <see langword="false"/>.
101
+
/// </returns>
102
+
publicstaticboolIsPositiveInfinity(floatf)
103
+
{
104
+
returndouble.IsPositiveInfinity(f);
105
+
}
106
+
107
+
/// <summary>
108
+
/// Compares this instance to a specified single-precision floating-point number and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified single-precision floating-point number.
109
+
/// </summary>
110
+
/// <param name="f">A single-precision floating-point number to compare.</param>
111
+
/// <param name="value">A single-precision floating-point number to compare.</param>
112
+
/// <returns>A signed number indicating the relative values of this instance and value.
113
+
/// Less than zero: This instance is less than value. -or- This instance is not a number (<see cref="NaN"/>) and value is a number.
114
+
/// Zero: This instance is equal to value. -or- Both this instance and value are not a number (<see cref="NaN"/>), <see cref="PositiveInfinity"/>, or <see cref="NegativeInfinity"/>.
115
+
/// Greater than zero: This instance is greater than value. -or- This instance is a number and value is not a number (<see cref="NaN"/>).
116
+
/// </returns>
117
+
publicintCompareTo(floatvalue)
118
+
{
119
+
returndouble.CompareTo(this,value);
120
+
}
121
+
122
+
/// <summary>
123
+
/// Converts the string representation of a number to its single-precision floating-point number equivalent.
124
+
/// </summary>
125
+
/// <param name="s">A string that contains a number to convert. </param>
126
+
/// <returns>A single-precision floating-point number equivalent to the numeric value or symbol specified in <code>s</code>.</returns>
/// Converts the string representation of a number to its single-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.
171
+
/// </summary>
172
+
/// <param name="s">A string containing a number to convert. </param>
173
+
/// <param name="result">When this method returns, contains single-precision floating-point number equivalent to the numeric value or symbol contained in s, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is <see langword="null"/> or Empty, is not a number in a valid format, or represents a number less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.</param>
174
+
/// <returns><see langword="true"/> if s was converted successfully; otherwise, <see langword="false"/>.</returns>
0 commit comments