?

Average Accuracy: 99.8% → 99.8%
Time: 21.3s
Precision: binary64
Cost: 58880

?

\[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
\[\begin{array}{l} t_1 := \frac{eh}{ew \cdot \tan t}\\ \left|\mathsf{fma}\left(ew \cdot \sin t, \frac{1}{\mathsf{hypot}\left(1, t_1\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} t_1\right)\right)\right| \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (+
   (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t)))))
   (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ eh (* ew (tan t)))))
   (fabs
    (fma
     (* ew (sin t))
     (/ 1.0 (hypot 1.0 t_1))
     (* eh (* (cos t) (sin (atan t_1))))))))
double code(double eh, double ew, double t) {
	return fabs((((ew * sin(t)) * cos(atan(((eh / ew) / tan(t))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
double code(double eh, double ew, double t) {
	double t_1 = eh / (ew * tan(t));
	return fabs(fma((ew * sin(t)), (1.0 / hypot(1.0, t_1)), (eh * (cos(t) * sin(atan(t_1))))));
}
function code(eh, ew, t)
	return abs(Float64(Float64(Float64(ew * sin(t)) * cos(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t)))))))
end
function code(eh, ew, t)
	t_1 = Float64(eh / Float64(ew * tan(t)))
	return abs(fma(Float64(ew * sin(t)), Float64(1.0 / hypot(1.0, t_1)), Float64(eh * Float64(cos(t) * sin(atan(t_1))))))
end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] + N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot \tan t}\\
\left|\mathsf{fma}\left(ew \cdot \sin t, \frac{1}{\mathsf{hypot}\left(1, t_1\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} t_1\right)\right)\right|
\end{array}

Error?

Derivation?

  1. Initial program 99.8%

    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  2. Simplified99.8%

    \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right|} \]
    Proof

    [Start]99.8

    \[ \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]

    fma-def [=>]99.8

    \[ \left|\color{blue}{\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right), \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)}\right| \]

    associate-/l/ [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \color{blue}{\left(\frac{eh}{\tan t \cdot ew}\right)}, \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right| \]

    associate-*l* [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), \color{blue}{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)}\right)\right| \]

    associate-/l/ [=>]99.8

    \[ \left|\mathsf{fma}\left(ew \cdot \sin t, \cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), eh \cdot \left(\cos t \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{\tan t \cdot ew}\right)}\right)\right)\right| \]
  3. Applied egg-rr99.8%

    \[\leadsto \left|\mathsf{fma}\left(ew \cdot \sin t, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, \frac{eh}{\tan t \cdot ew}\right)}}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right)\right)\right| \]
  4. Final simplification99.8%

    \[\leadsto \left|\mathsf{fma}\left(ew \cdot \sin t, \frac{1}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}, eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right)\right| \]

Alternatives

