Discord is now Scala’s main chat platform. Please join us at https://discord.com/invite/scala
Is there a way to constrain a Double
to "just smaller than 1.0" such that (aDouble * aPositiveInt).toInt < aPositiveInt
is guaranteed to hold? I.e. I don't want to perform that check after each multiplication. Like I can empircally get a very long literal:
assert (0.999999999999999944488848768742172978818416595 < 1)
assert ((0.999999999999999944488848768742172978818416595 * Int.MaxValue).toInt < Int.MaxValue)
But I wasn't patient enough to keep looking for the digits (seems there are more)
I'm writing a typeclass that should have an instance for a type refinement (using shapelss' Aux
trick). However, I keep on getting this kind of compiler error when trying to instantiate the extension ops:
<console>:21: error: inferred kinds of the type arguments (Int,Int,res1.F[a],res1.O[k],res
1.U) do not conform to the expected kinds of the type parameters (type K,type V,type F,typ
e O,type U).
res1.F[a]'s type parameters do not match type F's expected parameters:
type F has one type parameter, but type F has one, res1.O[k]'s type parameters do not matc
h type O's expected parameters:
type O has one type parameter, but type O has one
Series.Indexable.ops.toAllIndexableOps(res1)
^
It seems nonsensical to me. Anybody got ideas how to fix this?
Series.Indexable.ops.toAllIndexableOps(res1)