Average Error: 12.2 → 8.8
Time: 47.7s
Precision: 64
\[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\]
\[\sin ky \cdot \left(\frac{1}{\mathsf{hypot}\left(\left(\sin kx\right), \left(\sin ky\right)\right)} \cdot \sin th\right)\]
\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th
\sin ky \cdot \left(\frac{1}{\mathsf{hypot}\left(\left(\sin kx\right), \left(\sin ky\right)\right)} \cdot \sin th\right)
double f(double kx, double ky, double th) {
        double r1078963 = ky;
        double r1078964 = sin(r1078963);
        double r1078965 = kx;
        double r1078966 = sin(r1078965);
        double r1078967 = 2.0;
        double r1078968 = pow(r1078966, r1078967);
        double r1078969 = pow(r1078964, r1078967);
        double r1078970 = r1078968 + r1078969;
        double r1078971 = sqrt(r1078970);
        double r1078972 = r1078964 / r1078971;
        double r1078973 = th;
        double r1078974 = sin(r1078973);
        double r1078975 = r1078972 * r1078974;
        return r1078975;
}

double f(double kx, double ky, double th) {
        double r1078976 = ky;
        double r1078977 = sin(r1078976);
        double r1078978 = 1.0;
        double r1078979 = kx;
        double r1078980 = sin(r1078979);
        double r1078981 = hypot(r1078980, r1078977);
        double r1078982 = r1078978 / r1078981;
        double r1078983 = th;
        double r1078984 = sin(r1078983);
        double r1078985 = r1078982 * r1078984;
        double r1078986 = r1078977 * r1078985;
        return r1078986;
}

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

    \[\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.7

    \[\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.7

    \[\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. Using strategy rm
  8. Applied associate-*l*8.8

    \[\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)}\]
  9. Final simplification8.8

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

Reproduce

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