
(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 10 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 (fabs (fma (* (sin (atan (/ eh (* (tan t) ew)))) (cos t)) eh (/ (* (sin t) ew) (sqrt (+ (pow (/ eh (* ew (tan t))) 2.0) 1.0))))))
double code(double eh, double ew, double t) {
return fabs(fma((sin(atan((eh / (tan(t) * ew)))) * cos(t)), eh, ((sin(t) * ew) / sqrt((pow((eh / (ew * tan(t))), 2.0) + 1.0)))));
}
function code(eh, ew, t) return abs(fma(Float64(sin(atan(Float64(eh / Float64(tan(t) * ew)))) * cos(t)), eh, Float64(Float64(sin(t) * ew) / sqrt(Float64((Float64(eh / Float64(ew * tan(t))) ^ 2.0) + 1.0))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh + N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] / N[Sqrt[N[(N[Power[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot \cos t, eh, \frac{\sin t \cdot ew}{\sqrt{{\left(\frac{eh}{ew \cdot \tan t}\right)}^{2} + 1}}\right)\right|
\end{array}
Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sin.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
Applied rewrites99.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (sin (atan (/ eh (* (tan t) ew)))) (cos t)) eh (/ (* (sin t) ew) 1.0))))
double code(double eh, double ew, double t) {
return fabs(fma((sin(atan((eh / (tan(t) * ew)))) * cos(t)), eh, ((sin(t) * ew) / 1.0)));
}
function code(eh, ew, t) return abs(fma(Float64(sin(atan(Float64(eh / Float64(tan(t) * ew)))) * cos(t)), eh, Float64(Float64(sin(t) * ew) / 1.0))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh + N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot \cos t, eh, \frac{\sin t \cdot ew}{1}\right)\right|
\end{array}
Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sin.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around 0
Applied rewrites99.3%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -1.02e-27) (not (<= eh 2.35e-28))) (fabs (* (* (sin (atan (/ eh (* (tan t) ew)))) (cos t)) eh)) (fabs (* (sin t) ew))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.02e-27) || !(eh <= 2.35e-28)) {
tmp = fabs(((sin(atan((eh / (tan(t) * ew)))) * cos(t)) * eh));
} else {
tmp = fabs((sin(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 ((eh <= (-1.02d-27)) .or. (.not. (eh <= 2.35d-28))) then
tmp = abs(((sin(atan((eh / (tan(t) * ew)))) * cos(t)) * eh))
else
tmp = abs((sin(t) * ew))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.02e-27) || !(eh <= 2.35e-28)) {
tmp = Math.abs(((Math.sin(Math.atan((eh / (Math.tan(t) * ew)))) * Math.cos(t)) * eh));
} else {
tmp = Math.abs((Math.sin(t) * ew));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -1.02e-27) or not (eh <= 2.35e-28): tmp = math.fabs(((math.sin(math.atan((eh / (math.tan(t) * ew)))) * math.cos(t)) * eh)) else: tmp = math.fabs((math.sin(t) * ew)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.02e-27) || !(eh <= 2.35e-28)) tmp = abs(Float64(Float64(sin(atan(Float64(eh / Float64(tan(t) * ew)))) * cos(t)) * eh)); else tmp = abs(Float64(sin(t) * ew)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -1.02e-27) || ~((eh <= 2.35e-28))) tmp = abs(((sin(atan((eh / (tan(t) * ew)))) * cos(t)) * eh)); else tmp = abs((sin(t) * ew)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.02e-27], N[Not[LessEqual[eh, 2.35e-28]], $MachinePrecision]], N[Abs[N[(N[(N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.02 \cdot 10^{-27} \lor \neg \left(eh \leq 2.35 \cdot 10^{-28}\right):\\
\;\;\;\;\left|\left(\sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot \cos t\right) \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\end{array}
\end{array}
if eh < -1.02000000000000002e-27 or 2.3499999999999998e-28 < eh Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites80.7%
Applied rewrites80.7%
if -1.02000000000000002e-27 < eh < 2.3499999999999998e-28Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sin.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6475.9
Applied rewrites75.9%
Final simplification78.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (sin t) ew))))
(if (<= ew -2.55e+34)
t_1
(if (<= ew -1.18e-147)
(fabs
(*
(*
(sin
(atan
(/ (fma (* eh (/ (* t t) ew)) -0.3333333333333333 (/ eh ew)) t)))
(cos t))
eh))
(if (<= ew 1100000000.0)
(fabs (* (* (sin (atan (/ eh (* ew t)))) (cos t)) eh))
t_1)))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (ew <= -2.55e+34) {
tmp = t_1;
} else if (ew <= -1.18e-147) {
tmp = fabs(((sin(atan((fma((eh * ((t * t) / ew)), -0.3333333333333333, (eh / ew)) / t))) * cos(t)) * eh));
} else if (ew <= 1100000000.0) {
tmp = fabs(((sin(atan((eh / (ew * t)))) * cos(t)) * eh));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * ew)) tmp = 0.0 if (ew <= -2.55e+34) tmp = t_1; elseif (ew <= -1.18e-147) tmp = abs(Float64(Float64(sin(atan(Float64(fma(Float64(eh * Float64(Float64(t * t) / ew)), -0.3333333333333333, Float64(eh / ew)) / t))) * cos(t)) * eh)); elseif (ew <= 1100000000.0) tmp = abs(Float64(Float64(sin(atan(Float64(eh / Float64(ew * t)))) * cos(t)) * eh)); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -2.55e+34], t$95$1, If[LessEqual[ew, -1.18e-147], N[Abs[N[(N[(N[Sin[N[ArcTan[N[(N[(N[(eh * N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] * -0.3333333333333333 + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 1100000000.0], N[Abs[N[(N[(N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;ew \leq -2.55 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq -1.18 \cdot 10^{-147}:\\
\;\;\;\;\left|\left(\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(eh \cdot \frac{t \cdot t}{ew}, -0.3333333333333333, \frac{eh}{ew}\right)}{t}\right) \cdot \cos t\right) \cdot eh\right|\\
\mathbf{elif}\;ew \leq 1100000000:\\
\;\;\;\;\left|\left(\sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \cos t\right) \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -2.55000000000000018e34 or 1.1e9 < ew Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sin.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6470.0
Applied rewrites70.0%
if -2.55000000000000018e34 < ew < -1.18000000000000003e-147Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites79.2%
Applied rewrites79.2%
Taylor expanded in t around 0
Applied rewrites79.4%
if -1.18000000000000003e-147 < ew < 1.1e9Initial program 99.9%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites87.8%
Applied rewrites87.8%
Taylor expanded in t around 0
Applied rewrites82.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (sin t) ew))))
(if (<= ew -2.55e+34)
t_1
(if (<= ew -1.18e-147)
(fabs
(*
(sin
(atan
(/ (fma (* (* -0.3333333333333333 (/ eh ew)) t) t (/ eh ew)) t)))
(* (cos t) eh)))
(if (<= ew 1100000000.0)
(fabs (* (* (sin (atan (/ eh (* ew t)))) (cos t)) eh))
t_1)))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (ew <= -2.55e+34) {
tmp = t_1;
} else if (ew <= -1.18e-147) {
tmp = fabs((sin(atan((fma(((-0.3333333333333333 * (eh / ew)) * t), t, (eh / ew)) / t))) * (cos(t) * eh)));
} else if (ew <= 1100000000.0) {
tmp = fabs(((sin(atan((eh / (ew * t)))) * cos(t)) * eh));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * ew)) tmp = 0.0 if (ew <= -2.55e+34) tmp = t_1; elseif (ew <= -1.18e-147) tmp = abs(Float64(sin(atan(Float64(fma(Float64(Float64(-0.3333333333333333 * Float64(eh / ew)) * t), t, Float64(eh / ew)) / t))) * Float64(cos(t) * eh))); elseif (ew <= 1100000000.0) tmp = abs(Float64(Float64(sin(atan(Float64(eh / Float64(ew * t)))) * cos(t)) * eh)); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -2.55e+34], t$95$1, If[LessEqual[ew, -1.18e-147], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(-0.3333333333333333 * N[(eh / ew), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * t + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 1100000000.0], N[Abs[N[(N[(N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;ew \leq -2.55 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq -1.18 \cdot 10^{-147}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\left(-0.3333333333333333 \cdot \frac{eh}{ew}\right) \cdot t, t, \frac{eh}{ew}\right)}{t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
\mathbf{elif}\;ew \leq 1100000000:\\
\;\;\;\;\left|\left(\sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \cos t\right) \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -2.55000000000000018e34 or 1.1e9 < ew Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sin.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6470.0
Applied rewrites70.0%
if -2.55000000000000018e34 < ew < -1.18000000000000003e-147Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites79.2%
Taylor expanded in t around 0
Applied rewrites79.4%
if -1.18000000000000003e-147 < ew < 1.1e9Initial program 99.9%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites87.8%
Applied rewrites87.8%
Taylor expanded in t around 0
Applied rewrites82.4%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -9.5e+29) (not (<= ew 1100000000.0))) (fabs (* (sin t) ew)) (fabs (* (* (sin (atan (/ eh (* ew t)))) (cos t)) eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -9.5e+29) || !(ew <= 1100000000.0)) {
tmp = fabs((sin(t) * ew));
} else {
tmp = fabs(((sin(atan((eh / (ew * t)))) * cos(t)) * eh));
}
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 ((ew <= (-9.5d+29)) .or. (.not. (ew <= 1100000000.0d0))) then
tmp = abs((sin(t) * ew))
else
tmp = abs(((sin(atan((eh / (ew * t)))) * cos(t)) * eh))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -9.5e+29) || !(ew <= 1100000000.0)) {
tmp = Math.abs((Math.sin(t) * ew));
} else {
tmp = Math.abs(((Math.sin(Math.atan((eh / (ew * t)))) * Math.cos(t)) * eh));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -9.5e+29) or not (ew <= 1100000000.0): tmp = math.fabs((math.sin(t) * ew)) else: tmp = math.fabs(((math.sin(math.atan((eh / (ew * t)))) * math.cos(t)) * eh)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -9.5e+29) || !(ew <= 1100000000.0)) tmp = abs(Float64(sin(t) * ew)); else tmp = abs(Float64(Float64(sin(atan(Float64(eh / Float64(ew * t)))) * cos(t)) * eh)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -9.5e+29) || ~((ew <= 1100000000.0))) tmp = abs((sin(t) * ew)); else tmp = abs(((sin(atan((eh / (ew * t)))) * cos(t)) * eh)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -9.5e+29], N[Not[LessEqual[ew, 1100000000.0]], $MachinePrecision]], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -9.5 \cdot 10^{+29} \lor \neg \left(ew \leq 1100000000\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(\sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \cos t\right) \cdot eh\right|\\
\end{array}
\end{array}
if ew < -9.5000000000000003e29 or 1.1e9 < ew Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sin.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6469.8
Applied rewrites69.8%
if -9.5000000000000003e29 < ew < 1.1e9Initial program 99.8%
Taylor expanded in eh around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
*-commutativeN/A
Applied rewrites85.5%
Applied rewrites85.5%
Taylor expanded in t around 0
Applied rewrites77.5%
Final simplification73.3%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -1.3e+34) (not (<= ew 950000000.0)))
(fabs (* (sin t) ew))
(fabs
(*
(sin (atan (/ (/ (fma (* (* t t) eh) -0.3333333333333333 eh) ew) t)))
eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.3e+34) || !(ew <= 950000000.0)) {
tmp = fabs((sin(t) * ew));
} else {
tmp = fabs((sin(atan(((fma(((t * t) * eh), -0.3333333333333333, eh) / ew) / t))) * eh));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((ew <= -1.3e+34) || !(ew <= 950000000.0)) tmp = abs(Float64(sin(t) * ew)); else tmp = abs(Float64(sin(atan(Float64(Float64(fma(Float64(Float64(t * t) * eh), -0.3333333333333333, eh) / ew) / t))) * eh)); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -1.3e+34], N[Not[LessEqual[ew, 950000000.0]], $MachinePrecision]], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(N[(N[(t * t), $MachinePrecision] * eh), $MachinePrecision] * -0.3333333333333333 + eh), $MachinePrecision] / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.3 \cdot 10^{+34} \lor \neg \left(ew \leq 950000000\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\frac{\mathsf{fma}\left(\left(t \cdot t\right) \cdot eh, -0.3333333333333333, eh\right)}{ew}}{t}\right) \cdot eh\right|\\
\end{array}
\end{array}
if ew < -1.29999999999999999e34 or 9.5e8 < ew Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sin.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6470.0
Applied rewrites70.0%
if -1.29999999999999999e34 < ew < 9.5e8Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6459.5
Applied rewrites59.5%
Taylor expanded in t around 0
Applied rewrites47.5%
Taylor expanded in ew around 0
Applied rewrites59.6%
Final simplification65.2%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -9.5e+29) (not (<= ew 950000000.0))) (fabs (* (sin t) ew)) (fabs (* (sin (atan (/ (/ eh ew) t))) eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -9.5e+29) || !(ew <= 950000000.0)) {
tmp = fabs((sin(t) * ew));
} else {
tmp = fabs((sin(atan(((eh / ew) / t))) * eh));
}
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 ((ew <= (-9.5d+29)) .or. (.not. (ew <= 950000000.0d0))) then
tmp = abs((sin(t) * ew))
else
tmp = abs((sin(atan(((eh / ew) / t))) * eh))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -9.5e+29) || !(ew <= 950000000.0)) {
tmp = Math.abs((Math.sin(t) * ew));
} else {
tmp = Math.abs((Math.sin(Math.atan(((eh / ew) / t))) * eh));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -9.5e+29) or not (ew <= 950000000.0): tmp = math.fabs((math.sin(t) * ew)) else: tmp = math.fabs((math.sin(math.atan(((eh / ew) / t))) * eh)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -9.5e+29) || !(ew <= 950000000.0)) tmp = abs(Float64(sin(t) * ew)); else tmp = abs(Float64(sin(atan(Float64(Float64(eh / ew) / t))) * eh)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -9.5e+29) || ~((ew <= 950000000.0))) tmp = abs((sin(t) * ew)); else tmp = abs((sin(atan(((eh / ew) / t))) * eh)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -9.5e+29], N[Not[LessEqual[ew, 950000000.0]], $MachinePrecision]], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -9.5 \cdot 10^{+29} \lor \neg \left(ew \leq 950000000\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right) \cdot eh\right|\\
\end{array}
\end{array}
if ew < -9.5000000000000003e29 or 9.5e8 < ew Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sin.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6469.8
Applied rewrites69.8%
if -9.5000000000000003e29 < ew < 9.5e8Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6459.6
Applied rewrites59.6%
Taylor expanded in t around 0
Applied rewrites47.4%
Taylor expanded in t around 0
Applied rewrites58.2%
Final simplification64.5%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -2.2e+29) (not (<= ew 5e-77))) (fabs (* (sin t) ew)) (fabs (* (sin (atan (* (/ (* t eh) ew) -0.3333333333333333))) eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -2.2e+29) || !(ew <= 5e-77)) {
tmp = fabs((sin(t) * ew));
} else {
tmp = fabs((sin(atan((((t * eh) / ew) * -0.3333333333333333))) * eh));
}
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 ((ew <= (-2.2d+29)) .or. (.not. (ew <= 5d-77))) then
tmp = abs((sin(t) * ew))
else
tmp = abs((sin(atan((((t * eh) / ew) * (-0.3333333333333333d0)))) * eh))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -2.2e+29) || !(ew <= 5e-77)) {
tmp = Math.abs((Math.sin(t) * ew));
} else {
tmp = Math.abs((Math.sin(Math.atan((((t * eh) / ew) * -0.3333333333333333))) * eh));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -2.2e+29) or not (ew <= 5e-77): tmp = math.fabs((math.sin(t) * ew)) else: tmp = math.fabs((math.sin(math.atan((((t * eh) / ew) * -0.3333333333333333))) * eh)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -2.2e+29) || !(ew <= 5e-77)) tmp = abs(Float64(sin(t) * ew)); else tmp = abs(Float64(sin(atan(Float64(Float64(Float64(t * eh) / ew) * -0.3333333333333333))) * eh)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -2.2e+29) || ~((ew <= 5e-77))) tmp = abs((sin(t) * ew)); else tmp = abs((sin(atan((((t * eh) / ew) * -0.3333333333333333))) * eh)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -2.2e+29], N[Not[LessEqual[ew, 5e-77]], $MachinePrecision]], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -2.2 \cdot 10^{+29} \lor \neg \left(ew \leq 5 \cdot 10^{-77}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\frac{t \cdot eh}{ew} \cdot -0.3333333333333333\right) \cdot eh\right|\\
\end{array}
\end{array}
if ew < -2.2000000000000001e29 or 4.99999999999999963e-77 < ew Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sin.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6466.3
Applied rewrites66.3%
if -2.2000000000000001e29 < ew < 4.99999999999999963e-77Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
lower-cos.f6458.5
Applied rewrites58.5%
Taylor expanded in t around 0
Applied rewrites44.6%
Taylor expanded in t around inf
Applied rewrites38.6%
Final simplification55.2%
(FPCore (eh ew t) :precision binary64 (fabs (* (sin t) ew)))
double code(double eh, double ew, double t) {
return fabs((sin(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((sin(t) * ew))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((Math.sin(t) * ew));
}
def code(eh, ew, t): return math.fabs((math.sin(t) * ew))
function code(eh, ew, t) return abs(Float64(sin(t) * ew)) end
function tmp = code(eh, ew, t) tmp = abs((sin(t) * ew)); end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin t \cdot ew\right|
\end{array}
Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sin.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
lower-/.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
Applied rewrites99.8%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6446.4
Applied rewrites46.4%
herbie shell --seed 2024322
(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))))))))