New to Telerik UI for WinForms? Start a free 30-day trial

Provides static methods not included in the standard Math class.

Definition

Namespace:Telerik.WinForms.Spreadsheet

Assembly:Telerik.WinControls.RadSpreadsheet.dll

Syntax:

C#
public static class MathUtilities

Inheritance: objectMathUtilities

Methods

Restricts a value to be within a specified range.

C#
public static double Clamp(double value, double minimum, double maximum, int precision)
Parameters:valuedouble

The value to clamp.

minimumdouble

The minimum value.

maximumdouble

The maximum value.

precisionint

The rounding precision value.

Returns:

double

The clamped value.

Restricts a value to be within a specified range.

C#
public static double Clamp(double value, double min, double max)
Parameters:valuedouble

The value to clamp.

mindouble

The minimum value.

maxdouble

The maximum value.

Returns:

double

The clamped value.

Restricts a value to be within a specified range.

C#
public static int Clamp(int value, int min, int max)
Parameters:valueint

The value to clamp.

minint

The minimum value.

maxint

The maximum value.

Returns:

int

The clamped value.

Returns the fractional part using a floor-based mapping for negative values.

C#
public static double CustomMod(double number)
Parameters:numberdouble

The value to reduce to a fractional part.

Returns:

double

For positive values, the fractional part in the range 0 (inclusive) to 1 (exclusive); for negative values, 1 minus the fractional part of the absolute value. Zero and NaN return 0, while positive or negative infinity returns NaN.

Exact negative integers return 1 rather than 0.

Converts an integer to a lowercase Roman numeral string.

C#
public static string IntegerToRomanString(int number)
Parameters:numberint

The integer to convert.

Returns:

string

The numeral using lowercase Roman symbols, or n for zero. Values greater than 32767 are incremented and then reduced modulo 32768; if the adjusted value is zero, the result is an empty string.

Exceptions: ArgumentException

number is negative.

Checks if a value is within a specified range.

C#
public static bool IsInRange(int value, int min, int max)
Parameters:valueint

The value to check.

minint

The minimum value.

maxint

The maximum value.

Returns:

bool

True if the values is within the range, false otherwise.