
(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) {
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
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) {
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): 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) 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) 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_] := 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]]
\begin{array}{l}
\\
\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}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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) {
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
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) {
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): 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) 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) 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_] := 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]]
\begin{array}{l}
\\
\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}
\end{array}
(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) {
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
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) {
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): 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) 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) 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_] := 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]]
\begin{array}{l}
\\
\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}
\end{array}
Initial program 99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(+
(* (* eh (cos t)) (sin (atan t_1)))
(/ (* ew (sin t)) (hypot 1.0 t_1))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / tan(t);
return fabs((((eh * cos(t)) * sin(atan(t_1))) + ((ew * sin(t)) / hypot(1.0, t_1))));
}
public static double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / Math.tan(t);
return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(t_1))) + ((ew * Math.sin(t)) / Math.hypot(1.0, t_1))));
}
def code(eh, ew, t): t_1 = (eh / ew) / math.tan(t) return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(t_1))) + ((ew * math.sin(t)) / math.hypot(1.0, t_1))))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(t_1))) + Float64(Float64(ew * sin(t)) / hypot(1.0, t_1)))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs((((eh * cos(t)) * sin(atan(t_1))) + ((ew * sin(t)) / hypot(1.0, t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\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}
\end{array}
Initial program 99.8%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (* ew (sin t)) (cos (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t)))))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + ((ew * Math.sin(t)) * Math.cos(Math.atan((eh / (ew * t)))))));
}
def code(eh, ew, t): return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + ((ew * math.sin(t)) * math.cos(math.atan((eh / (ew * t)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(Float64(ew * sin(t)) * cos(atan(Float64(eh / Float64(ew * t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (ew * t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(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] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\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{eh}{ew \cdot t}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 99.1%
Final simplification99.1%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (sin t)) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
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)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.sin(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)) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * sin(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)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $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]
\begin{array}{l}
\\
\left|ew \cdot \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf 98.8%
(FPCore (eh ew t)
:precision binary64
(if (<= t -0.004)
(sqrt (pow (* ew (sin t)) 2.0))
(if (<= t 2.1e+20)
(fabs (+ (* ew t) (* eh (sin (atan (/ eh (* ew (tan t))))))))
(pow (sqrt (* ew (sqrt (pow (sin t) 2.0)))) 2.0))))
double code(double eh, double ew, double t) {
double tmp;
if (t <= -0.004) {
tmp = sqrt(pow((ew * sin(t)), 2.0));
} else if (t <= 2.1e+20) {
tmp = fabs(((ew * t) + (eh * sin(atan((eh / (ew * tan(t))))))));
} else {
tmp = pow(sqrt((ew * sqrt(pow(sin(t), 2.0)))), 2.0);
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-0.004d0)) then
tmp = sqrt(((ew * sin(t)) ** 2.0d0))
else if (t <= 2.1d+20) then
tmp = abs(((ew * t) + (eh * sin(atan((eh / (ew * tan(t))))))))
else
tmp = sqrt((ew * sqrt((sin(t) ** 2.0d0)))) ** 2.0d0
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (t <= -0.004) {
tmp = Math.sqrt(Math.pow((ew * Math.sin(t)), 2.0));
} else if (t <= 2.1e+20) {
tmp = Math.abs(((ew * t) + (eh * Math.sin(Math.atan((eh / (ew * Math.tan(t))))))));
} else {
tmp = Math.pow(Math.sqrt((ew * Math.sqrt(Math.pow(Math.sin(t), 2.0)))), 2.0);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if t <= -0.004: tmp = math.sqrt(math.pow((ew * math.sin(t)), 2.0)) elif t <= 2.1e+20: tmp = math.fabs(((ew * t) + (eh * math.sin(math.atan((eh / (ew * math.tan(t)))))))) else: tmp = math.pow(math.sqrt((ew * math.sqrt(math.pow(math.sin(t), 2.0)))), 2.0) return tmp
function code(eh, ew, t) tmp = 0.0 if (t <= -0.004) tmp = sqrt((Float64(ew * sin(t)) ^ 2.0)); elseif (t <= 2.1e+20) tmp = abs(Float64(Float64(ew * t) + Float64(eh * sin(atan(Float64(eh / Float64(ew * tan(t)))))))); else tmp = sqrt(Float64(ew * sqrt((sin(t) ^ 2.0)))) ^ 2.0; end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (t <= -0.004) tmp = sqrt(((ew * sin(t)) ^ 2.0)); elseif (t <= 2.1e+20) tmp = abs(((ew * t) + (eh * sin(atan((eh / (ew * tan(t)))))))); else tmp = sqrt((ew * sqrt((sin(t) ^ 2.0)))) ^ 2.0; end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[t, -0.004], N[Sqrt[N[Power[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 2.1e+20], N[Abs[N[(N[(ew * t), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Power[N[Sqrt[N[(ew * N[Sqrt[N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.004:\\
\;\;\;\;\sqrt{{\left(ew \cdot \sin t\right)}^{2}}\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{+20}:\\
\;\;\;\;\left|ew \cdot t + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{ew \cdot \sqrt{{\sin t}^{2}}}\right)}^{2}\\
\end{array}
\end{array}
if t < -0.0040000000000000001Initial program 99.5%
add-cbrt-cube99.3%
pow399.3%
Applied egg-rr99.3%
Applied egg-rr43.3%
Taylor expanded in ew around inf 19.9%
unpow219.9%
sqrt-unprod30.0%
pow230.0%
Applied egg-rr30.0%
if -0.0040000000000000001 < t < 2.1e20Initial program 100.0%
cos-atan100.0%
un-div-inv100.0%
hypot-1-def100.0%
Applied egg-rr100.0%
Taylor expanded in ew around inf 99.4%
add-log-exp75.9%
Applied egg-rr75.9%
Taylor expanded in t around 0 97.4%
if 2.1e20 < t Initial program 99.7%
add-cbrt-cube99.4%
pow399.3%
Applied egg-rr99.3%
Applied egg-rr47.7%
Taylor expanded in ew around inf 28.4%
add-sqr-sqrt19.0%
sqrt-unprod35.6%
pow235.6%
Applied egg-rr35.6%
Final simplification67.5%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (sin t)) (* (* eh (cos t)) (sin (atan (/ eh (* ew t))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan((eh / (ew * t)))))));
}
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)) + ((eh * cos(t)) * sin(atan((eh / (ew * t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.sin(t)) + ((eh * Math.cos(t)) * Math.sin(Math.atan((eh / (ew * t)))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.sin(t)) + ((eh * math.cos(t)) * math.sin(math.atan((eh / (ew * t)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * sin(t)) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * t))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * sin(t)) + ((eh * cos(t)) * sin(atan((eh / (ew * t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf 98.8%
Taylor expanded in t around 0 92.6%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (sin t)) (* eh (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * sin(t)) + (eh * sin(atan(((eh / ew) / tan(t)))))));
}
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)) + (eh * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.sin(t)) + (eh * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.sin(t)) + (eh * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * sin(t)) + Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * sin(t)) + (eh * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
Initial program 99.8%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf 98.8%
Taylor expanded in t around 0 82.0%
associate-/r*82.0%
Simplified82.0%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -0.0044) (not (<= t 1.85e+61))) (sqrt (pow (* ew (sin t)) 2.0)) (fabs (+ (* ew t) (* eh (sin (atan (/ eh (* ew (tan t))))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -0.0044) || !(t <= 1.85e+61)) {
tmp = sqrt(pow((ew * sin(t)), 2.0));
} else {
tmp = fabs(((ew * t) + (eh * sin(atan((eh / (ew * tan(t))))))));
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-0.0044d0)) .or. (.not. (t <= 1.85d+61))) then
tmp = sqrt(((ew * sin(t)) ** 2.0d0))
else
tmp = abs(((ew * t) + (eh * sin(atan((eh / (ew * tan(t))))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -0.0044) || !(t <= 1.85e+61)) {
tmp = Math.sqrt(Math.pow((ew * Math.sin(t)), 2.0));
} else {
tmp = Math.abs(((ew * t) + (eh * Math.sin(Math.atan((eh / (ew * Math.tan(t))))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -0.0044) or not (t <= 1.85e+61): tmp = math.sqrt(math.pow((ew * math.sin(t)), 2.0)) else: tmp = math.fabs(((ew * t) + (eh * math.sin(math.atan((eh / (ew * math.tan(t)))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -0.0044) || !(t <= 1.85e+61)) tmp = sqrt((Float64(ew * sin(t)) ^ 2.0)); else tmp = abs(Float64(Float64(ew * t) + Float64(eh * sin(atan(Float64(eh / Float64(ew * tan(t)))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -0.0044) || ~((t <= 1.85e+61))) tmp = sqrt(((ew * sin(t)) ^ 2.0)); else tmp = abs(((ew * t) + (eh * sin(atan((eh / (ew * tan(t)))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -0.0044], N[Not[LessEqual[t, 1.85e+61]], $MachinePrecision]], N[Sqrt[N[Power[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * t), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.0044 \lor \neg \left(t \leq 1.85 \cdot 10^{+61}\right):\\
\;\;\;\;\sqrt{{\left(ew \cdot \sin t\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot t + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\end{array}
\end{array}
if t < -0.00440000000000000027 or 1.85000000000000001e61 < t Initial program 99.6%
add-cbrt-cube99.3%
pow399.3%
Applied egg-rr99.3%
Applied egg-rr45.2%
Taylor expanded in ew around inf 23.7%
unpow223.7%
sqrt-unprod32.3%
pow232.3%
Applied egg-rr32.3%
if -0.00440000000000000027 < t < 1.85000000000000001e61Initial program 100.0%
cos-atan100.0%
un-div-inv100.0%
hypot-1-def100.0%
Applied egg-rr100.0%
Taylor expanded in ew around inf 99.4%
add-log-exp76.6%
Applied egg-rr76.6%
Taylor expanded in t around 0 95.1%
Final simplification67.1%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -1.25e-12) (not (<= eh 1.02e-50))) (* (cos t) (* eh (sin (atan (/ (/ eh ew) (tan t)))))) (sqrt (pow (* ew (sin t)) 2.0))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.25e-12) || !(eh <= 1.02e-50)) {
tmp = cos(t) * (eh * sin(atan(((eh / ew) / tan(t)))));
} else {
tmp = sqrt(pow((ew * sin(t)), 2.0));
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if ((eh <= (-1.25d-12)) .or. (.not. (eh <= 1.02d-50))) then
tmp = cos(t) * (eh * sin(atan(((eh / ew) / tan(t)))))
else
tmp = sqrt(((ew * sin(t)) ** 2.0d0))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.25e-12) || !(eh <= 1.02e-50)) {
tmp = Math.cos(t) * (eh * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))));
} else {
tmp = Math.sqrt(Math.pow((ew * Math.sin(t)), 2.0));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -1.25e-12) or not (eh <= 1.02e-50): tmp = math.cos(t) * (eh * math.sin(math.atan(((eh / ew) / math.tan(t))))) else: tmp = math.sqrt(math.pow((ew * math.sin(t)), 2.0)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.25e-12) || !(eh <= 1.02e-50)) tmp = Float64(cos(t) * Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(t)))))); else tmp = sqrt((Float64(ew * sin(t)) ^ 2.0)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -1.25e-12) || ~((eh <= 1.02e-50))) tmp = cos(t) * (eh * sin(atan(((eh / ew) / tan(t))))); else tmp = sqrt(((ew * sin(t)) ^ 2.0)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.25e-12], N[Not[LessEqual[eh, 1.02e-50]], $MachinePrecision]], N[(N[Cos[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[Power[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.25 \cdot 10^{-12} \lor \neg \left(eh \leq 1.02 \cdot 10^{-50}\right):\\
\;\;\;\;\cos t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(ew \cdot \sin t\right)}^{2}}\\
\end{array}
\end{array}
if eh < -1.24999999999999992e-12 or 1.0199999999999999e-50 < eh Initial program 99.8%
add-cbrt-cube96.6%
pow396.6%
Applied egg-rr96.6%
Applied egg-rr47.9%
Taylor expanded in ew around 0 42.8%
associate-*r*42.8%
associate-/r*42.8%
Simplified42.8%
unpow242.8%
add-sqr-sqrt43.5%
*-commutative43.5%
associate-*r*43.5%
Applied egg-rr43.5%
if -1.24999999999999992e-12 < eh < 1.0199999999999999e-50Initial program 99.8%
add-cbrt-cube88.0%
pow387.9%
Applied egg-rr87.9%
Applied egg-rr44.5%
Taylor expanded in ew around inf 35.7%
unpow235.7%
sqrt-unprod49.7%
pow249.7%
Applied egg-rr49.7%
Final simplification46.1%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (* ew (sin t)))) (if (<= ew 3.3e+157) (sqrt (pow t_1 2.0)) t_1)))
double code(double eh, double ew, double t) {
double t_1 = ew * sin(t);
double tmp;
if (ew <= 3.3e+157) {
tmp = sqrt(pow(t_1, 2.0));
} else {
tmp = t_1;
}
return tmp;
}
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
real(8) :: tmp
t_1 = ew * sin(t)
if (ew <= 3.3d+157) then
tmp = sqrt((t_1 ** 2.0d0))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.sin(t);
double tmp;
if (ew <= 3.3e+157) {
tmp = Math.sqrt(Math.pow(t_1, 2.0));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.sin(t) tmp = 0 if ew <= 3.3e+157: tmp = math.sqrt(math.pow(t_1, 2.0)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(ew * sin(t)) tmp = 0.0 if (ew <= 3.3e+157) tmp = sqrt((t_1 ^ 2.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * sin(t); tmp = 0.0; if (ew <= 3.3e+157) tmp = sqrt((t_1 ^ 2.0)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ew, 3.3e+157], N[Sqrt[N[Power[t$95$1, 2.0], $MachinePrecision]], $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
\mathbf{if}\;ew \leq 3.3 \cdot 10^{+157}:\\
\;\;\;\;\sqrt{{t\_1}^{2}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < 3.3000000000000002e157Initial program 99.8%
add-cbrt-cube94.6%
pow394.6%
Applied egg-rr94.6%
Applied egg-rr45.2%
Taylor expanded in ew around inf 16.0%
unpow216.0%
sqrt-unprod28.0%
pow228.0%
Applied egg-rr28.0%
if 3.3000000000000002e157 < ew Initial program 99.9%
add-cbrt-cube81.6%
pow381.7%
Applied egg-rr81.7%
Applied egg-rr55.8%
Taylor expanded in ew around inf 41.1%
unpow241.1%
add-sqr-sqrt41.6%
*-commutative41.6%
Applied egg-rr41.6%
Final simplification29.7%
(FPCore (eh ew t) :precision binary64 (* ew (sin t)))
double code(double eh, double ew, double t) {
return ew * sin(t);
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = ew * sin(t)
end function
public static double code(double eh, double ew, double t) {
return ew * Math.sin(t);
}
def code(eh, ew, t): return ew * math.sin(t)
function code(eh, ew, t) return Float64(ew * sin(t)) end
function tmp = code(eh, ew, t) tmp = ew * sin(t); end
code[eh_, ew_, t_] := N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
ew \cdot \sin t
\end{array}
Initial program 99.8%
add-cbrt-cube93.0%
pow393.0%
Applied egg-rr93.0%
Applied egg-rr46.5%
Taylor expanded in ew around inf 19.1%
unpow219.1%
add-sqr-sqrt20.0%
*-commutative20.0%
Applied egg-rr20.0%
Final simplification20.0%
(FPCore (eh ew t) :precision binary64 (* ew t))
double code(double eh, double ew, double t) {
return ew * t;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = ew * t
end function
public static double code(double eh, double ew, double t) {
return ew * t;
}
def code(eh, ew, t): return ew * t
function code(eh, ew, t) return Float64(ew * t) end
function tmp = code(eh, ew, t) tmp = ew * t; end
code[eh_, ew_, t_] := N[(ew * t), $MachinePrecision]
\begin{array}{l}
\\
ew \cdot t
\end{array}
Initial program 99.8%
add-cbrt-cube93.0%
pow393.0%
Applied egg-rr93.0%
Applied egg-rr46.5%
Taylor expanded in ew around inf 19.1%
Taylor expanded in t around 0 10.1%
*-commutative10.1%
Simplified10.1%
Final simplification10.1%
herbie shell --seed 2024180
(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))))))))