Average Error: 12.8 → 9.1
Time: 18.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(\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin th\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 ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin th\right)\right)
double f(double kx, double ky, double th) {
        double r38201 = ky;
        double r38202 = sin(r38201);
        double r38203 = kx;
        double r38204 = sin(r38203);
        double r38205 = 2.0;
        double r38206 = pow(r38204, r38205);
        double r38207 = pow(r38202, r38205);
        double r38208 = r38206 + r38207;
        double r38209 = sqrt(r38208);
        double r38210 = r38202 / r38209;
        double r38211 = th;
        double r38212 = sin(r38211);
        double r38213 = r38210 * r38212;
        return r38213;
}

double f(double kx, double ky, double th) {
        double r38214 = ky;
        double r38215 = sin(r38214);
        double r38216 = kx;
        double r38217 = sin(r38216);
        double r38218 = hypot(r38217, r38215);
        double r38219 = r38215 / r38218;
        double r38220 = th;
        double r38221 = sin(r38220);
        double r38222 = r38219 * r38221;
        double r38223 = log1p(r38222);
        double r38224 = expm1(r38223);
        return r38224;
}

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

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

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

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

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

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

Reproduce

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