Average Error: 12.6 → 9.1
Time: 33.0s
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(\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\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(\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\right)\right)
double f(double kx, double ky, double th) {
        double r489689 = ky;
        double r489690 = sin(r489689);
        double r489691 = kx;
        double r489692 = sin(r489691);
        double r489693 = 2.0;
        double r489694 = pow(r489692, r489693);
        double r489695 = pow(r489690, r489693);
        double r489696 = r489694 + r489695;
        double r489697 = sqrt(r489696);
        double r489698 = r489690 / r489697;
        double r489699 = th;
        double r489700 = sin(r489699);
        double r489701 = r489698 * r489700;
        return r489701;
}

double f(double kx, double ky, double th) {
        double r489702 = th;
        double r489703 = sin(r489702);
        double r489704 = ky;
        double r489705 = sin(r489704);
        double r489706 = kx;
        double r489707 = sin(r489706);
        double r489708 = hypot(r489705, r489707);
        double r489709 = r489705 / r489708;
        double r489710 = r489703 * r489709;
        double r489711 = log1p(r489710);
        double r489712 = expm1(r489711);
        return r489712;
}

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.6

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

    \[\leadsto \color{blue}{\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity9.0

    \[\leadsto \sin th \cdot \frac{\sin ky}{\color{blue}{1 \cdot \mathsf{hypot}\left(\sin ky, \sin kx\right)}}\]
  5. Applied associate-/r*9.0

    \[\leadsto \sin th \cdot \color{blue}{\frac{\frac{\sin ky}{1}}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}}\]
  6. Simplified9.0

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

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

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

Reproduce

herbie shell --seed 2019153 +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)))