FloatType<SELF, FLOATING, A, PRED> Class

FloatType - inspired by Haskell's 'newtype' keyword. This is setup for floating point numeric types,and expects a Floating<A> class-instance as an argument (TFloat, TDouble, TDecimal, etc.)

https://wiki.haskell.org/Newtype

Derive type from this one to get: Equatable, Comparable, Appendable, Foldable, Functor, Iterable: strongly typed values.

For example:

class Metres : FloatType<Metres, TDouble, double> { public Metres(double x) : base(x) {} }


Will not accept null values

DECLARATION
[Serializable]
public abstract class FloatType<SELF, FLOATING, A, PRED> : IEquatable<SELF>,
IComparable<SELF>
NAMESPACE
LanguageExt

Constructors

FloatType(A)
SUMMARY

Constructor

PARAMETERS
value
A
Value to bind
DECLARATION
public ctor FloatType(A value)
EXCEPTIONS
ArgumentOutOfRangeException
If argument fails to pass the predicate provided in the generic argument PRED
ArgumentNullException
Null values are not accepted

Fields

New
SUMMARY

Constructor function

DECLARATION
public static readonly Func<A, SELF> New
Value
DECLARATION
public readonly A Value

Methods

Abs()
SUMMARY

Find the absolute value of a number

DECLARATION
public virtual SELF Abs()
RETURNS
SELF
The non-negative absolute value of x
Acos()
SUMMARY

Calculates an arc-cosine.

DECLARATION
[Pure]
public SELF Acos()
RETURNS
SELF
The value of <c>acos(x)</c>, in radians
Acosh()
SUMMARY

Calculates an area hyperbolic cosine.

DECLARATION
[Pure]
public SELF Acosh()
RETURNS
SELF
The value of <c>acosh(x)</c>.
Asin()
SUMMARY

Calculates an arcsine.

DECLARATION
[Pure]
public SELF Asin()
RETURNS
SELF
The value of <c>asin(x)</c>, in radians.
Asinh()
SUMMARY

Calculates an area hyperbolic sine

DECLARATION
[Pure]
public SELF Asinh()
RETURNS
SELF
The value of <c>asinh(x)</c>.
Atan()
SUMMARY

Calculates an arc-tangent.

DECLARATION
[Pure]
public SELF Atan()
RETURNS
SELF
The value of <c>atan(x)</c>, in radians
Atanh()
SUMMARY

Calculates an area hyperbolic tangent.

DECLARATION
[Pure]
public SELF Atanh()
RETURNS
SELF
The value of <c>atanh(x)</c>
Bind(Func<A, SELF>)
SUMMARY

Monadic bind of the bound value to a new value of the same type

PARAMETERS
bind
Func<A, SELF>
Bind function
DECLARATION
[Pure]
public virtual SELF Bind(Func<A, SELF> bind)
RETURNS
SELF
CompareTo(SELF)
SUMMARY

Compare this to other

PARAMETERS
other
SELF
DECLARATION
[Pure]
public virtual int CompareTo(SELF other)
RETURNS
int
Cos()
SUMMARY

Calculates the cosine of an angle.

DECLARATION
[Pure]
public SELF Cos()
RETURNS
SELF
The value of <c>cos(x)</c>
Cosh()
SUMMARY

Calculates a hyperbolic cosine.

DECLARATION
[Pure]
public SELF Cosh()
RETURNS
SELF
The value of <c>cosh(x)</c>
Divide(SELF)
SUMMARY

Divide NewType(x) and NewType(y)

PARAMETERS
rhs
SELF
Right-hand side of the operation
DECLARATION
[Pure]
public virtual SELF Divide(SELF rhs)
RETURNS
SELF
lhs / rhs
Equals(SELF)
SUMMARY

Equality test between this and other

PARAMETERS
other
SELF
DECLARATION
[Pure]
public virtual bool Equals(SELF other)
RETURNS
bool
Equals(SELF, SELF)
SUMMARY

Equality test between this and other

PARAMETERS
other
SELF
epsilon
SELF
DECLARATION
[Pure]
public virtual bool Equals(SELF other, SELF epsilon)
RETURNS
bool
Equals(object)
SUMMARY

Equality test between this and other

PARAMETERS
obj
object
DECLARATION
[Pure]
public override bool Equals(object obj)
RETURNS
bool
Exists(Func<A, bool>)
SUMMARY

Run a predicate for all values in the FloatType (only ever one)

PARAMETERS
predicate
Func<A, bool>
DECLARATION
[Pure]
public virtual bool Exists(Func<A, bool> predicate)
RETURNS
bool
Exp()
SUMMARY

The exponential function.

DECLARATION
[Pure]
public SELF Exp()
RETURNS
SELF
The value of <c>e^x</c>
Fold<S>(S, Func<S, A, S>)
SUMMARY

Fold

PARAMETERS
state
S
Initial state
folder
Func<S, A, S>
Fold function
DECLARATION
public virtual S Fold<S>(S state, Func<S, A, S> folder)
RETURNS
S
Folded state and FloatType bound value
FoldBack<S>(S, Func<S, A, S>)
SUMMARY

Fold back

