Is it true to say that : there are no fractional power units in F#
Absence of literally fractional power
units of measure does not anyhow discounts F# unit facility as it allows presenting seemingly fractional exponent
unit relationships the other way around having smallest fraction as a base dimension:
let takeSqrt (x: float<_>) = sqrt(x)
has inferred signature of float<'u ^ 2> -> float<'u>
this way avoiding introduction of imaginary "naturally fractional" float<'u> -> float<'u^1/2>
.
let moreComplicated (x: float<_>) (y: float<_>) =
sqrt(x*x + y*y*y)
has inferred signature of float<'u ^ 3> -> float<'u ^ 2> -> float<'u ^ 3>
, where all unit measure conversions stay valid relative to some derived implicit base dimension float<'u>
.
The fact that the piece of code below
[]type m
let c = sqrt(1.0)
does not even compile with diagnostics The unit of measure 'm' does not match the unit of measure ''u ^ 2'
can be considered as a blame, or a blessing, but is a clear indication that the unit measure checks are in place.