
(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 11 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 (+ (* (* (cos t) eh) (sin (atan (/ eh (* (tan t) ew))))) (* (* (sin t) ew) (cos (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs((((cos(t) * eh) * sin(atan((eh / (tan(t) * ew))))) + ((sin(t) * ew) * cos(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((((cos(t) * eh) * sin(atan((eh / (tan(t) * ew))))) + ((sin(t) * ew) * cos(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((Math.cos(t) * eh) * Math.sin(Math.atan((eh / (Math.tan(t) * ew))))) + ((Math.sin(t) * ew) * Math.cos(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs((((math.cos(t) * eh) * math.sin(math.atan((eh / (math.tan(t) * ew))))) + ((math.sin(t) * ew) * math.cos(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / Float64(tan(t) * ew))))) + Float64(Float64(sin(t) * ew) * cos(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((cos(t) * eh) * sin(atan((eh / (tan(t) * ew))))) + ((sin(t) * ew) * cos(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) + \left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\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%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ eh (* t ew))))
(fabs
(fma
(* (sin (atan (/ eh (* (tan t) ew)))) (cos t))
eh
(/ (* (sin t) ew) (sqrt (fma t_1 t_1 1.0)))))))
double code(double eh, double ew, double t) {
double t_1 = eh / (t * ew);
return fabs(fma((sin(atan((eh / (tan(t) * ew)))) * cos(t)), eh, ((sin(t) * ew) / sqrt(fma(t_1, t_1, 1.0)))));
}
function code(eh, ew, t) t_1 = Float64(eh / Float64(t * ew)) return abs(fma(Float64(sin(atan(Float64(eh / Float64(tan(t) * ew)))) * cos(t)), eh, Float64(Float64(sin(t) * ew) / sqrt(fma(t_1, t_1, 1.0))))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(t * ew), $MachinePrecision]), $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 + N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] / N[Sqrt[N[(t$95$1 * t$95$1 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh}{t \cdot ew}\\
\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{\mathsf{fma}\left(t\_1, t\_1, 1\right)}}\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6499.2
Applied rewrites99.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.2%
(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%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6499.2
Applied rewrites99.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.2%
Taylor expanded in ew around inf
Applied rewrites98.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ eh (* t ew)))
(t_2 (sin (atan (/ eh (* (tan t) ew)))))
(t_3 (fabs (* (sin t) ew))))
(if (<= t -2.6e+173)
t_3
(if (<= t -1.4e+52)
(fabs (* (* (cos t) eh) t_2))
(if (<= t 1.75e-6)
(fabs (fma (* t_2 (cos t)) eh (/ (* t ew) (sqrt (fma t_1 t_1 1.0)))))
t_3)))))
double code(double eh, double ew, double t) {
double t_1 = eh / (t * ew);
double t_2 = sin(atan((eh / (tan(t) * ew))));
double t_3 = fabs((sin(t) * ew));
double tmp;
if (t <= -2.6e+173) {
tmp = t_3;
} else if (t <= -1.4e+52) {
tmp = fabs(((cos(t) * eh) * t_2));
} else if (t <= 1.75e-6) {
tmp = fabs(fma((t_2 * cos(t)), eh, ((t * ew) / sqrt(fma(t_1, t_1, 1.0)))));
} else {
tmp = t_3;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh / Float64(t * ew)) t_2 = sin(atan(Float64(eh / Float64(tan(t) * ew)))) t_3 = abs(Float64(sin(t) * ew)) tmp = 0.0 if (t <= -2.6e+173) tmp = t_3; elseif (t <= -1.4e+52) tmp = abs(Float64(Float64(cos(t) * eh) * t_2)); elseif (t <= 1.75e-6) tmp = abs(fma(Float64(t_2 * cos(t)), eh, Float64(Float64(t * ew) / sqrt(fma(t_1, t_1, 1.0))))); else tmp = t_3; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -2.6e+173], t$95$3, If[LessEqual[t, -1.4e+52], N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * t$95$2), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 1.75e-6], N[Abs[N[(N[(t$95$2 * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh + N[(N[(t * ew), $MachinePrecision] / N[Sqrt[N[(t$95$1 * t$95$1 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh}{t \cdot ew}\\
t_2 := \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\\
t_3 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;t \leq -2.6 \cdot 10^{+173}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t \leq -1.4 \cdot 10^{+52}:\\
\;\;\;\;\left|\left(\cos t \cdot eh\right) \cdot t\_2\right|\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;\left|\mathsf{fma}\left(t\_2 \cdot \cos t, eh, \frac{t \cdot ew}{\sqrt{\mathsf{fma}\left(t\_1, t\_1, 1\right)}}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if t < -2.5999999999999999e173 or 1.74999999999999997e-6 < t Initial program 99.7%
Applied rewrites91.0%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6462.9
Applied rewrites62.9%
Applied rewrites63.0%
if -2.5999999999999999e173 < t < -1.4e52Initial program 99.4%
Applied rewrites83.5%
Taylor expanded in ew around 0
associate-*r*N/A
lower-*.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-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6464.6
Applied rewrites64.6%
Applied rewrites64.6%
if -1.4e52 < t < 1.74999999999999997e-6Initial program 99.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in t around 0
lower-*.f6496.1
Applied rewrites96.1%
Final simplification81.0%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (* (cos t) eh) (sin (atan (/ eh (* (tan t) ew)))))))) (if (<= eh -4.8e-73) t_1 (if (<= eh 1.12e-127) (fabs (* (sin t) ew)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs(((cos(t) * eh) * sin(atan((eh / (tan(t) * ew))))));
double tmp;
if (eh <= -4.8e-73) {
tmp = t_1;
} else if (eh <= 1.12e-127) {
tmp = fabs((sin(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(((cos(t) * eh) * sin(atan((eh / (tan(t) * ew))))))
if (eh <= (-4.8d-73)) then
tmp = t_1
else if (eh <= 1.12d-127) then
tmp = abs((sin(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(((Math.cos(t) * eh) * Math.sin(Math.atan((eh / (Math.tan(t) * ew))))));
double tmp;
if (eh <= -4.8e-73) {
tmp = t_1;
} else if (eh <= 1.12e-127) {
tmp = Math.abs((Math.sin(t) * ew));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(((math.cos(t) * eh) * math.sin(math.atan((eh / (math.tan(t) * ew)))))) tmp = 0 if eh <= -4.8e-73: tmp = t_1 elif eh <= 1.12e-127: tmp = math.fabs((math.sin(t) * ew)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(Float64(cos(t) * eh) * sin(atan(Float64(eh / Float64(tan(t) * ew)))))) tmp = 0.0 if (eh <= -4.8e-73) tmp = t_1; elseif (eh <= 1.12e-127) tmp = abs(Float64(sin(t) * ew)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs(((cos(t) * eh) * sin(atan((eh / (tan(t) * ew)))))); tmp = 0.0; if (eh <= -4.8e-73) tmp = t_1; elseif (eh <= 1.12e-127) tmp = abs((sin(t) * ew)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = 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]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -4.8e-73], t$95$1, If[LessEqual[eh, 1.12e-127], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right|\\
\mathbf{if}\;eh \leq -4.8 \cdot 10^{-73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 1.12 \cdot 10^{-127}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -4.80000000000000011e-73 or 1.1199999999999999e-127 < eh Initial program 99.8%
Applied rewrites94.1%
Taylor expanded in ew around 0
associate-*r*N/A
lower-*.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-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6478.4
Applied rewrites78.4%
Applied rewrites78.6%
if -4.80000000000000011e-73 < eh < 1.1199999999999999e-127Initial program 99.8%
Applied rewrites74.7%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6475.3
Applied rewrites75.3%
Applied rewrites75.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (cos t) eh))
(t_2 (/ 1.0 (fabs (/ 1.0 (* (sin (atan (/ eh (* t ew)))) t_1)))))
(t_3
(/
1.0
(fabs
(/
1.0
(*
(sin
(atan
(/
(fma (* -0.3333333333333333 (/ eh ew)) (* t t) (/ eh ew))
t)))
t_1))))))
(if (<= eh -2.2e+141)
t_2
(if (<= eh -4.8e-73)
t_3
(if (<= eh 1.12e-127)
(fabs (* (sin t) ew))
(if (<= eh 1.9e+60) t_3 t_2))))))
double code(double eh, double ew, double t) {
double t_1 = cos(t) * eh;
double t_2 = 1.0 / fabs((1.0 / (sin(atan((eh / (t * ew)))) * t_1)));
double t_3 = 1.0 / fabs((1.0 / (sin(atan((fma((-0.3333333333333333 * (eh / ew)), (t * t), (eh / ew)) / t))) * t_1)));
double tmp;
if (eh <= -2.2e+141) {
tmp = t_2;
} else if (eh <= -4.8e-73) {
tmp = t_3;
} else if (eh <= 1.12e-127) {
tmp = fabs((sin(t) * ew));
} else if (eh <= 1.9e+60) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(cos(t) * eh) t_2 = Float64(1.0 / abs(Float64(1.0 / Float64(sin(atan(Float64(eh / Float64(t * ew)))) * t_1)))) t_3 = Float64(1.0 / abs(Float64(1.0 / Float64(sin(atan(Float64(fma(Float64(-0.3333333333333333 * Float64(eh / ew)), Float64(t * t), Float64(eh / ew)) / t))) * t_1)))) tmp = 0.0 if (eh <= -2.2e+141) tmp = t_2; elseif (eh <= -4.8e-73) tmp = t_3; elseif (eh <= 1.12e-127) tmp = abs(Float64(sin(t) * ew)); elseif (eh <= 1.9e+60) tmp = t_3; 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[(1.0 / N[Abs[N[(1.0 / N[(N[Sin[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 / N[Abs[N[(1.0 / N[(N[Sin[N[ArcTan[N[(N[(N[(-0.3333333333333333 * N[(eh / ew), $MachinePrecision]), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -2.2e+141], t$95$2, If[LessEqual[eh, -4.8e-73], t$95$3, If[LessEqual[eh, 1.12e-127], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 1.9e+60], t$95$3, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos t \cdot eh\\
t_2 := \frac{1}{\left|\frac{1}{\sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) \cdot t\_1}\right|}\\
t_3 := \frac{1}{\left|\frac{1}{\sin \tan^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333 \cdot \frac{eh}{ew}, t \cdot t, \frac{eh}{ew}\right)}{t}\right) \cdot t\_1}\right|}\\
\mathbf{if}\;eh \leq -2.2 \cdot 10^{+141}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq -4.8 \cdot 10^{-73}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;eh \leq 1.12 \cdot 10^{-127}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{elif}\;eh \leq 1.9 \cdot 10^{+60}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -2.2e141 or 1.90000000000000005e60 < eh Initial program 99.8%
Applied rewrites88.5%
Taylor expanded in ew around 0
associate-*r*N/A
lower-*.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-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6485.5
Applied rewrites85.5%
Taylor expanded in t around 0
Applied rewrites75.6%
if -2.2e141 < eh < -4.80000000000000011e-73 or 1.1199999999999999e-127 < eh < 1.90000000000000005e60Initial program 99.8%
Applied rewrites99.7%
Taylor expanded in ew around 0
associate-*r*N/A
lower-*.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-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6471.3
Applied rewrites71.3%
Taylor expanded in t around 0
Applied rewrites70.3%
if -4.80000000000000011e-73 < eh < 1.1199999999999999e-127Initial program 99.8%
Applied rewrites74.7%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6475.3
Applied rewrites75.3%
Applied rewrites75.4%
Final simplification73.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(/
1.0
(fabs (/ 1.0 (* (sin (atan (/ eh (* t ew)))) (* (cos t) eh)))))))
(if (<= eh -9e+28) t_1 (if (<= eh 1.12e-127) (fabs (* (sin t) ew)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = 1.0 / fabs((1.0 / (sin(atan((eh / (t * ew)))) * (cos(t) * eh))));
double tmp;
if (eh <= -9e+28) {
tmp = t_1;
} else if (eh <= 1.12e-127) {
tmp = fabs((sin(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 = 1.0d0 / abs((1.0d0 / (sin(atan((eh / (t * ew)))) * (cos(t) * eh))))
if (eh <= (-9d+28)) then
tmp = t_1
else if (eh <= 1.12d-127) then
tmp = abs((sin(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 = 1.0 / Math.abs((1.0 / (Math.sin(Math.atan((eh / (t * ew)))) * (Math.cos(t) * eh))));
double tmp;
if (eh <= -9e+28) {
tmp = t_1;
} else if (eh <= 1.12e-127) {
tmp = Math.abs((Math.sin(t) * ew));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = 1.0 / math.fabs((1.0 / (math.sin(math.atan((eh / (t * ew)))) * (math.cos(t) * eh)))) tmp = 0 if eh <= -9e+28: tmp = t_1 elif eh <= 1.12e-127: tmp = math.fabs((math.sin(t) * ew)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(1.0 / abs(Float64(1.0 / Float64(sin(atan(Float64(eh / Float64(t * ew)))) * Float64(cos(t) * eh))))) tmp = 0.0 if (eh <= -9e+28) tmp = t_1; elseif (eh <= 1.12e-127) tmp = abs(Float64(sin(t) * ew)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = 1.0 / abs((1.0 / (sin(atan((eh / (t * ew)))) * (cos(t) * eh)))); tmp = 0.0; if (eh <= -9e+28) tmp = t_1; elseif (eh <= 1.12e-127) tmp = abs((sin(t) * ew)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(1.0 / N[Abs[N[(1.0 / N[(N[Sin[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -9e+28], t$95$1, If[LessEqual[eh, 1.12e-127], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{1}{\left|\frac{1}{\sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) \cdot \left(\cos t \cdot eh\right)}\right|}\\
\mathbf{if}\;eh \leq -9 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 1.12 \cdot 10^{-127}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -8.9999999999999994e28 or 1.1199999999999999e-127 < eh Initial program 99.8%
Applied rewrites93.2%
Taylor expanded in ew around 0
associate-*r*N/A
lower-*.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-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6481.8
Applied rewrites81.8%
Taylor expanded in t around 0
Applied rewrites68.4%
if -8.9999999999999994e28 < eh < 1.1199999999999999e-127Initial program 99.8%
Applied rewrites79.7%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6469.9
Applied rewrites69.9%
Applied rewrites70.0%
Final simplification69.0%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (sin t) ew)))) (if (<= t -1e-36) t_1 (if (<= t 3.3e-7) (fabs (- eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * ew));
double tmp;
if (t <= -1e-36) {
tmp = t_1;
} else if (t <= 3.3e-7) {
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 <= (-1d-36)) then
tmp = t_1
else if (t <= 3.3d-7) 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 <= -1e-36) {
tmp = t_1;
} else if (t <= 3.3e-7) {
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 <= -1e-36: tmp = t_1 elif t <= 3.3e-7: 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 <= -1e-36) tmp = t_1; elseif (t <= 3.3e-7) 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 <= -1e-36) tmp = t_1; elseif (t <= 3.3e-7) 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, -1e-36], t$95$1, If[LessEqual[t, 3.3e-7], 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 -1 \cdot 10^{-36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{-7}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.9999999999999994e-37 or 3.3000000000000002e-7 < t Initial program 99.6%
Applied rewrites90.2%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6456.7
Applied rewrites56.7%
Applied rewrites56.7%
if -9.9999999999999994e-37 < t < 3.3000000000000002e-7Initial program 100.0%
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
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.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 (* (sin t) ew))) (if (<= t -4.4e+47) t_1 (if (<= t 8.6e-7) (fabs (- eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = sin(t) * ew;
double tmp;
if (t <= -4.4e+47) {
tmp = t_1;
} else if (t <= 8.6e-7) {
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 = sin(t) * ew
if (t <= (-4.4d+47)) then
tmp = t_1
else if (t <= 8.6d-7) 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.sin(t) * ew;
double tmp;
if (t <= -4.4e+47) {
tmp = t_1;
} else if (t <= 8.6e-7) {
tmp = Math.abs(-eh);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.sin(t) * ew tmp = 0 if t <= -4.4e+47: tmp = t_1 elif t <= 8.6e-7: tmp = math.fabs(-eh) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(sin(t) * ew) tmp = 0.0 if (t <= -4.4e+47) tmp = t_1; elseif (t <= 8.6e-7) tmp = abs(Float64(-eh)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = sin(t) * ew; tmp = 0.0; if (t <= -4.4e+47) tmp = t_1; elseif (t <= 8.6e-7) tmp = abs(-eh); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]}, If[LessEqual[t, -4.4e+47], t$95$1, If[LessEqual[t, 8.6e-7], N[Abs[(-eh)], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin t \cdot ew\\
\mathbf{if}\;t \leq -4.4 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.6 \cdot 10^{-7}:\\
\;\;\;\;\left|-eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.3999999999999999e47 or 8.6000000000000002e-7 < t Initial program 99.6%
Applied rewrites89.6%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6457.8
Applied rewrites57.8%
Applied rewrites25.2%
if -4.3999999999999999e47 < t < 8.6000000000000002e-7Initial program 99.9%
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
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6471.6
Applied rewrites71.6%
Applied rewrites10.6%
Taylor expanded in eh around -inf
Applied rewrites72.0%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (- eh))))
(if (<= eh -1.15e-129)
t_1
(if (<= eh 6.8e-229) (/ 1.0 (fabs (/ 1.0 (* t ew)))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs(-eh);
double tmp;
if (eh <= -1.15e-129) {
tmp = t_1;
} else if (eh <= 6.8e-229) {
tmp = 1.0 / fabs((1.0 / (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.15d-129)) then
tmp = t_1
else if (eh <= 6.8d-229) then
tmp = 1.0d0 / abs((1.0d0 / (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.15e-129) {
tmp = t_1;
} else if (eh <= 6.8e-229) {
tmp = 1.0 / Math.abs((1.0 / (t * ew)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs(-eh) tmp = 0 if eh <= -1.15e-129: tmp = t_1 elif eh <= 6.8e-229: tmp = 1.0 / math.fabs((1.0 / (t * ew))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(-eh)) tmp = 0.0 if (eh <= -1.15e-129) tmp = t_1; elseif (eh <= 6.8e-229) tmp = Float64(1.0 / abs(Float64(1.0 / 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.15e-129) tmp = t_1; elseif (eh <= 6.8e-229) tmp = 1.0 / abs((1.0 / (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.15e-129], t$95$1, If[LessEqual[eh, 6.8e-229], N[(1.0 / N[Abs[N[(1.0 / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|-eh\right|\\
\mathbf{if}\;eh \leq -1.15 \cdot 10^{-129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 6.8 \cdot 10^{-229}:\\
\;\;\;\;\frac{1}{\left|\frac{1}{t \cdot ew}\right|}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.15e-129 or 6.7999999999999998e-229 < eh Initial 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
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.f6450.4
Applied rewrites50.4%
Applied rewrites8.9%
Taylor expanded in eh around -inf
Applied rewrites50.9%
if -1.15e-129 < eh < 6.7999999999999998e-229Initial program 99.7%
Applied rewrites72.2%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6485.2
Applied rewrites85.2%
Taylor expanded in t around 0
Applied rewrites35.7%
Final simplification47.8%
(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
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-cos.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))))))))