
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(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 * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin 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) (tan t)) ew)))) (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(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 * tan(t)) / ew))
code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((-eh * math.tan(t)) / ew)) return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)) return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (tan t) eh) (- ew))))) (fabs (- (* (cos t_1) (* (cos t) ew)) (* (sin t_1) (* (sin t) eh))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((tan(t) * eh) / -ew));
return fabs(((cos(t_1) * (cos(t) * ew)) - (sin(t_1) * (sin(t) * eh))));
}
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(((tan(t) * eh) / -ew))
code = abs(((cos(t_1) * (cos(t) * ew)) - (sin(t_1) * (sin(t) * eh))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((Math.tan(t) * eh) / -ew));
return Math.abs(((Math.cos(t_1) * (Math.cos(t) * ew)) - (Math.sin(t_1) * (Math.sin(t) * eh))));
}
def code(eh, ew, t): t_1 = math.atan(((math.tan(t) * eh) / -ew)) return math.fabs(((math.cos(t_1) * (math.cos(t) * ew)) - (math.sin(t_1) * (math.sin(t) * eh))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(tan(t) * eh) / Float64(-ew))) return abs(Float64(Float64(cos(t_1) * Float64(cos(t) * ew)) - Float64(sin(t_1) * Float64(sin(t) * eh)))) end
function tmp = code(eh, ew, t) t_1 = atan(((tan(t) * eh) / -ew)); tmp = abs(((cos(t_1) * (cos(t) * ew)) - (sin(t_1) * (sin(t) * eh)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[Cos[t$95$1], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t$95$1], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\tan t \cdot eh}{-ew}\right)\\
\left|\cos t\_1 \cdot \left(\cos t \cdot ew\right) - \sin t\_1 \cdot \left(\sin t \cdot eh\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (sin (atan (/ (* (tan t) eh) (- ew)))) (* (sin t) eh)) (* (/ (cos t) (sqrt (+ (pow (* (/ (tan t) ew) eh) 2.0) 1.0))) ew))))
double code(double eh, double ew, double t) {
return fabs(((sin(atan(((tan(t) * eh) / -ew))) * (sin(t) * eh)) - ((cos(t) / sqrt((pow(((tan(t) / ew) * eh), 2.0) + 1.0))) * 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(((tan(t) * eh) / -ew))) * (sin(t) * eh)) - ((cos(t) / sqrt(((((tan(t) / ew) * eh) ** 2.0d0) + 1.0d0))) * ew)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.sin(Math.atan(((Math.tan(t) * eh) / -ew))) * (Math.sin(t) * eh)) - ((Math.cos(t) / Math.sqrt((Math.pow(((Math.tan(t) / ew) * eh), 2.0) + 1.0))) * ew)));
}
def code(eh, ew, t): return math.fabs(((math.sin(math.atan(((math.tan(t) * eh) / -ew))) * (math.sin(t) * eh)) - ((math.cos(t) / math.sqrt((math.pow(((math.tan(t) / ew) * eh), 2.0) + 1.0))) * ew)))
function code(eh, ew, t) return abs(Float64(Float64(sin(atan(Float64(Float64(tan(t) * eh) / Float64(-ew)))) * Float64(sin(t) * eh)) - Float64(Float64(cos(t) / sqrt(Float64((Float64(Float64(tan(t) / ew) * eh) ^ 2.0) + 1.0))) * ew))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(atan(((tan(t) * eh) / -ew))) * (sin(t) * eh)) - ((cos(t) / sqrt(((((tan(t) / ew) * eh) ^ 2.0) + 1.0))) * ew))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[t], $MachinePrecision] / N[Sqrt[N[(N[Power[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin \tan^{-1} \left(\frac{\tan t \cdot eh}{-ew}\right) \cdot \left(\sin t \cdot eh\right) - \frac{\cos t}{\sqrt{{\left(\frac{\tan t}{ew} \cdot eh\right)}^{2} + 1}} \cdot ew\right|
\end{array}
Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.8%
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ (cos t) (/ 1.0 ew)) (* (sin (atan (/ (* (tan t) eh) (- ew)))) (* (sin t) eh)))))
double code(double eh, double ew, double t) {
return fabs(((cos(t) / (1.0 / ew)) - (sin(atan(((tan(t) * eh) / -ew))) * (sin(t) * 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(((cos(t) / (1.0d0 / ew)) - (sin(atan(((tan(t) * eh) / -ew))) * (sin(t) * eh))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.cos(t) / (1.0 / ew)) - (Math.sin(Math.atan(((Math.tan(t) * eh) / -ew))) * (Math.sin(t) * eh))));
}
def code(eh, ew, t): return math.fabs(((math.cos(t) / (1.0 / ew)) - (math.sin(math.atan(((math.tan(t) * eh) / -ew))) * (math.sin(t) * eh))))
function code(eh, ew, t) return abs(Float64(Float64(cos(t) / Float64(1.0 / ew)) - Float64(sin(atan(Float64(Float64(tan(t) * eh) / Float64(-ew)))) * Float64(sin(t) * eh)))) end
function tmp = code(eh, ew, t) tmp = abs(((cos(t) / (1.0 / ew)) - (sin(atan(((tan(t) * eh) / -ew))) * (sin(t) * eh)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Cos[t], $MachinePrecision] / N[(1.0 / ew), $MachinePrecision]), $MachinePrecision] - N[(N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\cos t}{\frac{1}{ew}} - \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{-ew}\right) \cdot \left(\sin t \cdot eh\right)\right|
\end{array}
Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in t around 0
Applied rewrites98.2%
Final simplification98.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(/
1.0
(fabs
(/
1.0
(fma
(* (* 0.5 eh) (* (/ (sin t) ew) (tan t)))
eh
(* (cos t) ew)))))))
(if (<= t -0.00085)
t_1
(if (<= t 0.00047)
(fabs (- ew (* (* eh t) (sin (atan (/ (* (tan t) eh) (- ew)))))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = 1.0 / fabs((1.0 / fma(((0.5 * eh) * ((sin(t) / ew) * tan(t))), eh, (cos(t) * ew))));
double tmp;
if (t <= -0.00085) {
tmp = t_1;
} else if (t <= 0.00047) {
tmp = fabs((ew - ((eh * t) * sin(atan(((tan(t) * eh) / -ew))))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(1.0 / abs(Float64(1.0 / fma(Float64(Float64(0.5 * eh) * Float64(Float64(sin(t) / ew) * tan(t))), eh, Float64(cos(t) * ew))))) tmp = 0.0 if (t <= -0.00085) tmp = t_1; elseif (t <= 0.00047) tmp = abs(Float64(ew - Float64(Float64(eh * t) * sin(atan(Float64(Float64(tan(t) * eh) / Float64(-ew))))))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(1.0 / N[Abs[N[(1.0 / N[(N[(N[(0.5 * eh), $MachinePrecision] * N[(N[(N[Sin[t], $MachinePrecision] / ew), $MachinePrecision] * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eh + N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -0.00085], t$95$1, If[LessEqual[t, 0.00047], N[Abs[N[(ew - N[(N[(eh * t), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{1}{\left|\frac{1}{\mathsf{fma}\left(\left(0.5 \cdot eh\right) \cdot \left(\frac{\sin t}{ew} \cdot \tan t\right), eh, \cos t \cdot ew\right)}\right|}\\
\mathbf{if}\;t \leq -0.00085:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.00047:\\
\;\;\;\;\left|ew - \left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{-ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -8.49999999999999953e-4 or 4.69999999999999986e-4 < t Initial program 99.7%
Applied rewrites70.4%
Taylor expanded in eh around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
unpow2N/A
lower-*.f64N/A
Applied rewrites50.2%
Applied rewrites55.8%
if -8.49999999999999953e-4 < t < 4.69999999999999986e-4Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in t around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-tan.f6498.9
Applied rewrites98.9%
Final simplification77.3%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ 1.0 (fabs (/ 1.0 ew)))))
(if (<= ew -1.55e-25)
t_1
(if (<= ew 1.3e-307)
(/ 1.0 (fabs (/ 1.0 (* eh t))))
(if (<= ew 2.3e-176) (* (sin t) eh) t_1)))))
double code(double eh, double ew, double t) {
double t_1 = 1.0 / fabs((1.0 / ew));
double tmp;
if (ew <= -1.55e-25) {
tmp = t_1;
} else if (ew <= 1.3e-307) {
tmp = 1.0 / fabs((1.0 / (eh * t)));
} else if (ew <= 2.3e-176) {
tmp = sin(t) * 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 = 1.0d0 / abs((1.0d0 / ew))
if (ew <= (-1.55d-25)) then
tmp = t_1
else if (ew <= 1.3d-307) then
tmp = 1.0d0 / abs((1.0d0 / (eh * t)))
else if (ew <= 2.3d-176) then
tmp = sin(t) * eh
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 / ew));
double tmp;
if (ew <= -1.55e-25) {
tmp = t_1;
} else if (ew <= 1.3e-307) {
tmp = 1.0 / Math.abs((1.0 / (eh * t)));
} else if (ew <= 2.3e-176) {
tmp = Math.sin(t) * eh;
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = 1.0 / math.fabs((1.0 / ew)) tmp = 0 if ew <= -1.55e-25: tmp = t_1 elif ew <= 1.3e-307: tmp = 1.0 / math.fabs((1.0 / (eh * t))) elif ew <= 2.3e-176: tmp = math.sin(t) * eh else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(1.0 / abs(Float64(1.0 / ew))) tmp = 0.0 if (ew <= -1.55e-25) tmp = t_1; elseif (ew <= 1.3e-307) tmp = Float64(1.0 / abs(Float64(1.0 / Float64(eh * t)))); elseif (ew <= 2.3e-176) tmp = Float64(sin(t) * eh); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = 1.0 / abs((1.0 / ew)); tmp = 0.0; if (ew <= -1.55e-25) tmp = t_1; elseif (ew <= 1.3e-307) tmp = 1.0 / abs((1.0 / (eh * t))); elseif (ew <= 2.3e-176) tmp = sin(t) * eh; 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 / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ew, -1.55e-25], t$95$1, If[LessEqual[ew, 1.3e-307], N[(1.0 / N[Abs[N[(1.0 / N[(eh * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[ew, 2.3e-176], N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{1}{\left|\frac{1}{ew}\right|}\\
\mathbf{if}\;ew \leq -1.55 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 1.3 \cdot 10^{-307}:\\
\;\;\;\;\frac{1}{\left|\frac{1}{eh \cdot t}\right|}\\
\mathbf{elif}\;ew \leq 2.3 \cdot 10^{-176}:\\
\;\;\;\;\sin t \cdot eh\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -1.54999999999999997e-25 or 2.3000000000000001e-176 < ew Initial program 99.8%
Applied rewrites90.3%
Taylor expanded in t around 0
lower-/.f6452.0
Applied rewrites52.0%
if -1.54999999999999997e-25 < ew < 1.29999999999999998e-307Initial program 99.9%
Applied rewrites56.0%
Taylor expanded in ew around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6470.9
Applied rewrites70.9%
Taylor expanded in t around 0
Applied rewrites41.8%
if 1.29999999999999998e-307 < ew < 2.3000000000000001e-176Initial program 99.9%
Applied rewrites43.1%
Taylor expanded in ew around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6481.9
Applied rewrites81.9%
lift-/.f64N/A
lift-fabs.f64N/A
lift-/.f64N/A
inv-powN/A
Applied rewrites52.1%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (cos t) ew)))) (if (<= ew -3.35e-25) t_1 (if (<= ew 3.5e-115) (fabs (* (sin t) eh)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((cos(t) * ew));
double tmp;
if (ew <= -3.35e-25) {
tmp = t_1;
} else if (ew <= 3.5e-115) {
tmp = fabs((sin(t) * 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((cos(t) * ew))
if (ew <= (-3.35d-25)) then
tmp = t_1
else if (ew <= 3.5d-115) then
tmp = abs((sin(t) * 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.cos(t) * ew));
double tmp;
if (ew <= -3.35e-25) {
tmp = t_1;
} else if (ew <= 3.5e-115) {
tmp = Math.abs((Math.sin(t) * eh));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.cos(t) * ew)) tmp = 0 if ew <= -3.35e-25: tmp = t_1 elif ew <= 3.5e-115: tmp = math.fabs((math.sin(t) * eh)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(cos(t) * ew)) tmp = 0.0 if (ew <= -3.35e-25) tmp = t_1; elseif (ew <= 3.5e-115) tmp = abs(Float64(sin(t) * eh)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((cos(t) * ew)); tmp = 0.0; if (ew <= -3.35e-25) tmp = t_1; elseif (ew <= 3.5e-115) tmp = abs((sin(t) * eh)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -3.35e-25], t$95$1, If[LessEqual[ew, 3.5e-115], N[Abs[N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\cos t \cdot ew\right|\\
\mathbf{if}\;ew \leq -3.35 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 3.5 \cdot 10^{-115}:\\
\;\;\;\;\left|\sin t \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -3.35000000000000016e-25 or 3.5000000000000002e-115 < ew Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6479.9
Applied rewrites79.9%
if -3.35000000000000016e-25 < ew < 3.5000000000000002e-115Initial program 99.9%
Applied rewrites55.0%
Taylor expanded in ew around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6472.1
Applied rewrites72.1%
lift-/.f64N/A
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
metadata-evalN/A
Applied rewrites72.2%
(FPCore (eh ew t) :precision binary64 (if (<= eh 1.6e+195) (fabs (* (cos t) ew)) (/ 1.0 (fabs (/ 1.0 (* eh t))))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= 1.6e+195) {
tmp = fabs((cos(t) * ew));
} else {
tmp = 1.0 / fabs((1.0 / (eh * 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.6d+195) then
tmp = abs((cos(t) * ew))
else
tmp = 1.0d0 / abs((1.0d0 / (eh * t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= 1.6e+195) {
tmp = Math.abs((Math.cos(t) * ew));
} else {
tmp = 1.0 / Math.abs((1.0 / (eh * t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= 1.6e+195: tmp = math.fabs((math.cos(t) * ew)) else: tmp = 1.0 / math.fabs((1.0 / (eh * t))) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= 1.6e+195) tmp = abs(Float64(cos(t) * ew)); else tmp = Float64(1.0 / abs(Float64(1.0 / Float64(eh * t)))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= 1.6e+195) tmp = abs((cos(t) * ew)); else tmp = 1.0 / abs((1.0 / (eh * t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, 1.6e+195], N[Abs[N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[(1.0 / N[Abs[N[(1.0 / N[(eh * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq 1.6 \cdot 10^{+195}:\\
\;\;\;\;\left|\cos t \cdot ew\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left|\frac{1}{eh \cdot t}\right|}\\
\end{array}
\end{array}
if eh < 1.59999999999999991e195Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in ew around inf
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6467.1
Applied rewrites67.1%
if 1.59999999999999991e195 < eh Initial program 99.8%
Applied rewrites28.5%
Taylor expanded in ew around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6489.0
Applied rewrites89.0%
Taylor expanded in t around 0
Applied rewrites49.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ 1.0 (fabs (/ 1.0 ew)))))
(if (<= ew -1.55e-25)
t_1
(if (<= ew 1.1e-161) (/ 1.0 (fabs (/ 1.0 (* eh t)))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = 1.0 / fabs((1.0 / ew));
double tmp;
if (ew <= -1.55e-25) {
tmp = t_1;
} else if (ew <= 1.1e-161) {
tmp = 1.0 / fabs((1.0 / (eh * t)));
} 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 / ew))
if (ew <= (-1.55d-25)) then
tmp = t_1
else if (ew <= 1.1d-161) then
tmp = 1.0d0 / abs((1.0d0 / (eh * t)))
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 / ew));
double tmp;
if (ew <= -1.55e-25) {
tmp = t_1;
} else if (ew <= 1.1e-161) {
tmp = 1.0 / Math.abs((1.0 / (eh * t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = 1.0 / math.fabs((1.0 / ew)) tmp = 0 if ew <= -1.55e-25: tmp = t_1 elif ew <= 1.1e-161: tmp = 1.0 / math.fabs((1.0 / (eh * t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(1.0 / abs(Float64(1.0 / ew))) tmp = 0.0 if (ew <= -1.55e-25) tmp = t_1; elseif (ew <= 1.1e-161) tmp = Float64(1.0 / abs(Float64(1.0 / Float64(eh * t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = 1.0 / abs((1.0 / ew)); tmp = 0.0; if (ew <= -1.55e-25) tmp = t_1; elseif (ew <= 1.1e-161) tmp = 1.0 / abs((1.0 / (eh * t))); 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 / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ew, -1.55e-25], t$95$1, If[LessEqual[ew, 1.1e-161], N[(1.0 / N[Abs[N[(1.0 / N[(eh * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{1}{\left|\frac{1}{ew}\right|}\\
\mathbf{if}\;ew \leq -1.55 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 1.1 \cdot 10^{-161}:\\
\;\;\;\;\frac{1}{\left|\frac{1}{eh \cdot t}\right|}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -1.54999999999999997e-25 or 1.10000000000000001e-161 < ew Initial program 99.8%
Applied rewrites90.0%
Taylor expanded in t around 0
lower-/.f6453.0
Applied rewrites53.0%
if -1.54999999999999997e-25 < ew < 1.10000000000000001e-161Initial program 99.9%
Applied rewrites55.2%
Taylor expanded in ew around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6472.9
Applied rewrites72.9%
Taylor expanded in t around 0
Applied rewrites37.4%
(FPCore (eh ew t) :precision binary64 (/ 1.0 (fabs (/ 1.0 ew))))
double code(double eh, double ew, double t) {
return 1.0 / fabs((1.0 / ew));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = 1.0d0 / abs((1.0d0 / ew))
end function
public static double code(double eh, double ew, double t) {
return 1.0 / Math.abs((1.0 / ew));
}
def code(eh, ew, t): return 1.0 / math.fabs((1.0 / ew))
function code(eh, ew, t) return Float64(1.0 / abs(Float64(1.0 / ew))) end
function tmp = code(eh, ew, t) tmp = 1.0 / abs((1.0 / ew)); end
code[eh_, ew_, t_] := N[(1.0 / N[Abs[N[(1.0 / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\left|\frac{1}{ew}\right|}
\end{array}
Initial program 99.8%
Applied rewrites77.4%
Taylor expanded in t around 0
lower-/.f6441.5
Applied rewrites41.5%
herbie shell --seed 2024235
(FPCore (eh ew t)
:name "Example 2 from Robby"
:precision binary64
(fabs (- (* (* ew (cos t)) (cos (atan (/ (* (- eh) (tan t)) ew)))) (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))