Class DoubleUtil
Provide utitilies about handling double values
Assembly: Reportman.Drawing.dll
Syntax
Constructors
View Source
DoubleUtil()
Declaration
Methods
View Source
CompareValue(decimal, decimal, decimal)
Compare values, but an difference lower than epsilon will return as equal
Declaration
public static int CompareValue(decimal p1, decimal p2, decimal epsilon)
Parameters
Returns
View Source
DecimalToSqlLiteral(decimal)
Converts a numeric decimal value to sql literal
Declaration
public static string DecimalToSqlLiteral(decimal nvalue)
Parameters
| Type |
Name |
Description |
| decimal |
nvalue |
Value to convert
|
Returns
| Type |
Description |
| string |
Formatted string to insert directly into SQL Statement
|
View Source
DoubleToSqlLiteral(double)
Converts a double value to sql literal
Declaration
public static string DoubleToSqlLiteral(double nvalue)
Parameters
| Type |
Name |
Description |
| double |
nvalue |
Value to convert
|
Returns
| Type |
Description |
| string |
Formatted string to insert directly into SQL Statement
|
View Source
Format a number with a mask
Declaration
public static string FormatCurrAdv(string mask, double number)
Parameters
Returns
View Source
Default format string for a number of decimals
Declaration
public static string FormatStringDecimals(int decimals)
Parameters
| Type |
Name |
Description |
| int |
decimals |
|
Returns
View Source
Frac(decimal)
Calculates the fractionary value of a number
Declaration
public static decimal Frac(decimal number)
Parameters
| Type |
Name |
Description |
| decimal |
number |
Decimal number
|
Returns
| Type |
Description |
| decimal |
Fractionary part of the decimal number
|
View Source
IsNumeric(string, NumberStyles)
Check if a string can be converted to a number
Declaration
public static bool IsNumeric(string val, NumberStyles NumberStyle)
Parameters
Returns
View Source
IsNumericType(object)
Declaration
public static bool IsNumericType(object o)
Parameters
| Type |
Name |
Description |
| object |
o |
|
Returns
View Source
NumberToText(decimal, bool, int)
Converts a number to his representation in natural words
Declaration
public static string NumberToText(decimal number, bool female, int lang)
Parameters
Returns
View Source
RoundDecimalUp(decimal, decimal)
Round a decimal to the nearest multiple value, the midpoint will be rounded up
Declaration
public static decimal RoundDecimalUp(decimal number, decimal multiple)
Parameters
Returns
View Source
StandardDeviation(IEnumerable<double>)
Calculate standard deviation
Declaration
public static double StandardDeviation(IEnumerable<double> values)
Parameters
Returns
View Source
Trunc(decimal)
Calculates the integer part of a number
Declaration
public static long Trunc(decimal number)
Parameters
| Type |
Name |
Description |
| decimal |
number |
Decimal number
|
Returns
| Type |
Description |
| long |
Truncated numberr
|
View Source
Truncate(decimal)
Truncate a decimal number
Declaration
public static decimal Truncate(decimal nvalue)
Parameters
| Type |
Name |
Description |
| decimal |
nvalue |
|
Returns