Class XSbyte
Extension methods for sbyte.
Inheritance
System.Object
XSbyte
Namespace: Galaxon.Core.Numbers
Assembly: Galaxon.Core.dll
Syntax
public static class XSbyte : object
Methods
Abs(SByte)
Return the absolute value of an sbyte as a byte. This addresses an issue with sbyte.Abs(), which is that Abs(sbyte.MinValue) can't be expressed as a sbyte, and so wrap-around occurs. Unsigned integer types don't have an Abs() method, so there's no collision.
Declaration
public static byte Abs(sbyte n)
Parameters
| Type | Name | Description |
|---|---|---|
| System.SByte | n | A sbyte value. |
Returns
| Type | Description |
|---|---|
| System.Byte | The absolute value as a byte. |