Average Error: 0.1 → 0.1
Time: 19.3s
Precision: binary64
Cost: 52544
\[\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|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-\tan t \cdot eh}{ew}\right) - \frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{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
  (-
   (* (* eh (sin t)) (sin (atan (/ (- (* (tan t) eh)) ew))))
   (/ (* ew (cos t)) (hypot 1.0 (* (tan t) (/ eh 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((((eh * sin(t)) * sin(atan((-(tan(t) * eh) / ew)))) - ((ew * cos(t)) / hypot(1.0, (tan(t) * (eh / ew))))));
}
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((((eh * Math.sin(t)) * Math.sin(Math.atan((-(Math.tan(t) * eh) / ew)))) - ((ew * Math.cos(t)) / Math.hypot(1.0, (Math.tan(t) * (eh / 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((((eh * math.sin(t)) * math.sin(math.atan((-(math.tan(t) * eh) / ew)))) - ((ew * math.cos(t)) / math.hypot(1.0, (math.tan(t) * (eh / 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(Float64(eh * sin(t)) * sin(atan(Float64(Float64(-Float64(tan(t) * eh)) / ew)))) - Float64(Float64(ew * cos(t)) / hypot(1.0, Float64(tan(t) * Float64(eh / 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((((eh * sin(t)) * sin(atan((-(tan(t) * eh) / ew)))) - ((ew * cos(t)) / hypot(1.0, (tan(t) * (eh / 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[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[((-N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision]) / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $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|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-\tan t \cdot eh}{ew}\right) - \frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{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-rr26.9

    \[\leadsto \left|\color{blue}{\left(e^{\mathsf{log1p}\left(ew \cdot \frac{\cos t}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}\right)} - 1\right)} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  3. Simplified0.1

    \[\leadsto \left|\color{blue}{\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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    Proof

    [Start]26.9

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

    expm1-def [=>]16.2

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

    expm1-log1p [=>]0.1

    \[ \left|\color{blue}{ew \cdot \frac{\cos t}{\mathsf{hypot}\left(1, eh \cdot \frac{\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| \]

    associate-*r/ [=>]0.1

    \[ \left|\color{blue}{\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, eh \cdot \frac{\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| \]

    associate-*r/ [=>]0.1

    \[ \left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \color{blue}{\frac{eh \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| \]

    *-commutative [<=]0.1

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

    associate-*r/ [<=]0.1

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

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

Alternatives

Alternative 1
Error5.6
Cost52808
\[\begin{array}{l} t_1 := \frac{\tan t}{ew}\\ t_2 := ew \cdot \cos t\\ t_3 := \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\\ t_4 := t_2 \cdot \cos t_3\\ \mathbf{if}\;eh \leq -4.25 \cdot 10^{-187}:\\ \;\;\;\;\left|t_4 - eh \cdot \left(\sin t \cdot \sin t_3\right)\right|\\ \mathbf{elif}\;eh \leq 2.15 \cdot 10^{-156}:\\ \;\;\;\;\left|t_2 \cdot \cos \tan^{-1} \left(\frac{1}{eh} \cdot \left(\left(eh \cdot eh\right) \cdot t_1\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_4 - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot t_1\right)\right)\right|\\ \end{array} \]
Alternative 2
Error5.6
Cost46409
\[\begin{array}{l} t_1 := \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\\ t_2 := ew \cdot \cos t\\ \mathbf{if}\;eh \leq -2.25 \cdot 10^{-186} \lor \neg \left(eh \leq 9 \cdot 10^{-155}\right):\\ \;\;\;\;\left|t_2 \cdot \cos t_1 - eh \cdot \left(\sin t \cdot \sin t_1\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_2 \cdot \cos \tan^{-1} \left(\frac{1}{eh} \cdot \left(\left(eh \cdot eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right|\\ \end{array} \]
Alternative 3
Error8.5
Cost40392
\[\begin{array}{l} t_1 := t \cdot \frac{eh}{ew}\\ t_2 := ew \cdot \cos t\\ t_3 := \left|t_2 \cdot \cos \tan^{-1} \left(eh \cdot \frac{1}{\frac{ew \cdot \frac{eh}{\tan t}}{eh}}\right)\right|\\ t_4 := \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\\ \mathbf{if}\;ew \leq -3.2 \cdot 10^{+161}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;ew \leq -1.2 \cdot 10^{-16}:\\ \;\;\;\;\left|t_2 \cdot \cos t_4 - \frac{eh}{\mathsf{hypot}\left(1, t_1\right)} \cdot \left(\sin t \cdot t_1\right)\right|\\ \mathbf{elif}\;ew \leq 1.6 \cdot 10^{+108}:\\ \;\;\;\;\left|ew \cdot \cos \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right) - eh \cdot \left(\sin t \cdot \sin t_4\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 4
Error8.6
Cost39881
\[\begin{array}{l} \mathbf{if}\;eh \leq -1.35 \cdot 10^{-10} \lor \neg \left(eh \leq 3.9 \cdot 10^{-100}\right):\\ \;\;\;\;\left|ew \cdot \cos \tan^{-1} \left(\frac{eh \cdot \left(-t\right)}{ew}\right) - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{1}{eh} \cdot \left(\left(eh \cdot eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right|\\ \end{array} \]
Alternative 5
Error24.8
Cost32640
\[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right| \]
Alternative 6
Error25.0
Cost26368
\[\left|\left(ew \cdot \cos t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}\right| \]
Alternative 7
Error25.0
Cost26240
\[\left|\frac{\cos t}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{ew}}\right| \]
Alternative 8
Error25.0
Cost26240
\[\left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right| \]
Alternative 9
Error37.2
Cost6464
\[\left|ew\right| \]

Error

Reproduce

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