gradient checked against FD