Average Error: 0.1 → 0.1
Time: 13.3s
Precision: binary64
Cost: 52480
\[\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| \]
\[\left|\sin t \cdot \frac{ew}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
(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
 (fabs
  (+
   (* (sin t) (/ ew (hypot 1.0 (/ eh (* ew (tan t))))))
   (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
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) {
	return fabs(((sin(t) * (ew / hypot(1.0, (eh / (ew * tan(t)))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
public static double code(double eh, double ew, double t) {
	return Math.abs((((ew * Math.sin(t)) * Math.cos(Math.atan(((eh / ew) / Math.tan(t))))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
public static double code(double eh, double ew, double t) {
	return Math.abs(((Math.sin(t) * (ew / Math.hypot(1.0, (eh / (ew * Math.tan(t)))))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t):
	return math.fabs((((ew * math.sin(t)) * math.cos(math.atan(((eh / ew) / math.tan(t))))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
def code(eh, ew, t):
	return math.fabs(((math.sin(t) * (ew / math.hypot(1.0, (eh / (ew * math.tan(t)))))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
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)
	return abs(Float64(Float64(sin(t) * Float64(ew / hypot(1.0, Float64(eh / Float64(ew * tan(t)))))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t)))))))
end
function tmp = code(eh, ew, t)
	tmp = abs((((ew * sin(t)) * cos(atan(((eh / ew) / tan(t))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
end
function tmp = code(eh, ew, t)
	tmp = abs(((sin(t) * (ew / hypot(1.0, (eh / (ew * tan(t)))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
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_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(ew / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $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]
\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|
\left|\sin t \cdot \frac{ew}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\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 \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. Taylor expanded in t around inf 0.1

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

    \[\leadsto \left|\sin t \cdot \color{blue}{\frac{ew}{\mathsf{hypot}\left(1, \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| \]
  4. Final simplification0.1

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

Alternatives

Alternative 1
Error0.9
Cost39232
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \sin t \cdot ew\right| \]
Alternative 2
Error30.6
Cost33480
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ t_2 := \left|\frac{t}{\frac{\frac{eh}{ew \cdot ew}}{t}} + t_1 \cdot \sin \tan^{-1} \left(-0.3333333333333333 \cdot \frac{t \cdot eh}{ew} + \frac{eh}{t \cdot ew}\right)\right|\\ \mathbf{if}\;t \leq -3.6103744757211697 \cdot 10^{+65}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.1337697122434858 \cdot 10^{+125}:\\ \;\;\;\;\left|t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t \cdot \frac{t \cdot ew}{\frac{eh}{ew}}\right|\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error31.2
Cost33472
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t \cdot \left(\left(1 + t \cdot \left(ew \cdot \frac{ew}{eh}\right)\right) + -1\right)\right| \]
Alternative 4
Error31.8
Cost27592
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ t_2 := \frac{eh}{t \cdot ew}\\ t_3 := \left|\frac{t}{\frac{\frac{eh}{ew \cdot ew}}{t}} + t_1 \cdot \sin \tan^{-1} \left(-0.3333333333333333 \cdot \frac{t \cdot eh}{ew} + t_2\right)\right|\\ \mathbf{if}\;t \leq -2.122988341823946 \cdot 10^{+143}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq 1.1337697122434858 \cdot 10^{+125}:\\ \;\;\;\;\left|\frac{t}{\frac{\frac{\frac{eh}{ew}}{ew}}{t}} + t_1 \cdot \sin \tan^{-1} t_2\right|\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 5
Error35.1
Cost26816
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) + \frac{t}{eh} \cdot \left(t \cdot \left(ew \cdot ew\right)\right)\right| \]
Alternative 6
Error35.0
Cost26816
\[\left|\frac{t}{\frac{\frac{eh}{ew \cdot ew}}{t}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right| \]
Alternative 7
Error33.1
Cost26816
\[\left|\frac{t}{\frac{\frac{\frac{eh}{ew}}{ew}}{t}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right| \]
Alternative 8
Error40.6
Cost26688
\[\left|t \cdot \left(t \cdot \left(ew \cdot \frac{ew}{eh}\right)\right) + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]

Error

Reproduce

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