Average Error: 12.3 → 8.8
Time: 1.2m
Precision: 64
\[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2.0} + {\left(\sin ky\right)}^{2.0}}} \cdot \sin th\]
\[\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\]
\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2.0} + {\left(\sin ky\right)}^{2.0}}} \cdot \sin th
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
double f(double kx, double ky, double th) {
        double r1049119 = ky;
        double r1049120 = sin(r1049119);
        double r1049121 = kx;
        double r1049122 = sin(r1049121);
        double r1049123 = 2.0;
        double r1049124 = pow(r1049122, r1049123);
        double r1049125 = pow(r1049120, r1049123);
        double r1049126 = r1049124 + r1049125;
        double r1049127 = sqrt(r1049126);
        double r1049128 = r1049120 / r1049127;
        double r1049129 = th;
        double r1049130 = sin(r1049129);
        double r1049131 = r1049128 * r1049130;
        return r1049131;
}

double f(double kx, double ky, double th) {
        double r1049132 = ky;
        double r1049133 = sin(r1049132);
        double r1049134 = th;
        double r1049135 = sin(r1049134);
        double r1049136 = kx;
        double r1049137 = sin(r1049136);
        double r1049138 = hypot(r1049133, r1049137);
        double r1049139 = r1049135 / r1049138;
        double r1049140 = r1049133 * r1049139;
        return r1049140;
}

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

    \[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2.0} + {\left(\sin ky\right)}^{2.0}}} \cdot \sin th\]
  2. Taylor expanded around inf 12.3

    \[\leadsto \frac{\sin ky}{\color{blue}{\sqrt{{\left(\sin ky\right)}^{2} + {\left(\sin kx\right)}^{2}}}} \cdot \sin th\]
  3. Simplified8.8

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

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

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

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

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

Reproduce

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