?

Average Accuracy: 99.8% → 99.8%
Time: 16.5s
Precision: binary64
Cost: 65088

?

\[\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 := \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)\\ \left|\mathsf{fma}\left(ew, \sin t \cdot \cos t_1, \left(eh \cdot \cos t\right) \cdot \sin t_1\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 (atan (/ (/ eh (tan t)) ew))))
   (fabs (fma ew (* (sin t) (cos t_1)) (* (* eh (cos t)) (sin 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 = atan(((eh / tan(t)) / ew));
	return fabs(fma(ew, (sin(t) * cos(t_1)), ((eh * cos(t)) * sin(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 = atan(Float64(Float64(eh / tan(t)) / ew))
	return abs(fma(ew, Float64(sin(t) * cos(t_1)), Float64(Float64(eh * cos(t)) * sin(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[ArcTan[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(ew * N[(N[Sin[t], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $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 := \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)\\
\left|\mathsf{fma}\left(ew, \sin t \cdot \cos t_1, \left(eh \cdot \cos t\right) \cdot \sin t_1\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, \sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right), \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\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| \]

    associate-*l* [=>]99.8

    \[ \left|\color{blue}{ew \cdot \left(\sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\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, \sin t \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)}\right| \]

    associate-/l/ [=>]99.8

    \[ \left|\mathsf{fma}\left(ew, \sin t \cdot \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-/r* [=>]99.8

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

    associate-/r* [=>]99.8

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

    \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right), \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\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.0%
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 3
Accuracy98.9%
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 4
Accuracy98.5%
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 5
Accuracy82.5%
Cost32969
\[\begin{array}{l} \mathbf{if}\;ew \leq -3.2 \cdot 10^{-173} \lor \neg \left(ew \leq 9 \cdot 10^{-7}\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{eh}{ew \cdot t}\right) + \frac{ew}{t \cdot 0.16666666666666666 + \frac{1}{t}}\right|\\ \end{array} \]
Alternative 6
Accuracy88.9%
Cost32960
\[\left|\frac{ew}{\frac{1}{\sin t}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]
Alternative 7
Accuracy72.1%
Cost27460
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ t_2 := \frac{eh}{ew \cdot t}\\ t_3 := \frac{ew}{t \cdot 0.16666666666666666 + \frac{1}{t}}\\ \mathbf{if}\;eh \leq 2.9 \cdot 10^{+144}:\\ \;\;\;\;\left|t_3 + t_1 \cdot \sin \tan^{-1} \left(t_2 + -0.3333333333333333 \cdot \frac{t \cdot eh}{ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_1 \cdot \sin \tan^{-1} t_2 + t_3\right|\\ \end{array} \]
Alternative 8
Accuracy59.6%
Cost27213
\[\begin{array}{l} \mathbf{if}\;t \leq -155000 \lor \neg \left(t \leq 1.95 \cdot 10^{-5}\right) \land t \leq 8.6 \cdot 10^{+149}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) + \frac{t \cdot t}{eh} \cdot \left(ew \cdot ew\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{ew}{t \cdot 0.16666666666666666 + \frac{1}{t}} + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\ \end{array} \]
Alternative 9
Accuracy65.6%
Cost26816
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) + \frac{ew}{t \cdot 0.16666666666666666 + \frac{1}{t}}\right| \]
Alternative 10
Accuracy56.1%
Cost26688
\[\left|\frac{ew}{t \cdot 0.16666666666666666 + \frac{1}{t}} + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
Alternative 11
Accuracy32.7%
Cost20288
\[\left|\frac{t \cdot t}{eh} \cdot \left(ew \cdot ew\right) + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]

Error

Reproduce?

herbie shell --seed 2023141 
(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))))))))