PARAMETERS
state
S
Initial state
folder
Func<S, A, S>
Fold function
DECLARATION
public virtual S FoldBack<S>(S state, Func<S, A, S> folder)
RETURNS
S
Folded state and FloatType bound value
ForAll(Func<A, bool>)
SUMMARY

Run a predicate for all values in the FloatType (only ever one)

PARAMETERS
predicate
Func<A, bool>
DECLARATION
[Pure]
public virtual bool ForAll(Func<A, bool> predicate)
RETURNS
bool
FromInteger(int)
PARAMETERS
value
int
DECLARATION
[Pure]
public static SELF FromInteger(int value)
RETURNS
SELF
GetHashCode()
SUMMARY

Get the hash-code of the bound value

DECLARATION
[Pure]
public override int GetHashCode()
RETURNS
int
Iter(Action<A>)
SUMMARY

Invoke an action that takes the bound value as an argument

PARAMETERS
f
Action<A>
Action to invoke
DECLARATION
public virtual Unit Iter(Action<A> f)
Log()
SUMMARY

Calculates the natural logarithm of a value.

DECLARATION
[Pure]
public SELF Log()
RETURNS
SELF
The value of <c>ln(x)</c>.
LogBase(A)
SUMMARY

Calculates the logarithm of a value with respect to an arbitrary base.

PARAMETERS
y
A
The value for which we are calculating the logarithm.
DECLARATION
[Pure]
public SELF LogBase(A y)
RETURNS
SELF
The value of <c>log x (y)</c>.
Map(Func<A, A>)
SUMMARY

Map the bound value to a new value of the same type

PARAMETERS
map
Func<A, A>
DECLARATION
[Pure]
public virtual SELF Map(Func<A, A> map)
RETURNS
SELF
Max(SELF)
SUMMARY

Find the maximum value between this and rhs

PARAMETERS
rhs
SELF
DECLARATION
public virtual SELF Max(SELF rhs)
RETURNS
SELF
Min(SELF)
SUMMARY

Find the minimum value between this and rhs

PARAMETERS
rhs
SELF
DECLARATION
public virtual SELF Min(SELF rhs)
RETURNS
SELF
Plus(SELF)
SUMMARY

Sum of FloatType(x) and FloatType(y)

PARAMETERS
rhs
SELF
Right-hand side of the operation
DECLARATION
[Pure]
public virtual SELF Plus(SELF rhs)
RETURNS
SELF
lhs + rhs
Pow(A)
SUMMARY

Raises x to the power y

PARAMETERS
exp
A
The exponent to which we are raising x
DECLARATION
[Pure]
public SELF Pow(A exp)
RETURNS
SELF
The value of <c>x^y</c>.
Product(SELF)
SUMMARY

Multiply NewType(x) and NewType(y)

PARAMETERS
rhs
SELF
Right-hand side of the operation
DECLARATION
[Pure]
public virtual SELF Product(SELF rhs)
RETURNS
SELF
lhs * rhs
Select(Func<A, A>)
SUMMARY

Map the bound value to a new value of the same type

PARAMETERS
map
Func<A, A>
DECLARATION
[Pure]
public virtual SELF Select(Func<A, A> map)
RETURNS
SELF
SelectMany(Func<A, FloatType<SELF, FLOATING, A, PRED>>, Func<A, A, A>)
SUMMARY

Monadic bind of the bound value to a new value of the same type

PARAMETERS
bind
Func<A, FloatType<SELF, FLOATING, A, PRED>>
Bind function
project
Func<A, A, A>
Final projection (select)
DECLARATION
[Pure]
public virtual SELF SelectMany(Func<A, FloatType<SELF, FLOATING, A, PRED>> bind, Func<A, A, A> project)
RETURNS
SELF
Signum()
SUMMARY

Find the sign of x

DECLARATION
public virtual SELF Signum()
RETURNS
SELF
-1, 0, or +1
Sin()
SUMMARY

Calculates the sine of an angle.

DECLARATION
[Pure]
public SELF Sin()
RETURNS
SELF
The value of <c>sin(x)</c>
Sinh()
SUMMARY

Calculates a hyperbolic sine.

DECLARATION
[Pure]
public SELF Sinh()
RETURNS
SELF
The value of <c>sinh(x)</c>
Sqrt()
SUMMARY

Calculates the square root of a value.

DECLARATION
[Pure]
public SELF Sqrt()
RETURNS
SELF
The value of <c>sqrt(x)</c>.
Subtract(SELF)
SUMMARY

Subtract of NewType(x) and NewType(y)

PARAMETERS
rhs
SELF
Right-hand side of the operation
DECLARATION
[Pure]
public virtual SELF Subtract(SELF rhs)
RETURNS
SELF
lhs - rhs
Tan()
SUMMARY

Calculates the tangent of an angle.

DECLARATION
[Pure]
public SELF Tan()
RETURNS
SELF
The value of <c>tan(x)</c>
Tanh()
SUMMARY

Calculates a hyperbolic tangent.

DECLARATION
[Pure]
public SELF Tanh()
RETURNS
SELF
The value of <c>tanh(x)</c>
ToString()
SUMMARY

Generate a text representation of the FloatType and value

DECLARATION
[Pure]
public override string ToString()
RETURNS
string