Average Error: 12.0 → 8.5
Time: 37.5s
Precision: 64
\[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky\right)\right)\]
\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th
\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky\right)\right)
double f(double kx, double ky, double th) {
        double r644764 = ky;
        double r644765 = sin(r644764);
        double r644766 = kx;
        double r644767 = sin(r644766);
        double r644768 = 2.0;
        double r644769 = pow(r644767, r644768);
        double r644770 = pow(r644765, r644768);
        double r644771 = r644769 + r644770;
        double r644772 = sqrt(r644771);
        double r644773 = r644765 / r644772;
        double r644774 = th;
        double r644775 = sin(r644774);
        double r644776 = r644773 * r644775;
        return r644776;
}

double f(double kx, double ky, double th) {
        double r644777 = th;
        double r644778 = sin(r644777);
        double r644779 = kx;
        double r644780 = sin(r644779);
        double r644781 = ky;
        double r644782 = sin(r644781);
        double r644783 = hypot(r644780, r644782);
        double r644784 = r644778 / r644783;
        double r644785 = r644784 * r644782;
        double r644786 = log1p(r644785);
        double r644787 = expm1(r644786);
        return r644787;
}

Error

Bits error versus kx

Bits error versus ky

Bits error versus th

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 12.0

    \[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\]
  2. Simplified8.4

    \[\leadsto \color{blue}{\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt8.7

    \[\leadsto \sin th \cdot \frac{\sin ky}{\color{blue}{\sqrt{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sqrt{\mathsf{hypot}\left(\sin ky, \sin kx\right)}}}\]
  5. Using strategy rm
  6. Applied expm1-log1p-u8.7

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sin th \cdot \frac{\sin ky}{\sqrt{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sqrt{\mathsf{hypot}\left(\sin ky, \sin kx\right)}}\right)\right)}\]
  7. Simplified8.5

    \[\leadsto \mathsf{expm1}\left(\color{blue}{\mathsf{log1p}\left(\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky\right)}\right)\]
  8. Final simplification8.5

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky\right)\right)\]

Reproduce

herbie shell --seed 2019146 +o rules:numerics
(FPCore (kx ky th)
  :name "Toniolo and Linder, Equation (3b), real"
  (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))) (sin th)))