Average Error: 34.6 → 6.0
Time: 34.8s
Precision: 64
\[\frac{\left(d \cdot d\right) \cdot \left(theta - \sin theta\right)}{\left(8 \cdot \sin \left(\frac{theta}{2}\right)\right) \cdot \sin \left(\frac{theta}{2}\right)}\]
\[\begin{array}{l} \mathbf{if}\;theta \le -0.06401716498651408016051789218181511387229:\\ \;\;\;\;\frac{d \cdot \left(d \cdot \left(theta - \sin theta\right)\right)}{\left(8 \cdot \sin \left(\frac{theta}{2}\right)\right) \cdot \sin \left(\frac{theta}{2}\right)}\\ \mathbf{elif}\;theta \le 0.006450353995220383350461812455023391521536:\\ \;\;\;\;\left(d \cdot d\right) \cdot \left(0.002777777777777777450107787871047548833303 \cdot {theta}^{3} + 0.08333333333333332870740406406184774823487 \cdot theta\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d \cdot \left(d \cdot \left(theta - \sin theta\right)\right)}{8 \cdot \sin \left(\frac{theta}{2}\right)}}{\sin \left(\frac{theta}{2}\right)}\\ \end{array}\]
\frac{\left(d \cdot d\right) \cdot \left(theta - \sin theta\right)}{\left(8 \cdot \sin \left(\frac{theta}{2}\right)\right) \cdot \sin \left(\frac{theta}{2}\right)}
\begin{array}{l}
\mathbf{if}\;theta \le -0.06401716498651408016051789218181511387229:\\
\;\;\;\;\frac{d \cdot \left(d \cdot \left(theta - \sin theta\right)\right)}{\left(8 \cdot \sin \left(\frac{theta}{2}\right)\right) \cdot \sin \left(\frac{theta}{2}\right)}\\

\mathbf{elif}\;theta \le 0.006450353995220383350461812455023391521536:\\
\;\;\;\;\left(d \cdot d\right) \cdot \left(0.002777777777777777450107787871047548833303 \cdot {theta}^{3} + 0.08333333333333332870740406406184774823487 \cdot theta\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{d \cdot \left(d \cdot \left(theta - \sin theta\right)\right)}{8 \cdot \sin \left(\frac{theta}{2}\right)}}{\sin \left(\frac{theta}{2}\right)}\\

\end{array}
double f(double d, double theta) {
        double r2514257 = d;
        double r2514258 = r2514257 * r2514257;
        double r2514259 = theta;
        double r2514260 = sin(r2514259);
        double r2514261 = r2514259 - r2514260;
        double r2514262 = r2514258 * r2514261;
        double r2514263 = 8.0;
        double r2514264 = 2.0;
        double r2514265 = r2514259 / r2514264;
        double r2514266 = sin(r2514265);
        double r2514267 = r2514263 * r2514266;
        double r2514268 = r2514267 * r2514266;
        double r2514269 = r2514262 / r2514268;
        return r2514269;
}

double f(double d, double theta) {
        double r2514270 = theta;
        double r2514271 = -0.06401716498651408;
        bool r2514272 = r2514270 <= r2514271;
        double r2514273 = d;
        double r2514274 = sin(r2514270);
        double r2514275 = r2514270 - r2514274;
        double r2514276 = r2514273 * r2514275;
        double r2514277 = r2514273 * r2514276;
        double r2514278 = 8.0;
        double r2514279 = 2.0;
        double r2514280 = r2514270 / r2514279;
        double r2514281 = sin(r2514280);
        double r2514282 = r2514278 * r2514281;
        double r2514283 = r2514282 * r2514281;
        double r2514284 = r2514277 / r2514283;
        double r2514285 = 0.006450353995220383;
        bool r2514286 = r2514270 <= r2514285;
        double r2514287 = r2514273 * r2514273;
        double r2514288 = 0.0027777777777777775;
        double r2514289 = 3.0;
        double r2514290 = pow(r2514270, r2514289);
        double r2514291 = r2514288 * r2514290;
        double r2514292 = 0.08333333333333333;
        double r2514293 = r2514292 * r2514270;
        double r2514294 = r2514291 + r2514293;
        double r2514295 = r2514287 * r2514294;
        double r2514296 = r2514277 / r2514282;
        double r2514297 = r2514296 / r2514281;
        double r2514298 = r2514286 ? r2514295 : r2514297;
        double r2514299 = r2514272 ? r2514284 : r2514298;
        return r2514299;
}

