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

Error

Derivation

  1. Initial program 0.1

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

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

Alternatives

Alternative 1
Error0.1
Cost58944
\[\begin{array}{l} t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\ \left|\left(ew \cdot \cos t\right) \cdot \cos t_1 - \left(eh \cdot \sin t\right) \cdot \sin t_1\right| \end{array} \]
Alternative 2
Error0.6
Cost58880
\[\left|\mathsf{fma}\left(eh \cdot \sin t, \sin \tan^{-1} \left(-\frac{t \cdot eh}{ew}\right), \left(-ew\right) \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\tan t \cdot \left(-\frac{eh}{ew}\right)\right)\right)\right)\right| \]
Alternative 3
Error0.6
Cost52544
\[\left|ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\tan t \cdot \left(-\frac{eh}{ew}\right)\right)\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(-\frac{t \cdot eh}{ew}\right)\right| \]
Alternative 4
Error6.6
Cost52480
\[\begin{array}{l} t_1 := \tan^{-1} \left(-\frac{t \cdot eh}{ew}\right)\\ \left|\mathsf{fma}\left(eh \cdot \sin t, \sin t_1, \left(-ew\right) \cdot \left(\cos t \cdot \cos t_1\right)\right)\right| \end{array} \]
Alternative 5
Error6.6
Cost46144
\[\begin{array}{l} t_1 := \tan^{-1} \left(-\frac{t \cdot eh}{ew}\right)\\ \left|\left(ew \cdot \cos t\right) \cdot \cos t_1 - \left(eh \cdot \sin t\right) \cdot \sin t_1\right| \end{array} \]
Alternative 6
Error13.3
Cost46016
\[\left|ew \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(-\frac{t \cdot eh}{ew}\right)\right| \]
Alternative 7
Error14.1
Cost39616
\[\left|ew \cdot \cos \tan^{-1} \left(\frac{eh}{ew} \cdot \left(-t\right)\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(-\frac{t \cdot eh}{ew}\right)\right| \]

Error

Reproduce

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