Average Error: 12.2 → 8.5
Time: 32.1s
Precision: 64
\[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\]
\[\frac{\sin ky}{\frac{\mathsf{hypot}\left(\left(\sin kx\right), \left(\sin ky\right)\right)}{\sin th}}\]
\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th
\frac{\sin ky}{\frac{\mathsf{hypot}\left(\left(\sin kx\right), \left(\sin ky\right)\right)}{\sin th}}
double f(double kx, double ky, double th) {
        double r537794 = ky;
        double r537795 = sin(r537794);
        double r537796 = kx;
        double r537797 = sin(r537796);
        double r537798 = 2.0;
        double r537799 = pow(r537797, r537798);
        double r537800 = pow(r537795, r537798);
        double r537801 = r537799 + r537800;
        double r537802 = sqrt(r537801);
        double r537803 = r537795 / r537802;
        double r537804 = th;
        double r537805 = sin(r537804);
        double r537806 = r537803 * r537805;
        return r537806;
}

double f(double kx, double ky, double th) {
        double r537807 = ky;
        double r537808 = sin(r537807);
        double r537809 = kx;
        double r537810 = sin(r537809);
        double r537811 = hypot(r537810, r537808);
        double r537812 = th;
        double r537813 = sin(r537812);
        double r537814 = r537811 / r537813;
        double r537815 = r537808 / r537814;
        return r537815;
}

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

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

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

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

    \[\leadsto \color{blue}{\left(\sin ky \cdot \frac{1}{\mathsf{hypot}\left(\left(\sin kx\right), \left(\sin ky\right)\right)}\right)} \cdot \sin th\]
  7. Applied associate-*l*8.7

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

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

    \[\leadsto \sin ky \cdot \frac{\sin th}{\color{blue}{\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\mathsf{hypot}\left(\left(\sin kx\right), \left(\sin ky\right)\right)\right)\right)\right)\right)}}\]
  11. Using strategy rm
  12. Applied *-un-lft-identity8.6

    \[\leadsto \color{blue}{\left(1 \cdot \sin ky\right)} \cdot \frac{\sin th}{\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\mathsf{hypot}\left(\left(\sin kx\right), \left(\sin ky\right)\right)\right)\right)\right)\right)}\]
  13. Applied associate-*l*8.6

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

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

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

Reproduce

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