Error

Bits error versus d

Bits error versus theta

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if theta < -0.06401716498651408

    1. Initial program 11.1

      \[\frac{\left(d \cdot d\right) \cdot \left(theta - \sin theta\right)}{\left(8 \cdot \sin \left(\frac{theta}{2}\right)\right) \cdot \sin \left(\frac{theta}{2}\right)}\]
    2. Using strategy rm
    3. Applied associate-*l*0.5

      \[\leadsto \frac{\color{blue}{d \cdot \left(d \cdot \left(theta - \sin theta\right)\right)}}{\left(8 \cdot \sin \left(\frac{theta}{2}\right)\right) \cdot \sin \left(\frac{theta}{2}\right)}\]

    if -0.06401716498651408 < theta < 0.006450353995220383

    1. Initial program 51.0

      \[\frac{\left(d \cdot d\right) \cdot \left(theta - \sin theta\right)}{\left(8 \cdot \sin \left(\frac{theta}{2}\right)\right) \cdot \sin \left(\frac{theta}{2}\right)}\]
    2. Taylor expanded around 0 9.9

      \[\leadsto \color{blue}{0.08333333333333332870740406406184774823487 \cdot \left(theta \cdot {d}^{2}\right) + 0.002777777777777777450107787871047548833303 \cdot \left({theta}^{3} \cdot {d}^{2}\right)}\]
    3. Simplified9.9

      \[\leadsto \color{blue}{\left(d \cdot d\right) \cdot \left(0.002777777777777777450107787871047548833303 \cdot {theta}^{3} + 0.08333333333333332870740406406184774823487 \cdot theta\right)}\]

    if 0.006450353995220383 < theta

    1. Initial program 12.1

      \[\frac{\left(d \cdot d\right) \cdot \left(theta - \sin theta\right)}{\left(8 \cdot \sin \left(\frac{theta}{2}\right)\right) \cdot \sin \left(\frac{theta}{2}\right)}\]
    2. Using strategy rm
    3. Applied associate-/r*12.1

      \[\leadsto \color{blue}{\frac{\frac{\left(d \cdot d\right) \cdot \left(theta - \sin theta\right)}{8 \cdot \sin \left(\frac{theta}{2}\right)}}{\sin \left(\frac{theta}{2}\right)}}\]
    4. Using strategy rm
    5. Applied associate-*l*0.5

      \[\leadsto \frac{\frac{\color{blue}{d \cdot \left(d \cdot \left(theta - \sin theta\right)\right)}}{8 \cdot \sin \left(\frac{theta}{2}\right)}}{\sin \left(\frac{theta}{2}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;theta \le -0.06401716498651408016051789218181511387229:\\ \;\;\;\;\frac{d \cdot \left(d \cdot \left(theta - \sin theta\right)\right)}{\left(8 \cdot \sin \left(\frac{theta}{2}\right)\right) \cdot \sin \left(\frac{theta}{2}\right)}\\ \mathbf{elif}\;theta \le 0.006450353995220383350461812455023391521536:\\ \;\;\;\;\left(d \cdot d\right) \cdot \left(0.002777777777777777450107787871047548833303 \cdot {theta}^{3} + 0.08333333333333332870740406406184774823487 \cdot theta\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d \cdot \left(d \cdot \left(theta - \sin theta\right)\right)}{8 \cdot \sin \left(\frac{theta}{2}\right)}}{\sin \left(\frac{theta}{2}\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (d theta)
  :name "d * d * (theta - sin(theta)) / (8 * sin(theta/2) * sin(theta/2))"
  :precision binary64
  (/ (* (* d d) (- theta (sin theta))) (* (* 8 (sin (/ theta 2))) (sin (/ theta 2)))))