Table of Contents

Class ArithmeticExtensions

Namespace
LfrlAnvil.Extensions
Assembly
LfrlAnvil.Core.dll

Contains arithmetic extension methods.

public static class ArithmeticExtensions
Inheritance
ArithmeticExtensions
Inherited Members

Methods

EuclidModulo(byte, byte)

Calculates the remainder of a euclidean division of a by b.

[Pure]
public static byte EuclidModulo(this byte a, byte b)

Parameters

a byte

Dividend.

b byte

Divisor.

Returns

byte

byte result of euclidean a / b.

Exceptions

DivideByZeroException

When b is equal to 0.

EuclidModulo(decimal, decimal)

Calculates the remainder of a euclidean division of a by b.

[Pure]
public static decimal EuclidModulo(this decimal a, decimal b)

Parameters

a decimal

Dividend.

b decimal

Divisor.

Returns

decimal

decimal result of euclidean a / b.

Exceptions

DivideByZeroException

When b is equal to 0.

EuclidModulo(double, double)

Calculates the remainder of a euclidean division of a by b.

[Pure]
public static double EuclidModulo(this double a, double b)

Parameters

a double

Dividend.

b double

Divisor.

Returns

double

double result of euclidean a / b.

Exceptions

DivideByZeroException

When b is equal to 0.

EuclidModulo(short, short)

Calculates the remainder of a euclidean division of a by b.

[Pure]
public static short EuclidModulo(this short a, short b)

Parameters

a short

Dividend.

b short

Divisor.

Returns

short

short result of euclidean a / b.

Exceptions

DivideByZeroException

When b is equal to 0.

EuclidModulo(int, int)

Calculates the remainder of a euclidean division of a by b.

[Pure]
public static int EuclidModulo(this int a, int b)

Parameters

a int

Dividend.

b int

Divisor.

Returns

int

int result of euclidean a / b.

Exceptions

DivideByZeroException

When b is equal to 0.

EuclidModulo(long, long)

Calculates the remainder of a euclidean division of a by b.

[Pure]
public static long EuclidModulo(this long a, long b)

Parameters

a long

Dividend.

b long

Divisor.

Returns

long

long result of euclidean a / b.

Exceptions

DivideByZeroException

When b is equal to 0.

EuclidModulo(sbyte, sbyte)

Calculates the remainder of a euclidean division of a by b.

[Pure]
public static sbyte EuclidModulo(this sbyte a, sbyte b)

Parameters

a sbyte

Dividend.

b sbyte

Divisor.

Returns

sbyte

sbyte result of euclidean a / b.

Exceptions

DivideByZeroException

When b is equal to 0.

EuclidModulo(float, float)

Calculates the remainder of a euclidean division of a by b.

[Pure]
public static float EuclidModulo(this float a, float b)

Parameters

a float

Dividend.

b float

Divisor.

Returns

float

float result of euclidean a / b.

Exceptions

DivideByZeroException

When b is equal to 0.

EuclidModulo(ushort, ushort)

Calculates the remainder of a euclidean division of a by b.

[Pure]
public static ushort EuclidModulo(this ushort a, ushort b)

Parameters

a ushort

Dividend.

b ushort

Divisor.

Returns

ushort

ushort result of euclidean a / b.

Exceptions

DivideByZeroException

When b is equal to 0.

EuclidModulo(uint, uint)

Calculates the remainder of a euclidean division of a by b.

[Pure]
public static uint EuclidModulo(this uint a, uint b)

Parameters

a uint

Dividend.

b uint

Divisor.

Returns

uint

uint result of euclidean a / b.

Exceptions

DivideByZeroException

When b is equal to 0.

EuclidModulo(ulong, ulong)

Calculates the remainder of a euclidean division of a by b.

[Pure]
public static ulong EuclidModulo(this ulong a, ulong b)

Parameters

a ulong

Dividend.

b ulong

Divisor.

Returns

ulong

ulong result of euclidean a / b.

Exceptions

DivideByZeroException

When b is equal to 0.

IsEven(byte)

Checks if the provided byte value is even.

[Pure]
public static bool IsEven(this byte x)

Parameters

x byte

Value to check.

Returns

bool

true when x is even, otherwise false.

IsEven(short)

Checks if the provided short value is even.

[Pure]
public static bool IsEven(this short x)

Parameters

x short

Value to check.

Returns

bool

true when x is even, otherwise false.

IsEven(int)

Checks if the provided int value is even.

[Pure]
public static bool IsEven(this int x)

Parameters

x int

Value to check.

Returns

bool

true when x is even, otherwise false.

IsEven(long)

Checks if the provided long value is even.

[Pure]
public static bool IsEven(this long x)

Parameters

x long

Value to check.

Returns

bool

true when x is even, otherwise false.

IsEven(sbyte)

Checks if the provided sbyte value is even.

[Pure]
public static bool IsEven(this sbyte x)

Parameters

x sbyte

Value to check.

Returns

bool

true when x is even, otherwise false.

IsEven(ushort)

Checks if the provided ushort value is even.

[Pure]
public static bool IsEven(this ushort x)

Parameters

x ushort

Value to check.

Returns

bool

true when x is even, otherwise false.

IsEven(uint)

Checks if the provided uint value is even.

[Pure]
public static bool IsEven(this uint x)

Parameters

x uint

Value to check.

Returns

bool

true when x is even, otherwise false.

IsEven(ulong)

Checks if the provided ulong value is even.

[Pure]
public static bool IsEven(this ulong x)

Parameters

x ulong

Value to check.

Returns

bool

true when x is even, otherwise false.

IsOdd(byte)

Checks if the provided byte value is odd.

[Pure]
public static bool IsOdd(this byte x)

Parameters

x byte

Value to check.

Returns

bool

true when x is odd, otherwise false.

IsOdd(short)

Checks if the provided short value is odd.

[Pure]
public static bool IsOdd(this short x)

Parameters

x short

Value to check.

Returns

bool

true when x is odd, otherwise false.

IsOdd(int)

Checks if the provided int value is odd.

[Pure]
public static bool IsOdd(this int x)

Parameters

x int

Value to check.

Returns

bool

true when x is odd, otherwise false.

IsOdd(long)

Checks if the provided long value is odd.

[Pure]
public static bool IsOdd(this long x)

Parameters

x long

Value to check.

Returns

bool

true when x is odd, otherwise false.

IsOdd(sbyte)

Checks if the provided sbyte value is odd.

[Pure]
public static bool IsOdd(this sbyte x)

Parameters

x sbyte

Value to check.

Returns

bool

true when x is odd, otherwise false.

IsOdd(ushort)

Checks if the provided ushort value is odd.

[Pure]
public static bool IsOdd(this ushort x)

Parameters

x ushort

Value to check.

Returns

bool

true when x is odd, otherwise false.

IsOdd(uint)

Checks if the provided uint value is odd.

[Pure]
public static bool IsOdd(this uint x)

Parameters

x uint

Value to check.

Returns

bool

true when x is odd, otherwise false.

IsOdd(ulong)

Checks if the provided ulong value is odd.

[Pure]
public static bool IsOdd(this ulong x)

Parameters

x ulong

Value to check.

Returns

bool

true when x is odd, otherwise false.