Average Error: 0.1 → 0.1
Time: 14.8s
Precision: binary64
Cost: 58880
\[\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| \]
\[\left|\mathsf{fma}\left(\sin \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right), eh \cdot \left(-\sin t\right), \frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{eh}{\frac{ew}{\tan t}}\right)}\right)\right| \]
(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
 (fabs
  (fma
   (sin (atan (* eh (/ (tan t) (- ew)))))
   (* eh (- (sin t)))
   (/ (* ew (cos t)) (hypot 1.0 (/ eh (/ ew (tan t))))))))
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) {
	return fabs(fma(sin(atan((eh * (tan(t) / -ew)))), (eh * -sin(t)), ((ew * cos(t)) / hypot(1.0, (eh / (ew / tan(t)))))));
}
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)
	return abs(fma(sin(atan(Float64(eh * Float64(tan(t) / Float64(-ew))))), Float64(eh * Float64(-sin(t))), Float64(Float64(ew * cos(t)) / hypot(1.0, Float64(eh / Float64(ew / tan(t)))))))
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_] := N[Abs[N[(N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(eh * (-N[Sin[t], $MachinePrecision])), $MachinePrecision] + N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $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|
\left|\mathsf{fma}\left(\sin \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right), eh \cdot \left(-\sin t\right), \frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{eh}{\frac{ew}{\tan t}}\right)}\right)\right|

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(\sin \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right), \left(-eh\right) \cdot \sin t, \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right)\right)\right|} \]
  3. Applied egg-rr0.1

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

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

Alternatives

Alternative 1
Error0.2
Cost52544
\[\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot \left(-eh\right)}{ew}\right)\right| \]
Alternative 2
Error0.9
Cost46080
\[\left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot t}{ew}\right)\right| \]
Alternative 3
Error1.2
Cost32896
\[\left|ew \cdot \cos t - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(-t \cdot \frac{eh}{ew}\right)\right| \]
Alternative 4
Error13.6
Cost32640
\[\left|\mathsf{hypot}\left(ew, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(t \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
Alternative 5
Error16.7
Cost27080
\[\begin{array}{l} t_1 := \left|\sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right)\right|\\ \mathbf{if}\;t \leq -213745.83274192974:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 5.405554412989323 \cdot 10^{-6}:\\ \;\;\;\;\left|ew - \sin \tan^{-1} \left(-t \cdot \frac{eh}{ew}\right) \cdot \left(eh \cdot t + -0.16666666666666666 \cdot \left(eh \cdot {t}^{3}\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error16.7
Cost26504
\[\begin{array}{l} t_1 := \sin \tan^{-1} \left(-t \cdot \frac{eh}{ew}\right)\\ t_2 := \left|\left(eh \cdot \sin t\right) \cdot t_1\right|\\ \mathbf{if}\;t \leq -213745.83274192974:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 5.405554412989323 \cdot 10^{-6}:\\ \;\;\;\;\left|ew - \left(eh \cdot t\right) \cdot t_1\right|\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error16.7
Cost26504
\[\begin{array}{l} t_1 := \left|\sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right)\right|\\ \mathbf{if}\;t \leq -213745.83274192974:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 5.405554412989323 \cdot 10^{-6}:\\ \;\;\;\;\left|ew - \left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(-t \cdot \frac{eh}{ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error26.1
Cost20616
\[\begin{array}{l} t_1 := t \cdot \frac{eh}{ew}\\ t_2 := \left|ew - \frac{\left(eh \cdot \sin t\right) \cdot t_1}{\mathsf{hypot}\left(1, t_1\right)}\right|\\ \mathbf{if}\;t \leq -5.2493339658005845 \cdot 10^{+23}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.0382349504577836 \cdot 10^{-6}:\\ \;\;\;\;\left|ew - \left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(-t_1\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Error26.1
Cost20616
\[\begin{array}{l} t_1 := t \cdot \frac{eh}{ew}\\ t_2 := \frac{\left(eh \cdot \sin t\right) \cdot t_1}{\mathsf{hypot}\left(1, t_1\right)}\\ \mathbf{if}\;t \leq -5.2493339658005845 \cdot 10^{+23}:\\ \;\;\;\;\left|ew + t_2\right|\\ \mathbf{elif}\;t \leq 1.0382349504577836 \cdot 10^{-6}:\\ \;\;\;\;\left|ew - \left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(-t_1\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew - t_2\right|\\ \end{array} \]
Alternative 10
Error30.1
Cost19968
\[\left|ew - \left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(-t \cdot \frac{eh}{ew}\right)\right| \]
Alternative 11
Error37.3
Cost6464
\[\left|ew\right| \]

Error

Reproduce

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