<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"> Hi all,<br><br> I am trying to retrieve the decimal portion of a Double. My code is:<br><br> getDecimal x = x - floor(x)<br><br> I would expect the following:<br><br> Main> getDecimal 1.23<br> 0.23 :: [Double]<br><br> but instead, I get:<br><br> Main> getDecimal 1.23<br> ERROR - Unresolved overloading<br> *** Type : (RealFrac a, Integral a) => a<br> *** Expression : getDecimal 1.23<br><br> I have tried adding "getDecimal :: Double -> Double" but it only causes the following message to appear:<br><br> ERROR file:C:\Documents and Settings\User\file.hs:60 - Instance of Integral Double
required for definition of getDecimal<br><br> How should I define my function so that it'll work? Thanks!<br><br> Regards,<br> Dom<br></td></tr></table><br>