_methods
trait _methods
Float Extension Methods
Extension methods universaly avaialble for type scala.Float
- Source
- _methods.scala
Def
@targetName("range")
Range
Range
Returns Float.Range from current to given value
(1F <> 10F).tp // Prints 1.0 <> 10.0
- Source
- _methods.scala
@targetName("rangeX")
Exclusive end range
Exclusive end range
Returns Float.Range from current to given value exclusive
(1F <>> 10F).tp // Prints 1.0 <>> 10.0
- Source
- _methods.scala
@targetName("Opt")
To option
To option
Returns Float.Opt for current value
val o : Float.Opt = 12F.?
- Source
- _methods.scala
Max value
Max value
Returns maximum of current or given value
val v = 5F
v.max(0).tp // Prints 5.0
v.max(10).tp // Prints 10.0
- Source
- _methods.scala
Min value
Min value
Returns minimun of current or given value
val v = 5F
v.min(0).tp // Prints 0.0
v.min(10).tp // Prints 5.0
- Source
- _methods.scala
Round to size
Round to size
Rounds current value to specified size
91F.roundTo(5).tp // Prints 90.0
91F.roundTo(5)(using UP).tp // Prints 95.0
- Source
- _methods.scala
Round to decimal
Round to decimal
Rounds current value to specified decimal position of fractional value
- Source
- _methods.scala