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.RichTextEditor

Assembly:Telerik.WinControls.RichTextEditor.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.

Maps a value's fractional part into the unit interval, using the complementary fraction for negative values.

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

The value to map by its fractional part.

Returns:

double

For finite positive values, the fractional part in [0, 1); for finite negative values, one minus the fractional part of the absolute value. Negative integers return 1, while zero and NaN return 0. Positive and negative infinity return NaN.

Converts an integer to the lowercase Roman numeral notation used by list and field formatting.

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

A nonnegative number to format.

Returns:

string

The lowercase Roman numeral representation; an input of zero is represented by n.

Exceptions: ArgumentException

number is negative.

Values greater than 32767 are incremented and reduced modulo 32768 before conversion. If this adjustment produces zero, the method returns an empty string.

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.