
(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 (fma eh (* (cos t) (sin t_1)) (* ew (* (cos t_1) (sin t)))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (ew * tan(t))));
return fabs(fma(eh, (cos(t) * sin(t_1)), (ew * (cos(t_1) * sin(t)))));
}
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(ew * tan(t)))) return abs(fma(eh, Float64(cos(t) * sin(t_1)), Float64(ew * Float64(cos(t_1) * sin(t))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(ew * N[(N[Cos[t$95$1], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\
\left|\mathsf{fma}\left(eh, \cos t \cdot \sin t\_1, ew \cdot \left(\cos t\_1 \cdot \sin t\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in ew around 0 99.8%
fma-define99.9%
Simplified99.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(+
(/ (* ew (sin t)) (hypot 1.0 t_1))
(* (* eh (cos t)) (sin (atan t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / tan(t);
return fabs((((ew * sin(t)) / hypot(1.0, t_1)) + ((eh * cos(t)) * sin(atan(t_1)))));
}
public static double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / Math.tan(t);
return Math.abs((((ew * Math.sin(t)) / Math.hypot(1.0, t_1)) + ((eh * Math.cos(t)) * Math.sin(Math.atan(t_1)))));
}
def code(eh, ew, t): t_1 = (eh / ew) / math.tan(t) return math.fabs((((ew * math.sin(t)) / math.hypot(1.0, t_1)) + ((eh * math.cos(t)) * math.sin(math.atan(t_1)))))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(Float64(Float64(Float64(ew * sin(t)) / hypot(1.0, t_1)) + Float64(Float64(eh * cos(t)) * sin(atan(t_1))))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs((((ew * sin(t)) / hypot(1.0, t_1)) + ((eh * cos(t)) * sin(atan(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[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
\left|\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, t\_1\right)} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t\_1\right|
\end{array}
\end{array}
Initial program 99.8%
associate-/r*99.8%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.8%
associate-/r*99.8%
Applied egg-rr99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (* ew (sin t)) (cos (atan (/ eh (* t ew))))))))
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 / (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((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (t * ew)))))))
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 / (t * ew)))))));
}
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 / (t * ew)))))))
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(t * ew))))))) end
function tmp = code(eh, ew, t) tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + ((ew * sin(t)) * cos(atan((eh / (t * ew))))))); 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[(t * ew), $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}{t \cdot ew}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 98.2%
Final simplification98.2%
(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%
associate-/r*99.8%
cos-atan99.8%
un-div-inv99.8%
hypot-1-def99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf 97.8%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -1.55e-45) (not (<= eh 6.6e-54))) (fabs (* (cos t) (* eh (sin (atan (/ eh (* ew (tan t)))))))) (fabs (* ew (sin t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.55e-45) || !(eh <= 6.6e-54)) {
tmp = fabs((cos(t) * (eh * sin(atan((eh / (ew * tan(t))))))));
} else {
tmp = fabs((ew * sin(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 ((eh <= (-1.55d-45)) .or. (.not. (eh <= 6.6d-54))) then
tmp = abs((cos(t) * (eh * sin(atan((eh / (ew * tan(t))))))))
else
tmp = abs((ew * sin(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.55e-45) || !(eh <= 6.6e-54)) {
tmp = Math.abs((Math.cos(t) * (eh * Math.sin(Math.atan((eh / (ew * Math.tan(t))))))));
} else {
tmp = Math.abs((ew * Math.sin(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -1.55e-45) or not (eh <= 6.6e-54): tmp = math.fabs((math.cos(t) * (eh * math.sin(math.atan((eh / (ew * math.tan(t)))))))) else: tmp = math.fabs((ew * math.sin(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.55e-45) || !(eh <= 6.6e-54)) tmp = abs(Float64(cos(t) * Float64(eh * sin(atan(Float64(eh / Float64(ew * tan(t)))))))); else tmp = abs(Float64(ew * sin(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -1.55e-45) || ~((eh <= 6.6e-54))) tmp = abs((cos(t) * (eh * sin(atan((eh / (ew * tan(t)))))))); else tmp = abs((ew * sin(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.55e-45], N[Not[LessEqual[eh, 6.6e-54]], $MachinePrecision]], N[Abs[N[(N[Cos[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.55 \cdot 10^{-45} \lor \neg \left(eh \leq 6.6 \cdot 10^{-54}\right):\\
\;\;\;\;\left|\cos t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\end{array}
\end{array}
if eh < -1.55e-45 or 6.59999999999999986e-54 < eh Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in ew around 0 86.5%
*-commutative86.5%
associate-*r*86.5%
*-commutative86.5%
Simplified86.5%
if -1.55e-45 < eh < 6.59999999999999986e-54Initial program 99.8%
associate-*l*99.9%
fma-define99.9%
associate-/r*99.9%
associate-*l*99.9%
associate-/r*99.9%
Simplified99.9%
add-sqr-sqrt49.2%
fabs-sqr49.2%
add-sqr-sqrt50.7%
add-cbrt-cube25.5%
Applied egg-rr25.4%
Taylor expanded in ew around inf 40.8%
add-cbrt-cube32.4%
pow332.4%
Applied egg-rr32.4%
rem-cbrt-cube40.8%
add-sqr-sqrt39.5%
sqrt-unprod49.6%
pow249.6%
Applied egg-rr49.6%
unpow249.6%
rem-sqrt-square70.6%
Simplified70.6%
Final simplification78.9%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -4.3e-31) (not (<= eh 6.6e-54))) (fabs (* (* eh (cos t)) (sin (atan (/ eh (* t ew)))))) (fabs (* ew (sin t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -4.3e-31) || !(eh <= 6.6e-54)) {
tmp = fabs(((eh * cos(t)) * sin(atan((eh / (t * ew))))));
} else {
tmp = fabs((ew * sin(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 ((eh <= (-4.3d-31)) .or. (.not. (eh <= 6.6d-54))) then
tmp = abs(((eh * cos(t)) * sin(atan((eh / (t * ew))))))
else
tmp = abs((ew * sin(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -4.3e-31) || !(eh <= 6.6e-54)) {
tmp = Math.abs(((eh * Math.cos(t)) * Math.sin(Math.atan((eh / (t * ew))))));
} else {
tmp = Math.abs((ew * Math.sin(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -4.3e-31) or not (eh <= 6.6e-54): tmp = math.fabs(((eh * math.cos(t)) * math.sin(math.atan((eh / (t * ew)))))) else: tmp = math.fabs((ew * math.sin(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -4.3e-31) || !(eh <= 6.6e-54)) tmp = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(t * ew)))))); else tmp = abs(Float64(ew * sin(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -4.3e-31) || ~((eh <= 6.6e-54))) tmp = abs(((eh * cos(t)) * sin(atan((eh / (t * ew)))))); else tmp = abs((ew * sin(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -4.3e-31], N[Not[LessEqual[eh, 6.6e-54]], $MachinePrecision]], N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -4.3 \cdot 10^{-31} \lor \neg \left(eh \leq 6.6 \cdot 10^{-54}\right):\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\end{array}
\end{array}
if eh < -4.3e-31 or 6.59999999999999986e-54 < eh Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in ew around 0 99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in eh around inf 86.3%
associate-*r*86.3%
associate-/r*86.3%
Simplified86.3%
Taylor expanded in t around 0 70.5%
if -4.3e-31 < eh < 6.59999999999999986e-54Initial program 99.8%
associate-*l*99.9%
fma-define99.9%
associate-/r*99.9%
associate-*l*99.9%
associate-/r*99.9%
Simplified99.9%
add-sqr-sqrt48.4%
fabs-sqr48.4%
add-sqr-sqrt50.0%
add-cbrt-cube25.1%
Applied egg-rr25.1%
Taylor expanded in ew around inf 40.2%
add-cbrt-cube31.9%
pow331.9%
Applied egg-rr31.9%
rem-cbrt-cube40.2%
add-sqr-sqrt38.9%
sqrt-unprod48.9%
pow248.9%
Applied egg-rr48.9%
unpow248.9%
rem-sqrt-square69.5%
Simplified69.5%
Final simplification70.0%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -2.3e-45) (not (<= eh 5.5e-54))) (fabs (* eh (sin (atan (/ eh (* ew (tan t))))))) (fabs (* ew (sin t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -2.3e-45) || !(eh <= 5.5e-54)) {
tmp = fabs((eh * sin(atan((eh / (ew * tan(t)))))));
} else {
tmp = fabs((ew * sin(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 ((eh <= (-2.3d-45)) .or. (.not. (eh <= 5.5d-54))) then
tmp = abs((eh * sin(atan((eh / (ew * tan(t)))))))
else
tmp = abs((ew * sin(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -2.3e-45) || !(eh <= 5.5e-54)) {
tmp = Math.abs((eh * Math.sin(Math.atan((eh / (ew * Math.tan(t)))))));
} else {
tmp = Math.abs((ew * Math.sin(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -2.3e-45) or not (eh <= 5.5e-54): tmp = math.fabs((eh * math.sin(math.atan((eh / (ew * math.tan(t))))))) else: tmp = math.fabs((ew * math.sin(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -2.3e-45) || !(eh <= 5.5e-54)) tmp = abs(Float64(eh * sin(atan(Float64(eh / Float64(ew * tan(t))))))); else tmp = abs(Float64(ew * sin(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -2.3e-45) || ~((eh <= 5.5e-54))) tmp = abs((eh * sin(atan((eh / (ew * tan(t))))))); else tmp = abs((ew * sin(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -2.3e-45], N[Not[LessEqual[eh, 5.5e-54]], $MachinePrecision]], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -2.3 \cdot 10^{-45} \lor \neg \left(eh \leq 5.5 \cdot 10^{-54}\right):\\
\;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\end{array}
\end{array}
if eh < -2.29999999999999992e-45 or 5.50000000000000046e-54 < eh Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in t around 0 58.9%
if -2.29999999999999992e-45 < eh < 5.50000000000000046e-54Initial program 99.8%
associate-*l*99.9%
fma-define99.9%
associate-/r*99.9%
associate-*l*99.9%
associate-/r*99.9%
Simplified99.9%
add-sqr-sqrt49.2%
fabs-sqr49.2%
add-sqr-sqrt50.7%
add-cbrt-cube25.5%
Applied egg-rr25.4%
Taylor expanded in ew around inf 40.8%
add-cbrt-cube32.4%
pow332.4%
Applied egg-rr32.4%
rem-cbrt-cube40.8%
add-sqr-sqrt39.5%
sqrt-unprod49.6%
pow249.6%
Applied egg-rr49.6%
unpow249.6%
rem-sqrt-square70.6%
Simplified70.6%
Final simplification64.5%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -2.5e-23) (not (<= t 1.95e-91))) (fabs (* ew (sin t))) (fabs (* eh (sin (atan (/ eh (* t ew))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -2.5e-23) || !(t <= 1.95e-91)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs((eh * sin(atan((eh / (t * ew))))));
}
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 <= (-2.5d-23)) .or. (.not. (t <= 1.95d-91))) then
tmp = abs((ew * sin(t)))
else
tmp = abs((eh * sin(atan((eh / (t * ew))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -2.5e-23) || !(t <= 1.95e-91)) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs((eh * Math.sin(Math.atan((eh / (t * ew))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -2.5e-23) or not (t <= 1.95e-91): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs((eh * math.sin(math.atan((eh / (t * ew)))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -2.5e-23) || !(t <= 1.95e-91)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(eh * sin(atan(Float64(eh / Float64(t * ew)))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -2.5e-23) || ~((t <= 1.95e-91))) tmp = abs((ew * sin(t))); else tmp = abs((eh * sin(atan((eh / (t * ew)))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -2.5e-23], N[Not[LessEqual[t, 1.95e-91]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-23} \lor \neg \left(t \leq 1.95 \cdot 10^{-91}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right|\\
\end{array}
\end{array}
if t < -2.5000000000000001e-23 or 1.94999999999999997e-91 < t Initial program 99.7%
associate-*l*99.7%
fma-define99.7%
associate-/r*99.7%
associate-*l*99.7%
associate-/r*99.7%
Simplified99.7%
add-sqr-sqrt46.0%
fabs-sqr46.0%
add-sqr-sqrt46.9%
add-cbrt-cube18.1%
Applied egg-rr18.1%
Taylor expanded in ew around inf 27.3%
add-cbrt-cube27.1%
pow327.1%
Applied egg-rr27.1%
rem-cbrt-cube27.3%
add-sqr-sqrt26.3%
sqrt-unprod34.8%
pow234.8%
Applied egg-rr34.8%
unpow234.8%
rem-sqrt-square54.8%
Simplified54.8%
if -2.5000000000000001e-23 < t < 1.94999999999999997e-91Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
associate-/r*100.0%
associate-*l*100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in t around 0 75.7%
Taylor expanded in t around 0 75.7%
*-commutative75.7%
Simplified75.7%
Final simplification64.3%
(FPCore (eh ew t) :precision binary64 (fabs (* ew (sin t))))
double code(double eh, double ew, double t) {
return fabs((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 = abs((ew * sin(t)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * Math.sin(t)));
}
def code(eh, ew, t): return math.fabs((ew * math.sin(t)))
function code(eh, ew, t) return abs(Float64(ew * sin(t))) end
function tmp = code(eh, ew, t) tmp = abs((ew * sin(t))); end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \sin t\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
add-sqr-sqrt46.9%
fabs-sqr46.9%
add-sqr-sqrt48.0%
add-cbrt-cube21.6%
Applied egg-rr21.6%
Taylor expanded in ew around inf 23.5%
add-cbrt-cube18.6%
pow318.6%
Applied egg-rr18.6%
rem-cbrt-cube23.5%
add-sqr-sqrt22.5%
sqrt-unprod29.3%
pow229.3%
Applied egg-rr29.3%
unpow229.3%
rem-sqrt-square42.7%
Simplified42.7%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -2.85e+16) (not (<= t 3.35e+56))) (* ew (sin t)) (fabs (* t ew))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -2.85e+16) || !(t <= 3.35e+56)) {
tmp = ew * sin(t);
} else {
tmp = fabs((t * ew));
}
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 <= (-2.85d+16)) .or. (.not. (t <= 3.35d+56))) then
tmp = ew * sin(t)
else
tmp = abs((t * ew))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((t <= -2.85e+16) || !(t <= 3.35e+56)) {
tmp = ew * Math.sin(t);
} else {
tmp = Math.abs((t * ew));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -2.85e+16) or not (t <= 3.35e+56): tmp = ew * math.sin(t) else: tmp = math.fabs((t * ew)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -2.85e+16) || !(t <= 3.35e+56)) tmp = Float64(ew * sin(t)); else tmp = abs(Float64(t * ew)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -2.85e+16) || ~((t <= 3.35e+56))) tmp = ew * sin(t); else tmp = abs((t * ew)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -2.85e+16], N[Not[LessEqual[t, 3.35e+56]], $MachinePrecision]], N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.85 \cdot 10^{+16} \lor \neg \left(t \leq 3.35 \cdot 10^{+56}\right):\\
\;\;\;\;ew \cdot \sin t\\
\mathbf{else}:\\
\;\;\;\;\left|t \cdot ew\right|\\
\end{array}
\end{array}
if t < -2.85e16 or 3.35e56 < t Initial program 99.7%
associate-*l*99.7%
fma-define99.7%
associate-/r*99.7%
associate-*l*99.7%
associate-/r*99.7%
Simplified99.7%
add-sqr-sqrt47.7%
fabs-sqr47.7%
add-sqr-sqrt48.5%
add-cbrt-cube17.2%
Applied egg-rr17.2%
Taylor expanded in ew around inf 28.3%
if -2.85e16 < t < 3.35e56Initial program 99.9%
associate-*l*100.0%
fma-define100.0%
associate-/r*100.0%
associate-*l*100.0%
associate-/r*100.0%
Simplified100.0%
add-sqr-sqrt46.3%
fabs-sqr46.3%
add-sqr-sqrt47.6%
add-cbrt-cube24.5%
Applied egg-rr24.6%
Taylor expanded in ew around inf 20.2%
Taylor expanded in t around 0 20.2%
add-sqr-sqrt19.3%
sqrt-unprod23.6%
pow223.6%
*-commutative23.6%
Applied egg-rr23.6%
unpow223.6%
rem-sqrt-square30.4%
*-commutative30.4%
Simplified30.4%
Final simplification29.5%
(FPCore (eh ew t) :precision binary64 (fabs (* t ew)))
double code(double eh, double ew, double t) {
return fabs((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((t * ew))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((t * ew));
}
def code(eh, ew, t): return math.fabs((t * ew))
function code(eh, ew, t) return abs(Float64(t * ew)) end
function tmp = code(eh, ew, t) tmp = abs((t * ew)); end
code[eh_, ew_, t_] := N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|t \cdot ew\right|
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
add-sqr-sqrt46.9%
fabs-sqr46.9%
add-sqr-sqrt48.0%
add-cbrt-cube21.6%
Applied egg-rr21.6%
Taylor expanded in ew around inf 23.5%
Taylor expanded in t around 0 13.3%
add-sqr-sqrt12.5%
sqrt-unprod16.2%
pow216.2%
*-commutative16.2%
Applied egg-rr16.2%
unpow216.2%
rem-sqrt-square20.4%
*-commutative20.4%
Simplified20.4%
Final simplification20.4%
(FPCore (eh ew t) :precision binary64 (* t ew))
double code(double eh, double ew, double t) {
return 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 = t * ew
end function
public static double code(double eh, double ew, double t) {
return t * ew;
}
def code(eh, ew, t): return t * ew
function code(eh, ew, t) return Float64(t * ew) end
function tmp = code(eh, ew, t) tmp = t * ew; end
code[eh_, ew_, t_] := N[(t * ew), $MachinePrecision]
\begin{array}{l}
\\
t \cdot ew
\end{array}
Initial program 99.8%
associate-*l*99.8%
fma-define99.8%
associate-/r*99.8%
associate-*l*99.8%
associate-/r*99.8%
Simplified99.8%
add-sqr-sqrt46.9%
fabs-sqr46.9%
add-sqr-sqrt48.0%
add-cbrt-cube21.6%
Applied egg-rr21.6%
Taylor expanded in ew around inf 23.5%
Taylor expanded in t around 0 13.3%
Final simplification13.3%
herbie shell --seed 2024145
(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))))))))