FiniteFloatModule
PackageReified.Refinements
Operations over floats that are known to be neither infinite nor <c>NaN</c>.
Summary
| Name | Signature | Synopsis |
|---|---|---|
| constraint' | FiniteFloat.constraint' | The portable constraint admitting only finite doubles. |
| refinement | FiniteFloat.refinement | No description available. |
| value | FiniteFloat.value input | Returns the underlying value. |
| create | FiniteFloat.create value | Admits a finite double, rejecting infinities and NaN. |
| ofFloat | FiniteFloat.ofFloat value | Returns the finite value, or None when it is infinite or NaN. |
| zero | FiniteFloat.zero | The additive identity. |
| one | FiniteFloat.one | The multiplicative identity. |
| negate | FiniteFloat.negate input | Negates the value. |
| abs | FiniteFloat.abs input | Returns the magnitude. |
| min | FiniteFloat.min left right | Returns the smaller value. |
| max | FiniteFloat.max left right | Returns the larger value. |
| compare | FiniteFloat.compare left right | Compares two finite doubles. |
| average | FiniteFloat.average values | Returns the arithmetic mean. |
| sum | FiniteFloat.sum values | Totals a non-empty list, failing when the total leaves the finite range. |
| minimum | FiniteFloat.minimum values | Returns the smallest value. |
| maximum | FiniteFloat.maximum values | Returns the largest value. |
The portable constraint admitting only finite doubles.
Returns
Constraint<float>
Returns the underlying value.
Parameters
| Name | Type | Description |
|---|---|---|
| input | FiniteFloat |
Returns
float
Admits a finite double, rejecting infinities and
NaN.Parameters
| Name | Type | Description |
|---|---|---|
| value | float |
Returns
Result<FiniteFloat, Violation>
Returns the finite value, or
None when it is infinite or NaN.Parameters
| Name | Type | Description |
|---|---|---|
| value | float |
Returns
FiniteFloat option
Negates the value. Total — negation cannot leave the finite range.
Parameters
| Name | Type | Description |
|---|---|---|
| input | FiniteFloat |
Returns
FiniteFloat
Returns the magnitude. Total —
abs cannot leave the finite range.Parameters
| Name | Type | Description |
|---|---|---|
| input | FiniteFloat |
Returns
FiniteFloat
Returns the smaller value. Total, and meaningful because ordering is lawful.
Parameters
| Name | Type | Description |
|---|---|---|
| left | FiniteFloat | |
| right | FiniteFloat |
Returns
FiniteFloat
Returns the larger value. Total, and meaningful because ordering is lawful.
Parameters
| Name | Type | Description |
|---|---|---|
| left | FiniteFloat | |
| right | FiniteFloat |
Returns
FiniteFloat
Compares two finite doubles. Total and lawful, unlike comparison on
float.Parameters
| Name | Type | Description |
|---|---|---|
| left | FiniteFloat | |
| right | FiniteFloat |
Returns
int
Returns the arithmetic mean. Computed by dividing before summing, so a list whose
total would overflow still averages successfully.
Parameters
| Name | Type | Description |
|---|---|---|
| values | NonEmptyList<FiniteFloat> |
Returns
Result<FiniteFloat, Violation>
Totals a non-empty list, failing when the total leaves the finite range.
Parameters
| Name | Type | Description |
|---|---|---|
| values | NonEmptyList<FiniteFloat> |
Returns
Result<FiniteFloat, Violation>
Returns the smallest value. Total, because ordering is lawful.
Parameters
| Name | Type | Description |
|---|---|---|
| values | NonEmptyList<FiniteFloat> |
Returns
FiniteFloat