import Examples
import FunctionValues
+-- | We perform addition with the function values contained in a
+-- FunctionValues object. If we choose random doubles near the machine
+-- min/max, we risk overflowing or underflowing the 'Double'. This
+-- places a reasonably safe limit on the maximum size of our generated
+-- 'Double' members.
+max_double :: Double
+max_double = 10000.0
+
+-- | See 'max_double'.
+min_double :: Double
+min_double = (-1) * max_double
+
+
instance Arbitrary FunctionValues where
arbitrary = do
- front' <- arbitrary :: Gen Double
- back' <- arbitrary :: Gen Double
- left' <- arbitrary :: Gen Double
- right' <- arbitrary :: Gen Double
- top' <- arbitrary :: Gen Double
- down' <- arbitrary :: Gen Double
- front_left' <- arbitrary :: Gen Double
- front_right' <- arbitrary :: Gen Double
- front_top' <- arbitrary :: Gen Double
- front_down' <- arbitrary :: Gen Double
- back_left' <- arbitrary :: Gen Double
- back_right' <- arbitrary :: Gen Double
- back_top' <- arbitrary :: Gen Double
- back_down' <- arbitrary :: Gen Double
- left_top' <- arbitrary :: Gen Double
- left_down' <- arbitrary :: Gen Double
- right_top' <- arbitrary :: Gen Double
- right_down' <- arbitrary :: Gen Double
- front_left_top' <- arbitrary :: Gen Double
- front_left_down' <- arbitrary :: Gen Double
- front_right_top' <- arbitrary :: Gen Double
- front_right_down' <- arbitrary :: Gen Double
- back_left_top' <- arbitrary :: Gen Double
- back_left_down' <- arbitrary :: Gen Double
- back_right_top' <- arbitrary :: Gen Double
- back_right_down' <- arbitrary :: Gen Double
- interior' <- arbitrary :: Gen Double
+ front' <- choose (min_double, max_double)
+ back' <- choose (min_double, max_double)
+ left' <- choose (min_double, max_double)
+ right' <- choose (min_double, max_double)
+ top' <- choose (min_double, max_double)
+ down' <- choose (min_double, max_double)
+ front_left' <- choose (min_double, max_double)
+ front_right' <- choose (min_double, max_double)
+ front_top' <- choose (min_double, max_double)
+ front_down' <- choose (min_double, max_double)
+ back_left' <- choose (min_double, max_double)
+ back_right' <- choose (min_double, max_double)
+ back_top' <- choose (min_double, max_double)
+ back_down' <- choose (min_double, max_double)
+ left_top' <- choose (min_double, max_double)
+ left_down' <- choose (min_double, max_double)
+ right_top' <- choose (min_double, max_double)
+ right_down' <- choose (min_double, max_double)
+ front_left_top' <- choose (min_double, max_double)
+ front_left_down' <- choose (min_double, max_double)
+ front_right_top' <- choose (min_double, max_double)
+ front_right_down' <- choose (min_double, max_double)
+ back_left_top' <- choose (min_double, max_double)
+ back_left_down' <- choose (min_double, max_double)
+ back_right_top' <- choose (min_double, max_double)
+ back_right_down' <- choose (min_double, max_double)
+ interior' <- choose (min_double, max_double)
return empty_values { front = front',
back = back',