From 57d32b849157735d03752919adb5e354ff638a31 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Thu, 19 Nov 2009 10:52:20 -0500 Subject: [PATCH] floating: Add remainder functions. --- Data/Floating/Classes.hs | 2 ++ Data/Floating/Double.hs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Data/Floating/Classes.hs b/Data/Floating/Classes.hs index 0256837..2a0bedb 100644 --- a/Data/Floating/Classes.hs +++ b/Data/Floating/Classes.hs @@ -27,6 +27,8 @@ class Floating a => RealFloat a where copysign :: a -> a -> a nextafter :: a -> a -> a atan2 :: a -> a -> a + fmod :: a -> a -> a + frem :: a -> a -> a hypot :: a -> a -> a cbrt :: a -> a exp2 :: a -> a diff --git a/Data/Floating/Double.hs b/Data/Floating/Double.hs index 61e2d32..6e08fdc 100644 --- a/Data/Floating/Double.hs +++ b/Data/Floating/Double.hs @@ -34,6 +34,10 @@ foreign import ccall unsafe "copysign" c_copysign :: CDouble -> CDouble -> CDouble foreign import ccall unsafe "nextafter" c_nextafter :: CDouble -> CDouble -> CDouble +foreign import ccall unsafe "fmod" + c_fmod :: CDouble -> CDouble -> CDouble +foreign import ccall unsafe "remainder" + c_remainder :: CDouble -> CDouble -> CDouble foreign import ccall unsafe "hypot" c_hypot :: CDouble -> CDouble -> CDouble foreign import ccall unsafe "cbrt" @@ -129,6 +133,8 @@ instance Floating Double where instance RealFloat Double where copysign = libmDouble2 c_copysign nextafter = libmDouble2 c_nextafter + fmod = libmDouble2 c_fmod + frem = libmDouble2 c_remainder atan2 = libmDouble2 c_atan2 hypot = libmDouble2 c_hypot cbrt = libmDouble c_cbrt -- 2.11.4.GIT