I have a question regarding numerical operations in Haskell.
I have a basic function:
derv::(Num a, Fractional a) => (a -> a) -> a -> a -> a
derv f a deltax = ((f (a+deltax))-(f a))/deltax
When I test it, this is the output I get:
*Main> derv (\x->x*x) 2 0.000000000000000001
0.0
*Main> derv (\x->x*x) 2 0.00000000000001
4.085620730620576
*Main> derv (\x->x*x) 2 0.0000000001
4.000000330961484
*Main> derv (\x->x*x) 2 0.0001
4.0001000000078335
*Main>
When the divisor gets smaller, it makes the answer automatically go towards zero, rather than a more refined convergence toward 4. I'm curious as to why this is happening, especially given my type definition.