Table of Contents

Class MathUtils

Namespace
NanoByte.Common
Assembly
NanoByte.Common.dll

Provides math-related utility functions.

public static class MathUtils
Inheritance
MathUtils

Methods

EqualsTolerance(double, double, double)

Compares two floating-point values for equality, allowing for a certain tolerance.

public static bool EqualsTolerance(this double a, double b, double tolerance = 1E-05)

Parameters

a double
b double
tolerance double

Returns

bool

EqualsTolerance(float, float, float)

Compares two floating-point values for equality, allowing for a certain tolerance.

public static bool EqualsTolerance(this float a, float b, float tolerance = 1E-05)

Parameters

a float
b float
tolerance float

Returns

bool

Modulo(int, int)

Calculates the mathematical modulo of a value.

public static int Modulo(this int value, int modulo)

Parameters

value int
modulo int

Returns

int

Modulo(long, long)

Calculates the mathematical modulo of a value.

public static long Modulo(this long value, long modulo)

Parameters

value long
modulo long

Returns

long

MultiplyAndRound(Size, SizeF)

Multiplies a Size with a SizeF and then rounds the components to integer values.

public static Size MultiplyAndRound(this Size size, SizeF factor)

Parameters

size Size
factor SizeF

Returns

Size

XOr(byte[], byte[])

Combines two byte arrays via Exclusive Or.

public static byte[] XOr(byte[] array1, byte[] array2)

Parameters

array1 byte[]
array2 byte[]

Returns

byte[]