Average Error: 37.9 → 0.5
Time: 23.0s
Precision: 64
$\frac{\sin \left(x + h\right) - \sin x}{h}$
$\frac{\left(\cos h \cdot \sin x - \sin x\right) + \cos x \cdot \sin h}{h}$
\frac{\sin \left(x + h\right) - \sin x}{h}
\frac{\left(\cos h \cdot \sin x - \sin x\right) + \cos x \cdot \sin h}{h}
double f(double x, double h) {
double r5564505 = x;
double r5564506 = h;
double r5564507 = r5564505 + r5564506;
double r5564508 = sin(r5564507);
double r5564509 = sin(r5564505);
double r5564510 = r5564508 - r5564509;
double r5564511 = r5564510 / r5564506;
return r5564511;
}


double f(double x, double h) {
double r5564512 = h;
double r5564513 = cos(r5564512);
double r5564514 = x;
double r5564515 = sin(r5564514);
double r5564516 = r5564513 * r5564515;
double r5564517 = r5564516 - r5564515;
double r5564518 = cos(r5564514);
double r5564519 = sin(r5564512);
double r5564520 = r5564518 * r5564519;
double r5564521 = r5564517 + r5564520;
double r5564522 = r5564521 / r5564512;
return r5564522;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 37.9

$\frac{\sin \left(x + h\right) - \sin x}{h}$
2. Using strategy rm
3. Applied sin-sum22.7

$\leadsto \frac{\color{blue}{\left(\sin x \cdot \cos h + \cos x \cdot \sin h\right)} - \sin x}{h}$
4. Applied associate--l+22.7

$\leadsto \frac{\color{blue}{\sin x \cdot \cos h + \left(\cos x \cdot \sin h - \sin x\right)}}{h}$
5. Using strategy rm
6. Applied *-un-lft-identity22.7

$\leadsto \frac{\sin x \cdot \cos h + \left(\cos x \cdot \sin h - \sin x\right)}{\color{blue}{1 \cdot h}}$
7. Applied associate-/r*22.7

$\leadsto \color{blue}{\frac{\frac{\sin x \cdot \cos h + \left(\cos x \cdot \sin h - \sin x\right)}{1}}{h}}$
8. Simplified0.5

$\leadsto \frac{\color{blue}{\left(\sin x \cdot \cos h - \sin x\right) + \cos x \cdot \sin h}}{h}$
9. Final simplification0.5

$\leadsto \frac{\left(\cos h \cdot \sin x - \sin x\right) + \cos x \cdot \sin h}{h}$

# Reproduce

herbie shell --seed 1
(FPCore (x h)
:name "(sin(x+h)-sin(x))/h"
(/ (- (sin (+ x h)) (sin x)) h))