Table of Contents

Class XDecimal

Extension methods for decimal.

Inheritance
System.Object
XDecimal
Namespace: Galaxon.Core.Numbers
Assembly: Galaxon.Core.dll
Syntax
public static class XDecimal : object

Fields

MaxScale

The minimum scale factor (inverse decimal exponent).

Declaration
public const short MaxScale = null
Field Value
Type Description
System.Int16
| Improve this Doc View Source

NumExpBits

The number of bits in the exponent.

Declaration
public const byte NumExpBits = null
Field Value
Type Description
System.Byte
| Improve this Doc View Source

NumIntBits

The number of bits in the integer part.

Declaration
public const byte NumIntBits = null
Field Value
Type Description
System.Byte
| Improve this Doc View Source

Methods

Acosh(Decimal)

Inverse hyperbolic cosine.

Declaration
public static decimal Acosh(decimal x)
Parameters
Type Name Description
System.Decimal x

The hyperbolic cosine of an angle.

Returns
Type Description
System.Decimal

The angle.

| Improve this Doc View Source

Asinh(Decimal)

Inverse hyperbolic sine.

Declaration
public static decimal Asinh(decimal x)
Parameters
Type Name Description
System.Decimal x

The hyperbolic sine of an angle.

Returns
Type Description
System.Decimal

The angle.

| Improve this Doc View Source

Assemble(Byte, Byte, UInt128)

Assemble a new decimal value from bitwise parts.

Declaration
public static decimal Assemble(byte signBit, byte scaleBits, UInt128 intBits)
Parameters
Type Name Description
System.Byte signBit

The sign bit (1 or 0).

System.Byte scaleBits

The scale bits.

UInt128 intBits

The integer bits.

Returns
Type Description
System.Decimal

The new decimal.

| Improve this Doc View Source

Atanh(Decimal)

Inverse hyperbolic tangent.

Declaration
public static decimal Atanh(decimal x)
Parameters
Type Name Description
System.Decimal x

The hyperbolic tangent of an angle.

Returns
Type Description
System.Decimal

The angle.

| Improve this Doc View Source

Cosh(Decimal)

Hyperbolic cosine.

Declaration
public static decimal Cosh(decimal x)
Parameters
Type Name Description
System.Decimal x

The hyperbolic angle.

Returns
Type Description
System.Decimal

The hyperbolic cosine of the given angle.

| Improve this Doc View Source

Disassemble(Decimal)

Disassemble the decimal into bitwise parts.

Declaration
public static (byte signBit, byte scaleBits, UInt128 intBits) Disassemble(this decimal x)
Parameters
Type Name Description
System.Decimal x
Returns
Type Description
System.ValueTuple<System.Byte, System.Byte, UInt128>
| Improve this Doc View Source

Exp10(Decimal)

Calculate 10 raised to a decimal power.

Declaration
public static decimal Exp10(decimal m)
Parameters
Type Name Description
System.Decimal m

A decimal value.

Returns
Type Description
System.Decimal

10^d

| Improve this Doc View Source

Exp2(Decimal)

Calculate 2 raised to a decimal power.

Declaration
public static decimal Exp2(decimal m)
Parameters
Type Name Description
System.Decimal m

A decimal value.

Returns
Type Description
System.Decimal

2^d

| Improve this Doc View Source

GetRandom()

Returns a random decimal.

Declaration
public static decimal GetRandom()
Returns
Type Description
System.Decimal
| Improve this Doc View Source

IsInteger(Decimal)

Check if a decimal value is an integer.

Declaration
public static bool IsInteger(decimal m)
Parameters
Type Name Description
System.Decimal m
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Log(Decimal)

Calculate the natural logarithm of a decimal. The algorithm is from: https://en.wikipedia.org/wiki/Natural_logarithm I found that DecimalEx.Log() hangs for very small values so I made this version. It's tested, fast, and doesn't break with the largest or smallest decimal values.

Declaration
public static decimal Log(decimal m)
Parameters
Type Name Description
System.Decimal m

A decimal value.

Returns
Type Description
System.Decimal

The natural logarithm of the given value.

| Improve this Doc View Source

Log(Decimal, Decimal)

Logarithm of a decimal in a specified base. Log(Decimal, Decimal)

Declaration
public static decimal Log(decimal m, decimal b)
Parameters
Type Name Description
System.Decimal m

The decimal value.

System.Decimal b

The base.

Returns
Type Description
System.Decimal

The logarithm of z in base b.

| Improve this Doc View Source

Log10(Decimal)

Logarithm of a decimal in base 10. Log10(Decimal)

Declaration
public static decimal Log10(decimal m)
Parameters
Type Name Description
System.Decimal m

The decimal value.

Returns
Type Description
System.Decimal

The logarithm of the number in base 10.

| Improve this Doc View Source

Log2(Decimal)

Logarithm of a decimal in base 2.

Declaration
public static decimal Log2(decimal m)
Parameters
Type Name Description
System.Decimal m

The decimal value.

Returns
Type Description
System.Decimal

The logarithm of the number in base 2.

| Improve this Doc View Source

RoundSigFigs(Decimal, Int32)

Round off a value to a given number of significant figures.

Declaration
public static decimal RoundSigFigs(decimal m, int n)
Parameters
Type Name Description
System.Decimal m

The number to round.

System.Int32 n

The number of significant figures.

Returns
Type Description
System.Decimal

The rounded number.

| Improve this Doc View Source

Sinh(Decimal)

Hyperbolic sine.

Declaration
public static decimal Sinh(decimal x)
Parameters
Type Name Description
System.Decimal x

The hyperbolic angle.

Returns
Type Description
System.Decimal

The hyperbolic sine of the given angle.

| Improve this Doc View Source

Tanh(Decimal)

Hyperbolic tangent.

Declaration
public static decimal Tanh(decimal x)
Parameters
Type Name Description
System.Decimal x

The hyperbolic angle.

Returns
Type Description
System.Decimal

The hyperbolic tangent of the given angle.

| Improve this Doc View Source
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX | Galaxy logo by Freepik