Average Error: 0.1 → 0.1
Time: 19.5s
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|\cos \tan^{-1} \left(\frac{eh}{ew} \cdot \tan t\right) \cdot \left(ew \cdot \cos t\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\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
  (-
   (* (cos (atan (* (/ eh ew) (tan t)))) (* ew (cos t)))
   (* (* eh (sin t)) (sin (atan (/ (* eh (- (tan t))) ew)))))))
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(((cos(atan(((eh / ew) * tan(t)))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((eh * -tan(t)) / ew))))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs((((ew * cos(t)) * cos(atan(((-eh * tan(t)) / ew)))) - ((eh * sin(t)) * sin(atan(((-eh * tan(t)) / ew))))))
end function
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs(((cos(atan(((eh / ew) * tan(t)))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((eh * -tan(t)) / ew))))))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs((((ew * Math.cos(t)) * Math.cos(Math.atan(((-eh * Math.tan(t)) / ew)))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((-eh * Math.tan(t)) / ew))))));
}
public static double code(double eh, double ew, double t) {
	return Math.abs(((Math.cos(Math.atan(((eh / ew) * Math.tan(t)))) * (ew * Math.cos(t))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * -Math.tan(t)) / ew))))));
}
def code(eh, ew, t):
	return math.fabs((((ew * math.cos(t)) * math.cos(math.atan(((-eh * math.tan(t)) / ew)))) - ((eh * math.sin(t)) * math.sin(math.atan(((-eh * math.tan(t)) / ew))))))
def code(eh, ew, t):
	return math.fabs(((math.cos(math.atan(((eh / ew) * math.tan(t)))) * (ew * math.cos(t))) - ((eh * math.sin(t)) * math.sin(math.atan(((eh * -math.tan(t)) / ew))))))
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(Float64(Float64(cos(atan(Float64(Float64(eh / ew) * tan(t)))) * Float64(ew * cos(t))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(eh * Float64(-tan(t))) / ew))))))
end
function tmp = code(eh, ew, t)
	tmp = abs((((ew * cos(t)) * cos(atan(((-eh * tan(t)) / ew)))) - ((eh * sin(t)) * sin(atan(((-eh * tan(t)) / ew))))));
end
function tmp = code(eh, ew, t)
	tmp = abs(((cos(atan(((eh / ew) * tan(t)))) * (ew * cos(t))) - ((eh * sin(t)) * sin(atan(((eh * -tan(t)) / ew))))));
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[(N[Cos[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] * N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(ew * N[Cos[t], $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]
\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|\cos \tan^{-1} \left(\frac{eh}{ew} \cdot \tan t\right) \cdot \left(ew \cdot \cos t\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right)\right|

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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. Applied egg-rr0.1

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

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

Alternatives

Alternative 1
Error0.2
Cost52544
\[\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right) - \frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \tan t\right)}{\cos t}}\right| \]
Alternative 2
Error0.1
Cost52544
\[\left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \tan t\right)} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right)\right| \]
Alternative 3
Error0.7
Cost46144
\[\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \tan t\right)}{\cos t}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right| \]
Alternative 4
Error0.6
Cost46144
\[\left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \tan t\right)} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right| \]
Alternative 5
Error0.9
Cost46080
\[\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \tan t\right)}{\cos t}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{t}{ew}\right)\right| \]
Alternative 6
Error1.0
Cost39296
\[\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right) - ew \cdot \cos t\right| \]
Alternative 7
Error1.0
Cost39232
\[\left|ew \cdot \cos t - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew} \cdot \tan t\right)\right| \]
Alternative 8
Error1.1
Cost32896
\[\left|ew \cdot \cos t - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right)\right| \]
Alternative 9
Error12.9
Cost32640
\[\left|\mathsf{hypot}\left(ew, \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(eh \cdot \frac{t}{ew}\right)\right)\right)\right| \]
Alternative 10
Error15.9
Cost26504
\[\begin{array}{l} t_1 := \left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{-t}{ew}\right)\right|\\ \mathbf{if}\;t \leq -0.0001507496142533122:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 5.562347842229099 \cdot 10^{-14}:\\ \;\;\;\;\left|ew - \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right) \cdot \left(t \cdot eh\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error13.2
Cost26304
\[\left|ew + \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(eh \cdot \frac{t}{ew}\right)\right)\right| \]
Alternative 12
Error28.1
Cost20616
\[\begin{array}{l} t_1 := \left|ew - \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right) \cdot \left(t \cdot eh\right)\right|\\ t_2 := eh \cdot \frac{t}{ew}\\ \mathbf{if}\;eh \leq -1.1175439849540303 \cdot 10^{+118}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;eh \leq 1.481801767075466 \cdot 10^{-81}:\\ \;\;\;\;\left|ew - \frac{\left(eh \cdot \sin t\right) \cdot t_2}{\mathsf{hypot}\left(1, t_2\right)}\right|\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error29.6
Cost19968
\[\left|ew - \sin \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right) \cdot \left(t \cdot eh\right)\right| \]
Alternative 14
Error36.9
Cost6464
\[\left|ew\right| \]

Error

Reproduce

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