Average Error: 12.2 → 8.5
Time: 9.4s
Precision: 64
\[\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th\right)\right)\]
\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th\right)\right)
double f(double kx, double ky, double th) {
        double r33208 = ky;
        double r33209 = sin(r33208);
        double r33210 = kx;
        double r33211 = sin(r33210);
        double r33212 = 2.0;
        double r33213 = pow(r33211, r33212);
        double r33214 = pow(r33209, r33212);
        double r33215 = r33213 + r33214;
        double r33216 = sqrt(r33215);
        double r33217 = r33209 / r33216;
        double r33218 = th;
        double r33219 = sin(r33218);
        double r33220 = r33217 * r33219;
        return r33220;
}

double f(double kx, double ky, double th) {
        double r33221 = ky;
        double r33222 = sin(r33221);
        double r33223 = kx;
        double r33224 = sin(r33223);
        double r33225 = hypot(r33222, r33224);
        double r33226 = r33222 / r33225;
        double r33227 = th;
        double r33228 = sin(r33227);
        double r33229 = r33226 * r33228;
        double r33230 = expm1(r33229);
        double r33231 = log1p(r33230);
        return r33231;
}

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. Taylor expanded around inf 12.2

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

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

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

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

Reproduce

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