Average Error: 3.8 → 2.9
Time: 13.2s
Precision: binary64
\[\]
\[\]
double code(double kx, double ky, double th) {
	return ((double) (((double) (((double) sin(ky)) / ((double) sqrt(((double) (((double) pow(((double) sin(kx)), 2.0)) + ((double) pow(((double) sin(ky)), 2.0)))))))) * ((double) sin(th))));
}
double code(double kx, double ky, double th) {
	double VAR;
	if ((((double) (((double) sin(ky)) / ((double) sqrt(((double) (((double) pow(((double) sin(kx)), 2.0)) + ((double) pow(((double) sin(ky)), 2.0)))))))) <= 0.9999999999719434)) {
		VAR = ((double) (((double) (1.0 / ((double) (((double) sqrt(((double) (((double) pow(((double) sin(kx)), 2.0)) + ((double) pow(((double) sin(ky)), 2.0)))))) / ((double) sin(ky)))))) * ((double) sin(th))));
	} else {
		VAR = ((double) (((double) sin(th)) * ((double) (1.0 + ((double) (kx * ((double) (kx * -0.16666666666666666))))))));
	}
	return VAR;
}

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. Split input into 2 regimes
  2. if (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) < 0.999999999971943443

    1. Initial program 2.5

      \[\]
    2. Using strategy rm
    3. Applied clear-num2.5

      \[\leadsto \]

    if 0.999999999971943443 < (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))

    1. Initial program 9.0

      \[\]
    2. Using strategy rm
    3. Applied clear-num9.0

      \[\leadsto \]
    4. Taylor expanded around 0 4.3

      \[\leadsto \]
    5. Simplified4.3

      \[\leadsto \]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.9

    \[\leadsto \]

Reproduce

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