Alternative 1
Accuracy99.8%
Cost58816
\[\begin{array}{l} t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \left|\cos t_1 \cdot \left(ew \cdot \sin t\right) + \left(eh \cdot \cos t\right) \cdot \sin t_1\right| \end{array} \]
Alternative 2
Accuracy99.7%
Cost52480
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}{\sin t}}\right| \]
Alternative 3
Accuracy99.7%
Cost52480
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{\sin t}{\frac{\mathsf{hypot}\left(1, \frac{\frac{eh}{\tan t}}{ew}\right)}{ew}}\right| \]
Alternative 4
Accuracy99.1%
Cost52416
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \left(ew \cdot \sin t\right)\right| \]
Alternative 5
Accuracy99.0%
Cost46080
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot t}\right)}{\sin t}}\right| \]
Alternative 6
Accuracy99.0%
Cost46080
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{\sin t}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot t}\right)}{ew}}\right| \]
Alternative 7
Accuracy98.6%
Cost39232
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + ew \cdot \sin t\right| \]
Alternative 8
Accuracy96.7%
Cost33737
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ \mathbf{if}\;ew \leq -1.36 \cdot 10^{-159} \lor \neg \left(ew \leq 4.8 \cdot 10^{-159}\right):\\ \;\;\;\;\left|ew \cdot \sin t + t_1 \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t} + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{1}{0.16666666666666666 \cdot \frac{t}{ew} + \frac{1}{ew \cdot t}}\right|\\ \end{array} \]
Alternative 9
Accuracy96.5%
Cost33609
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ \mathbf{if}\;ew \leq -3.6 \cdot 10^{-160} \lor \neg \left(ew \leq 1.56 \cdot 10^{-161}\right):\\ \;\;\;\;\left|ew \cdot \sin t + t_1 \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t} + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t \cdot \frac{t \cdot \left(ew \cdot ew\right)}{eh}\right|\\ \end{array} \]
Alternative 10
Accuracy90.4%
Cost33481
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ \mathbf{if}\;ew \leq -3.6 \cdot 10^{-160} \lor \neg \left(ew \leq 10^{-250}\right):\\ \;\;\;\;\left|ew \cdot \sin t + t_1 \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t \cdot \frac{t \cdot \left(ew \cdot ew\right)}{eh}\right|\\ \end{array} \]
Alternative 11
Accuracy83.5%
Cost33097
\[\begin{array}{l} \mathbf{if}\;ew \leq -2.05 \cdot 10^{-91} \lor \neg \left(ew \leq 4.9 \cdot 10^{-118}\right):\\ \;\;\;\;\left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + ew \cdot t\right|\\ \end{array} \]
Alternative 12
Accuracy83.0%
Cost32969
\[\begin{array}{l} \mathbf{if}\;ew \leq -3.4 \cdot 10^{-92} \lor \neg \left(ew \leq 3.75 \cdot 10^{-118}\right):\\ \;\;\;\;\left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t \cdot \frac{t \cdot \left(ew \cdot ew\right)}{eh} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \end{array} \]
Alternative 13
Accuracy89.3%
Cost32832
\[\left|ew \cdot \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]
Alternative 14
Accuracy50.6%
Cost27460
\[\begin{array}{l} t_1 := \frac{eh}{ew \cdot t}\\ t_2 := t \cdot \frac{t \cdot \left(ew \cdot ew\right)}{eh}\\ t_3 := eh \cdot \cos t\\ \mathbf{if}\;t \leq -6.5 \cdot 10^{-6}:\\ \;\;\;\;\left|t_3 \cdot \sin \tan^{-1} \left(t_1 + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right) + t_2\right|\\ \mathbf{elif}\;t \leq 0.0116:\\ \;\;\;\;\left|\left(ew \cdot t\right) \cdot \frac{ew}{\frac{eh}{t}} + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_2 + t_3 \cdot \sin \tan^{-1} t_1\right|\\ \end{array} \]
Alternative 15
Accuracy50.2%
Cost27081
\[\begin{array}{l} \mathbf{if}\;t \leq -0.0005 \lor \neg \left(t \leq 0.0116\right):\\ \;\;\;\;\left|t \cdot \frac{t \cdot \left(ew \cdot ew\right)}{eh} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(ew \cdot t\right) \cdot \frac{ew}{\frac{eh}{t}} + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\ \end{array} \]
Alternative 16
Accuracy38.6%
Cost26688
\[\left|eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + ew \cdot \left(ew \cdot \left(t \cdot \frac{t}{eh}\right)\right)\right| \]
Alternative 17
Accuracy39.2%
Cost26688
\[\left|\left(ew \cdot t\right) \cdot \frac{ew}{\frac{eh}{t}} + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
Alternative 18
Accuracy33.8%
Cost20288
\[\left|\frac{ew \cdot ew}{\frac{\frac{eh}{t}}{t}} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]

Error

Reproduce?

herbie shell --seed 2023129 
(FPCore (eh ew t)
  :name "Example from Robby"
  :precision binary64
  (fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))