given_Convertible_WholeNumber_Real
com.phasmidsoftware.number.algebra.eager.WholeNumber.given_Convertible_WholeNumber_Real
object given_Convertible_WholeNumber_Real extends Convertible[WholeNumber, Real]
Represents a given instance of the Convertible typeclass to transform a Real into a WholeNumber, provided the Real value is exact and can be represented as a whole number.
The implementation leverages FP.recover to handle failures gracefully and will throw an AlgebraException if the provided Real cannot be converted into a WholeNumber.
The conversion is only possible if the Real value satisfies the following conditions:
- It is marked as exact.
- Its numerical value can be expressed as an integer.
Attributes
- Returns
-
a
WholeNumberinstance representing the converted value. - Note
-
Throws an com.phasmidsoftware.number.algebra.util.AlgebraException if the input
Realcannot be converted to aWholeNumber. - Graph
-
- Supertypes
- Self type
Members list
In this article