
(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 9 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 (* (tan t) ew))))) (fabs (fma (* (sin t) (cos t_1)) ew (* (* (cos t) eh) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh / (tan(t) * ew)));
return fabs(fma((sin(t) * cos(t_1)), ew, ((cos(t) * eh) * sin(t_1))));
}
function code(eh, ew, t) t_1 = atan(Float64(eh / Float64(tan(t) * ew))) return abs(fma(Float64(sin(t) * cos(t_1)), ew, Float64(Float64(cos(t) * eh) * sin(t_1)))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] * ew + N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\\
\left|\mathsf{fma}\left(\sin t \cdot \cos t\_1, ew, \left(\cos t \cdot eh\right) \cdot \sin t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in ew around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-tan.f64N/A
lower-sin.f64N/A
associate-*r*N/A
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (sin (atan (/ (/ eh ew) (tan t)))) (* (cos t) eh)) (* (* (sin t) ew) (cos (atan (/ eh (* t ew))))))))
double code(double eh, double ew, double t) {
return fabs(((sin(atan(((eh / ew) / tan(t)))) * (cos(t) * eh)) + ((sin(t) * ew) * 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(((sin(atan(((eh / ew) / tan(t)))) * (cos(t) * eh)) + ((sin(t) * ew) * cos(atan((eh / (t * ew)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.sin(Math.atan(((eh / ew) / Math.tan(t)))) * (Math.cos(t) * eh)) + ((Math.sin(t) * ew) * Math.cos(Math.atan((eh / (t * ew)))))));
}
def code(eh, ew, t): return math.fabs(((math.sin(math.atan(((eh / ew) / math.tan(t)))) * (math.cos(t) * eh)) + ((math.sin(t) * ew) * math.cos(math.atan((eh / (t * ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(sin(atan(Float64(Float64(eh / ew) / tan(t)))) * Float64(cos(t) * eh)) + Float64(Float64(sin(t) * ew) * cos(atan(Float64(eh / Float64(t * ew))))))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(atan(((eh / ew) / tan(t)))) * (cos(t) * eh)) + ((sin(t) * ew) * cos(atan((eh / (t * ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) \cdot \left(\cos t \cdot eh\right) + \left(\sin t \cdot ew\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
lower-/.f64N/A
lower-*.f6499.2
Applied rewrites99.2%
Final simplification99.2%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (cos t) eh) (sin (atan (/ eh (* (tan t) ew)))) (* (sin t) ew))))
double code(double eh, double ew, double t) {
return fabs(fma((cos(t) * eh), sin(atan((eh / (tan(t) * ew)))), (sin(t) * ew)));
}
function code(eh, ew, t) return abs(fma(Float64(cos(t) * eh), sin(atan(Float64(eh / Float64(tan(t) * ew)))), Float64(sin(t) * ew))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\cos t \cdot eh, \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), \sin t \cdot ew\right)\right|
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites87.5%
Taylor expanded in eh around 0
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-tan.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6498.2
Applied rewrites98.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) eh))
(t_2
(fabs
(fma
(/ 1.0 (/ 1.0 (sin t)))
ew
(* (sin (atan (/ eh (* t ew)))) t_1)))))
(if (<= ew -1.15e-213)
t_2
(if (<= ew 4.8e-82)
(fabs (* t_1 (sin (atan (/ eh (* (tan t) ew))))))
t_2))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * eh;
double t_2 = fabs(fma((1.0 / (1.0 / sin(t))), ew, (sin(atan((eh / (t * ew)))) * t_1)));
double tmp;
if (ew <= -1.15e-213) {
tmp = t_2;
} else if (ew <= 4.8e-82) {
tmp = fabs((t_1 * sin(atan((eh / (tan(t) * ew))))));
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(cos(t) * eh) t_2 = abs(fma(Float64(1.0 / Float64(1.0 / sin(t))), ew, Float64(sin(atan(Float64(eh / Float64(t * ew)))) * t_1))) tmp = 0.0 if (ew <= -1.15e-213) tmp = t_2; elseif (ew <= 4.8e-82) tmp = abs(Float64(t_1 * sin(atan(Float64(eh / Float64(tan(t) * ew)))))); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[(1.0 / N[(1.0 / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * ew + N[(N[Sin[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -1.15e-213], t$95$2, If[LessEqual[ew, 4.8e-82], N[Abs[N[(t$95$1 * N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot eh\\
t_2 := \left|\mathsf{fma}\left(\frac{1}{\frac{1}{\sin t}}, ew, \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) \cdot t\_1\right)\right|\\
\mathbf{if}\;ew \leq -1.15 \cdot 10^{-213}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;ew \leq 4.8 \cdot 10^{-82}:\\
\;\;\;\;\left|t\_1 \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if ew < -1.15000000000000001e-213 or 4.80000000000000017e-82 < ew Initial program 99.8%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites89.4%
Taylor expanded in eh around 0
Applied rewrites97.6%
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-/r/N/A
lower-fma.f64N/A
Applied rewrites97.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6490.8
Applied rewrites90.8%
if -1.15000000000000001e-213 < ew < 4.80000000000000017e-82Initial program 99.9%
Taylor expanded in ew around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-tan.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6497.1
Applied rewrites97.1%
Final simplification92.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (sin (atan (/ eh (* (tan t) ew))))) (t_2 (fabs (* (sin t) ew))))
(if (<= t -2.1e+173)
t_2
(if (<= t -220000.0)
(fabs (* (* (cos t) eh) t_1))
(if (<= t 1.75e-6) (fabs (fma t_1 eh (* t ew))) t_2)))))
double code(double eh, double ew, double t) {
double t_1 = sin(atan((eh / (tan(t) * ew))));
double t_2 = fabs((sin(t) * ew));
double tmp;
if (t <= -2.1e+173) {
tmp = t_2;
} else if (t <= -220000.0) {
tmp = fabs(((cos(t) * eh) * t_1));
} else if (t <= 1.75e-6) {
tmp = fabs(fma(t_1, eh, (t * ew)));
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = sin(atan(Float64(eh / Float64(tan(t) * ew)))) t_2 = abs(Float64(sin(t) * ew)) tmp = 0.0 if (t <= -2.1e+173) tmp = t_2; elseif (t <= -220000.0) tmp = abs(Float64(Float64(cos(t) * eh) * t_1)); elseif (t <= 1.75e-6) tmp = abs(fma(t_1, eh, Float64(t * ew))); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -2.1e+173], t$95$2, If[LessEqual[t, -220000.0], N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 1.75e-6], N[Abs[N[(t$95$1 * eh + N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\\
t_2 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;t \leq -2.1 \cdot 10^{+173}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -220000:\\
\;\;\;\;\left|\left(\cos t \cdot eh\right) \cdot t\_1\right|\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;\left|\mathsf{fma}\left(t\_1, eh, t \cdot ew\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -2.1e173 or 1.74999999999999997e-6 < t Initial program 99.7%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites91.0%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6463.0
Applied rewrites63.0%
if -2.1e173 < t < -2.2e5Initial program 99.5%
Taylor expanded in ew around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-tan.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6465.4
Applied rewrites65.4%
if -2.2e5 < t < 1.74999999999999997e-6Initial program 100.0%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites84.5%
Taylor expanded in eh around 0
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-tan.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6498.0
Applied rewrites98.0%
Taylor expanded in t around 0
Applied rewrites96.5%
Final simplification79.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (sin t) ew))))
(if (<= t -0.0005)
t_1
(if (<= t 1.75e-6)
(fabs (fma (sin (atan (/ eh (* (tan t) ew)))) eh (* t ew)))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (t <= -0.0005) {
tmp = t_1;
} else if (t <= 1.75e-6) {
tmp = fabs(fma(sin(atan((eh / (tan(t) * ew)))), eh, (t * ew)));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * ew)) tmp = 0.0 if (t <= -0.0005) tmp = t_1; elseif (t <= 1.75e-6) tmp = abs(fma(sin(atan(Float64(eh / Float64(tan(t) * ew)))), eh, Float64(t * ew))); 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[t, -0.0005], t$95$1, If[LessEqual[t, 1.75e-6], N[Abs[N[(N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh + N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;t \leq -0.0005:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;\left|\mathsf{fma}\left(\sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), eh, t \cdot ew\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.0000000000000001e-4 or 1.74999999999999997e-6 < t Initial program 99.6%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites90.5%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6456.5
Applied rewrites56.5%
if -5.0000000000000001e-4 < t < 1.74999999999999997e-6Initial program 100.0%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites84.3%
Taylor expanded in eh around 0
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-tan.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6497.9
Applied rewrites97.9%
Taylor expanded in t around 0
Applied rewrites97.9%
Final simplification76.6%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (sin t) ew)))) (if (<= t -3.6e-36) t_1 (if (<= t 1.6e-6) (fabs (- eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (t <= -3.6e-36) {
tmp = t_1;
} else if (t <= 1.6e-6) {
tmp = fabs(-eh);
} 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 = abs((sin(t) * ew))
if (t <= (-3.6d-36)) then
tmp = t_1
else if (t <= 1.6d-6) then
tmp = abs(-eh)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs((Math.sin(t) * ew));
double tmp;
if (t <= -3.6e-36) {
tmp = t_1;
} else if (t <= 1.6e-6) {
tmp = Math.abs(-eh);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.sin(t) * ew)) tmp = 0 if t <= -3.6e-36: tmp = t_1 elif t <= 1.6e-6: tmp = math.fabs(-eh) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * ew)) tmp = 0.0 if (t <= -3.6e-36) tmp = t_1; elseif (t <= 1.6e-6) tmp = abs(Float64(-eh)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((sin(t) * ew)); tmp = 0.0; if (t <= -3.6e-36) tmp = t_1; elseif (t <= 1.6e-6) tmp = abs(-eh); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3.6e-36], t$95$1, If[LessEqual[t, 1.6e-6], N[Abs[(-eh)], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;t \leq -3.6 \cdot 10^{-36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{-6}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.60000000000000032e-36 or 1.5999999999999999e-6 < t Initial program 99.6%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites90.3%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6456.7
Applied rewrites56.7%
if -3.60000000000000032e-36 < t < 1.5999999999999999e-6Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-tan.f6479.3
Applied rewrites79.3%
Applied rewrites10.3%
Taylor expanded in eh around -inf
Applied rewrites79.6%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (- eh)))) (if (<= eh -1.4e-131) t_1 (if (<= eh 2.2e-228) (fabs (* t ew)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs(-eh);
double tmp;
if (eh <= -1.4e-131) {
tmp = t_1;
} else if (eh <= 2.2e-228) {
tmp = fabs((t * ew));
} 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 = abs(-eh)
if (eh <= (-1.4d-131)) then
tmp = t_1
else if (eh <= 2.2d-228) then
tmp = abs((t * ew))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.abs(-eh);
double tmp;
if (eh <= -1.4e-131) {
tmp = t_1;
} else if (eh <= 2.2e-228) {
tmp = Math.abs((t * ew));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(-eh) tmp = 0 if eh <= -1.4e-131: tmp = t_1 elif eh <= 2.2e-228: tmp = math.fabs((t * ew)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(-eh)) tmp = 0.0 if (eh <= -1.4e-131) tmp = t_1; elseif (eh <= 2.2e-228) tmp = abs(Float64(t * ew)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs(-eh); tmp = 0.0; if (eh <= -1.4e-131) tmp = t_1; elseif (eh <= 2.2e-228) tmp = abs((t * ew)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[(-eh)], $MachinePrecision]}, If[LessEqual[eh, -1.4e-131], t$95$1, If[LessEqual[eh, 2.2e-228], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|-eh\right|\\
\mathbf{if}\;eh \leq -1.4 \cdot 10^{-131}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 2.2 \cdot 10^{-228}:\\
\;\;\;\;\left|t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.4e-131 or 2.2e-228 < eh Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-tan.f6450.4
Applied rewrites50.4%
Applied rewrites8.9%
Taylor expanded in eh around -inf
Applied rewrites50.9%
if -1.4e-131 < eh < 2.2e-228Initial program 99.7%
lift-*.f64N/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
un-div-invN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites72.2%
Taylor expanded in eh around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6485.3
Applied rewrites85.3%
Taylor expanded in t around 0
Applied rewrites35.8%
Final simplification47.9%
(FPCore (eh ew t) :precision binary64 (fabs (- eh)))
double code(double eh, double ew, double t) {
return fabs(-eh);
}
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)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(-eh);
}
def code(eh, ew, t): return math.fabs(-eh)
function code(eh, ew, t) return abs(Float64(-eh)) end
function tmp = code(eh, ew, t) tmp = abs(-eh); end
code[eh_, ew_, t_] := N[Abs[(-eh)], $MachinePrecision]
\begin{array}{l}
\\
\left|-eh\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-tan.f6443.4
Applied rewrites43.4%
Applied rewrites7.6%
Taylor expanded in eh around -inf
Applied rewrites43.9%
herbie shell --seed 2024235
(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))))))))