`Guest00000 2017-03-08 13:51:18
so
`Guest00000 2017-03-08 13:51:32
i just tested it
`Guest00000 2017-03-08 13:51:43
and, as https://mail.haskell.org/pipermail/haskell-cafe/2008-January/038022.html says, those are slow
`Guest00000 2017-03-08 13:52:34
int2Double . double2Int is faster
`Guest00000 2017-03-08 13:52:43
but it's non-portable
glguy 2017-03-08 13:57:35
`Guest00000: You get that for free after optimizations
glguy 2017-03-08 13:57:39
test :: Double -> Double; test x = fromIntegral (truncate x :: Int) -- compiles to
glguy 2017-03-08 13:58:09
\x -> case x of D# y -> D# (int2Double# (double2Int# y))
`Guest00000 2017-03-08 13:58:30
that brings me to the question of how explicit the optimizations should be
`Guest00000 2017-03-08 13:58:38
because implicit = unreliable
robkennedy 2017-03-08 13:59:19
Man, `snd . properFraction` ought to be optimal. You could submit a PR to make `properFraction = (,) <$> intToDouble . doubleToInt <*> (\x -> x - doubleToInt x)`
glguy 2017-03-08 13:59:48
robkennedy: that's already what it is
glguy 2017-03-08 13:59:53
if you specify Int
`Guest00000 2017-03-08 14:00:16
ohh
`Guest00000 2017-03-08 14:09:17
ok
`Guest00000 2017-03-08 14:09:20
thanks for replies
`Guest00000 2017-03-08 14:10:44
it's awful that by default fromIntegral . truncate will specialize to Integer and be slower
hpc 2017-03-08 14:12:01
something for HaskellPrime maybe?
`Guest00000 2017-03-08 14:19:04
but still
`Guest00000 2017-03-08 14:19:18
frac :: Double -> Double isn't even in prelude