Class SignificantDigits
Utility class to round double variables to a given nubmer of signficant digits.
Inherited Members
Namespace: TimeSeriesAnalysis.Utility
Assembly: TimeSeriesAnalysis.dll
Syntax
public static class SignificantDigits
Methods
| Edit this page View SourceFormat(double, int)
Rounds scalar down to number of significant digits (26->20 if digits=1 for instance)
Declaration
public static double Format(double number, int digits)
Parameters
Type | Name | Description |
---|---|---|
double | number | |
int | digits |
Returns
Type | Description |
---|---|
double |
Format(double, int, out int)
Rounds down to number of significant digits (26->20 if digits=1 for instance)
Declaration
public static double Format(double number, int digits, out int exponent)
Parameters
Type | Name | Description |
---|---|---|
double | number | |
int | digits | |
int | exponent |
Returns
Type | Description |
---|---|
double |
Format(double[], int)
Rounds array down to number of significant digits (26->20 if digits=1 for instance)
Declaration
public static double[] Format(double[] numbers, int digits)
Parameters
Type | Name | Description |
---|---|---|
double[] | numbers | |
int | digits |
Returns
Type | Description |
---|---|
double[] |
GetSciFormat(double, out double, out int)
Returns number in scientific format with coefficient and exponential paramters
Declaration
public static void GetSciFormat(double number, out double coeff, out int exp)
Parameters
Type | Name | Description |
---|---|---|
double | number | |
double | coeff | |
int | exp |
SciToDouble(double, int)
Converts a scientific number on the format coeff*10^exp to a double
Declaration
public static double SciToDouble(double coeff, int exp)
Parameters
Type | Name | Description |
---|---|---|
double | coeff | coefficient |
int | exp | exponent |
Returns
Type | Description |
---|---|
double | converted double |