huitseeker➜huitseeker/tmp/TEst» sbt lint:compile [18:43:17]
[warn] /home/huitseeker/tmp/TEst/src/main/scala/Test.scala:2: Taking the modulo by one will return zero.
[warn] def f(x: Double) = x % 1
[warn] ^
[warn] one warning found
[success] Total time: 3 s, completed Nov 6, 2015 6:43:25 PM
huitseeker➜huitseeker/tmp/TEst» cat src/main/scala/Test.scala [18:43:25]
object Test {
def f(x: Double) = x % 1
}
Taking the modulo by 1 on a float or double is actually a perfectly valid way to take the fractional part.ty o
Note : I assume Division by 1 is guilty of the same problem, but didn't have time to check.
Taking the modulo by 1 on a float or double is actually a perfectly valid way to take the fractional part.ty o
Note : I assume Division by 1 is guilty of the same problem, but didn't have time to check.