Average Error: 0.1 → 0.1
Time: 17.7s
Precision: binary64
Cost: 58816
\[\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| \]
\[\begin{array}{l} t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \left|\left(ew \cdot \sin t\right) \cdot \cos t_1 + \left(eh \cdot \cos t\right) \cdot \sin t_1\right| \end{array} \]
(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
 (let* ((t_1 (atan (/ (/ eh ew) (tan t)))))
   (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
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) {
	double t_1 = atan(((eh / ew) / tan(t)));
	return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
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 * sin(t)) * cos(atan(((eh / ew) / tan(t))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
end function
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    t_1 = atan(((eh / ew) / tan(t)))
    code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
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) {
	double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
	return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
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):
	t_1 = math.atan(((eh / ew) / math.tan(t)))
	return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
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)
	t_1 = atan(Float64(Float64(eh / ew) / tan(t)))
	return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1))))
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)
	t_1 = atan(((eh / ew) / tan(t)));
	tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
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_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $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|
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t_1 + \left(eh \cdot \cos t\right) \cdot \sin t_1\right|
\end{array}

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. Final simplification0.1

    \[\leadsto \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| \]

Alternatives

Alternative 1
Error0.2
Cost52480
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{\sin t}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}{ew}}\right| \]
Alternative 2
Error0.2
Cost52480
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}{\sin t}}\right| \]
Alternative 3
Error0.1
Cost52480
\[\begin{array}{l} t_1 := \frac{\frac{eh}{ew}}{\tan t}\\ \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t_1 + \frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, t_1\right)}\right| \end{array} \]
Alternative 4
Error0.6
Cost52416
\[\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{t}}{ew}\right)\right| \]
Alternative 5
Error0.9
Cost46856
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ t_2 := t_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \mathbf{if}\;eh \leq -1.5598085721399162 \cdot 10^{+106}:\\ \;\;\;\;\left|t_2 + \frac{\sin t}{\frac{1}{ew}}\right|\\ \mathbf{elif}\;eh \leq -7.277801308770944 \cdot 10^{-254}:\\ \;\;\;\;\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}{\sin t}} + t_1 \cdot \sin \tan^{-1} \left(-0.3333333333333333 \cdot \frac{t \cdot eh}{ew} + \frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \sin t + t_2\right|\\ \end{array} \]
Alternative 6
Error0.9
Cost46856
\[\begin{array}{l} t_1 := eh \cdot \cos t\\ t_2 := ew \cdot \sin t\\ t_3 := \frac{\frac{eh}{ew}}{\tan t}\\ t_4 := t_1 \cdot \sin \tan^{-1} t_3\\ \mathbf{if}\;eh \leq -1.5598085721399162 \cdot 10^{+106}:\\ \;\;\;\;\left|t_4 + \frac{\sin t}{\frac{1}{ew}}\right|\\ \mathbf{elif}\;eh \leq -7.277801308770944 \cdot 10^{-254}:\\ \;\;\;\;\left|\frac{t_2}{\mathsf{hypot}\left(1, t_3\right)} + t_1 \cdot \sin \tan^{-1} \left(-0.3333333333333333 \cdot \frac{t \cdot eh}{ew} + \frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_2 + t_4\right|\\ \end{array} \]
Alternative 7
Error0.9
Cost39232
\[\left|ew \cdot \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
Alternative 8
Error21.4
Cost33544
\[\begin{array}{l} t_1 := \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) - t \cdot \left(t \cdot \frac{ew \cdot ew}{-eh}\right)\right|\\ t_2 := \tan^{-1} \left(\frac{\frac{eh}{t}}{ew}\right)\\ \mathbf{if}\;t \leq -2.3776344618534597 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 15003.335271523165:\\ \;\;\;\;\left|\cos t_2 \cdot \left(ew \cdot t\right) + eh \cdot \sin t_2\right|\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error22.1
Cost33480
\[\begin{array}{l} t_1 := \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t \cdot \left(t \cdot \frac{ew}{\frac{eh}{ew}}\right)\right|\\ t_2 := \tan^{-1} \left(\frac{\frac{eh}{t}}{ew}\right)\\ \mathbf{if}\;t \leq -2.3776344618534597 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 15003.335271523165:\\ \;\;\;\;\left|\cos t_2 \cdot \left(ew \cdot t\right) + eh \cdot \sin t_2\right|\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error22.3
Cost33480
\[\begin{array}{l} t_1 := \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ t_2 := \tan^{-1} \left(\frac{\frac{eh}{t}}{ew}\right)\\ \mathbf{if}\;t \leq -2.3776344618534597 \cdot 10^{-6}:\\ \;\;\;\;\left|t_1 + t \cdot \left(t \cdot \frac{ew}{\frac{eh}{ew}}\right)\right|\\ \mathbf{elif}\;t \leq 15003.335271523165:\\ \;\;\;\;\left|\cos t_2 \cdot \left(ew \cdot t\right) + eh \cdot \sin t_2\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_1 + t \cdot \frac{ew \cdot ew}{\frac{eh}{t}}\right|\\ \end{array} \]
Alternative 11
Error23.4
Cost33352
\[\begin{array}{l} t_1 := \tan^{-1} \left(\frac{\frac{eh}{t}}{ew}\right)\\ t_2 := \sin t_1\\ t_3 := \left|t \cdot \frac{ew \cdot ew}{\frac{eh}{t}} + \left(eh \cdot \cos t\right) \cdot t_2\right|\\ \mathbf{if}\;t \leq -2.3776344618534597 \cdot 10^{-6}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq 15003.335271523165:\\ \;\;\;\;\left|\cos t_1 \cdot \left(ew \cdot t\right) + eh \cdot t_2\right|\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 12
Error32.2
Cost33288
\[\begin{array}{l} t_1 := eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \mathbf{if}\;ew \leq -6.265739841928965 \cdot 10^{+150}:\\ \;\;\;\;\left|ew \cdot \left(ew \cdot \frac{t}{\frac{eh}{t}}\right) + t_1\right|\\ \mathbf{elif}\;ew \leq 1.1962699133897986 \cdot 10^{+58}:\\ \;\;\;\;\left|t \cdot \frac{ew \cdot ew}{\frac{eh}{t}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{t}}{ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t_1 + ew \cdot \frac{ew}{eh \cdot {t}^{-2}}\right|\\ \end{array} \]
Alternative 13
Error32.6
Cost27080
\[\begin{array}{l} t_1 := \left|ew \cdot \left(ew \cdot \frac{t}{\frac{eh}{t}}\right) + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\ \mathbf{if}\;ew \leq -6.265739841928965 \cdot 10^{+150}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;ew \leq 1.9029592474763054 \cdot 10^{-50}:\\ \;\;\;\;\left|t \cdot \frac{ew \cdot ew}{\frac{eh}{t}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{t}}{ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error41.9
Cost26688
\[\left|t \cdot \frac{ew \cdot ew}{\frac{eh}{t}} + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
Alternative 15
Error39.0
Cost26688
\[\left|eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t \cdot \left(ew \cdot \frac{ew}{\frac{eh}{t}}\right)\right| \]
Alternative 16
Error42.9
Cost20288
\[\left|\frac{ew \cdot ew}{\frac{eh}{t \cdot t}} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]

Error

Reproduce

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