
(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 8 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 (* eh (/ (tan t) ew))))) (fabs (fma (* (sin t_1) eh) (sin t) (* (* (cos t) ew) (cos t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh * (tan(t) / ew)));
return fabs(fma((sin(t_1) * eh), sin(t), ((cos(t) * ew) * cos(t_1))));
}
function code(eh, ew, t) t_1 = atan(Float64(eh * Float64(tan(t) / ew))) return abs(fma(Float64(sin(t_1) * eh), sin(t), Float64(Float64(cos(t) * ew) * cos(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$95$1], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[t], $MachinePrecision] + N[(N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\\
\left|\mathsf{fma}\left(\sin t\_1 \cdot eh, \sin t, \left(\cos t \cdot ew\right) \cdot \cos t\_1\right)\right|
\end{array}
\end{array}
Initial program 99.7%
Applied rewrites99.7%
Final simplification99.7%
(FPCore (eh ew t) :precision binary64 (fabs (- (* (* (sin t) eh) (sin (atan (/ (* (- eh) t) ew)))) (* (cos (atan (/ (* eh (tan t)) (- ew)))) (* (cos t) ew)))))
double code(double eh, double ew, double t) {
return fabs((((sin(t) * eh) * sin(atan(((-eh * t) / ew)))) - (cos(atan(((eh * tan(t)) / -ew))) * (cos(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) * eh) * sin(atan(((-eh * t) / ew)))) - (cos(atan(((eh * tan(t)) / -ew))) * (cos(t) * ew))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((Math.sin(t) * eh) * Math.sin(Math.atan(((-eh * t) / ew)))) - (Math.cos(Math.atan(((eh * Math.tan(t)) / -ew))) * (Math.cos(t) * ew))));
}
def code(eh, ew, t): return math.fabs((((math.sin(t) * eh) * math.sin(math.atan(((-eh * t) / ew)))) - (math.cos(math.atan(((eh * math.tan(t)) / -ew))) * (math.cos(t) * ew))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(sin(t) * eh) * sin(atan(Float64(Float64(Float64(-eh) * t) / ew)))) - Float64(cos(atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))) * Float64(cos(t) * ew)))) end
function tmp = code(eh, ew, t) tmp = abs((((sin(t) * eh) * sin(atan(((-eh * t) / ew)))) - (cos(atan(((eh * tan(t)) / -ew))) * (cos(t) * ew)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) * t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(\sin t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot t}{ew}\right) - \cos \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) \cdot \left(\cos t \cdot ew\right)\right|
\end{array}
Initial program 99.7%
Taylor expanded in t around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6499.2
Applied rewrites99.2%
Final simplification99.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (sin t) eh))))
(if (<= eh -7.5e+206)
t_1
(if (<= eh 6.6e+223)
(fabs
(/
(fma (* eh (/ (tan t) ew)) (* (- (sin t)) eh) (* (- ew) (cos t)))
(/ 1.0 (pow (+ 1.0 (pow (/ ew (* eh (tan t))) -2.0)) -0.5))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * eh));
double tmp;
if (eh <= -7.5e+206) {
tmp = t_1;
} else if (eh <= 6.6e+223) {
tmp = fabs((fma((eh * (tan(t) / ew)), (-sin(t) * eh), (-ew * cos(t))) / (1.0 / pow((1.0 + pow((ew / (eh * tan(t))), -2.0)), -0.5))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * eh)) tmp = 0.0 if (eh <= -7.5e+206) tmp = t_1; elseif (eh <= 6.6e+223) tmp = abs(Float64(fma(Float64(eh * Float64(tan(t) / ew)), Float64(Float64(-sin(t)) * eh), Float64(Float64(-ew) * cos(t))) / Float64(1.0 / (Float64(1.0 + (Float64(ew / Float64(eh * tan(t))) ^ -2.0)) ^ -0.5)))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -7.5e+206], t$95$1, If[LessEqual[eh, 6.6e+223], N[Abs[N[(N[(N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] * N[((-N[Sin[t], $MachinePrecision]) * eh), $MachinePrecision] + N[((-ew) * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[Power[N[(1.0 + N[Power[N[(ew / N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot eh\right|\\
\mathbf{if}\;eh \leq -7.5 \cdot 10^{+206}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 6.6 \cdot 10^{+223}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(eh \cdot \frac{\tan t}{ew}, \left(-\sin t\right) \cdot eh, \left(-ew\right) \cdot \cos t\right)}{\frac{1}{{\left(1 + {\left(\frac{ew}{eh \cdot \tan t}\right)}^{-2}\right)}^{-0.5}}}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -7.49999999999999958e206 or 6.5999999999999999e223 < eh Initial program 99.8%
Applied rewrites16.9%
Applied rewrites14.0%
Taylor expanded in eh around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6490.4
Applied rewrites90.4%
if -7.49999999999999958e206 < eh < 6.5999999999999999e223Initial program 99.7%
Applied rewrites72.3%
Applied rewrites86.9%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift-sin.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6486.9
Applied rewrites86.9%
Final simplification87.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (sin t) eh)) (t_2 (fabs t_1)))
(if (<= eh -7.5e+206)
t_2
(if (<= eh 6.6e+223)
(fabs
(/
(+ (* t_1 (* eh (/ (tan t) ew))) (* (cos t) ew))
(/ 1.0 (pow (+ 1.0 (pow (/ ew (* eh (tan t))) -2.0)) -0.5))))
t_2))))
double code(double eh, double ew, double t) {
double t_1 = sin(t) * eh;
double t_2 = fabs(t_1);
double tmp;
if (eh <= -7.5e+206) {
tmp = t_2;
} else if (eh <= 6.6e+223) {
tmp = fabs((((t_1 * (eh * (tan(t) / ew))) + (cos(t) * ew)) / (1.0 / pow((1.0 + pow((ew / (eh * tan(t))), -2.0)), -0.5))));
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = sin(t) * eh
t_2 = abs(t_1)
if (eh <= (-7.5d+206)) then
tmp = t_2
else if (eh <= 6.6d+223) then
tmp = abs((((t_1 * (eh * (tan(t) / ew))) + (cos(t) * ew)) / (1.0d0 / ((1.0d0 + ((ew / (eh * tan(t))) ** (-2.0d0))) ** (-0.5d0)))))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.sin(t) * eh;
double t_2 = Math.abs(t_1);
double tmp;
if (eh <= -7.5e+206) {
tmp = t_2;
} else if (eh <= 6.6e+223) {
tmp = Math.abs((((t_1 * (eh * (Math.tan(t) / ew))) + (Math.cos(t) * ew)) / (1.0 / Math.pow((1.0 + Math.pow((ew / (eh * Math.tan(t))), -2.0)), -0.5))));
} else {
tmp = t_2;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.sin(t) * eh t_2 = math.fabs(t_1) tmp = 0 if eh <= -7.5e+206: tmp = t_2 elif eh <= 6.6e+223: tmp = math.fabs((((t_1 * (eh * (math.tan(t) / ew))) + (math.cos(t) * ew)) / (1.0 / math.pow((1.0 + math.pow((ew / (eh * math.tan(t))), -2.0)), -0.5)))) else: tmp = t_2 return tmp
function code(eh, ew, t) t_1 = Float64(sin(t) * eh) t_2 = abs(t_1) tmp = 0.0 if (eh <= -7.5e+206) tmp = t_2; elseif (eh <= 6.6e+223) tmp = abs(Float64(Float64(Float64(t_1 * Float64(eh * Float64(tan(t) / ew))) + Float64(cos(t) * ew)) / Float64(1.0 / (Float64(1.0 + (Float64(ew / Float64(eh * tan(t))) ^ -2.0)) ^ -0.5)))); else tmp = t_2; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = sin(t) * eh; t_2 = abs(t_1); tmp = 0.0; if (eh <= -7.5e+206) tmp = t_2; elseif (eh <= 6.6e+223) tmp = abs((((t_1 * (eh * (tan(t) / ew))) + (cos(t) * ew)) / (1.0 / ((1.0 + ((ew / (eh * tan(t))) ^ -2.0)) ^ -0.5)))); else tmp = t_2; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[Abs[t$95$1], $MachinePrecision]}, If[LessEqual[eh, -7.5e+206], t$95$2, If[LessEqual[eh, 6.6e+223], N[Abs[N[(N[(N[(t$95$1 * N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[Power[N[(1.0 + N[Power[N[(ew / N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin t \cdot eh\\
t_2 := \left|t\_1\right|\\
\mathbf{if}\;eh \leq -7.5 \cdot 10^{+206}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 6.6 \cdot 10^{+223}:\\
\;\;\;\;\left|\frac{t\_1 \cdot \left(eh \cdot \frac{\tan t}{ew}\right) + \cos t \cdot ew}{\frac{1}{{\left(1 + {\left(\frac{ew}{eh \cdot \tan t}\right)}^{-2}\right)}^{-0.5}}}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -7.49999999999999958e206 or 6.5999999999999999e223 < eh Initial program 99.8%
Applied rewrites16.9%
Applied rewrites14.0%
Taylor expanded in eh around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6490.4
Applied rewrites90.4%
if -7.49999999999999958e206 < eh < 6.5999999999999999e223Initial program 99.7%
Applied rewrites72.3%
Applied rewrites86.9%
Final simplification87.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (sin t) eh))
(t_2
(*
(fabs (fma (/ t_1 ew) (* eh (tan t)) (* (cos t) ew)))
(cos (atan (* eh (/ (tan t) ew)))))))
(if (<= ew -1.15e-68) t_2 (if (<= ew 5.2e-191) (fabs t_1) t_2))))
double code(double eh, double ew, double t) {
double t_1 = sin(t) * eh;
double t_2 = fabs(fma((t_1 / ew), (eh * tan(t)), (cos(t) * ew))) * cos(atan((eh * (tan(t) / ew))));
double tmp;
if (ew <= -1.15e-68) {
tmp = t_2;
} else if (ew <= 5.2e-191) {
tmp = fabs(t_1);
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(sin(t) * eh) t_2 = Float64(abs(fma(Float64(t_1 / ew), Float64(eh * tan(t)), Float64(cos(t) * ew))) * cos(atan(Float64(eh * Float64(tan(t) / ew))))) tmp = 0.0 if (ew <= -1.15e-68) tmp = t_2; elseif (ew <= 5.2e-191) tmp = abs(t_1); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[N[(N[(t$95$1 / ew), $MachinePrecision] * N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ew, -1.15e-68], t$95$2, If[LessEqual[ew, 5.2e-191], N[Abs[t$95$1], $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin t \cdot eh\\
t_2 := \left|\mathsf{fma}\left(\frac{t\_1}{ew}, eh \cdot \tan t, \cos t \cdot ew\right)\right| \cdot \cos \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\\
\mathbf{if}\;ew \leq -1.15 \cdot 10^{-68}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;ew \leq 5.2 \cdot 10^{-191}:\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if ew < -1.14999999999999998e-68 or 5.19999999999999972e-191 < ew Initial program 99.7%
Applied rewrites99.7%
Applied rewrites77.1%
if -1.14999999999999998e-68 < ew < 5.19999999999999972e-191Initial program 99.8%
Applied rewrites24.1%
Applied rewrites46.7%
Taylor expanded in eh around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6483.8
Applied rewrites83.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* (sin t) eh))))
(if (<= eh -1.1e+127)
t_1
(if (<= eh 1.25e-29) (fabs (* (- ew) (cos t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * eh));
double tmp;
if (eh <= -1.1e+127) {
tmp = t_1;
} else if (eh <= 1.25e-29) {
tmp = fabs((-ew * cos(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 = abs((sin(t) * eh))
if (eh <= (-1.1d+127)) then
tmp = t_1
else if (eh <= 1.25d-29) then
tmp = abs((-ew * cos(t)))
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) * eh));
double tmp;
if (eh <= -1.1e+127) {
tmp = t_1;
} else if (eh <= 1.25e-29) {
tmp = Math.abs((-ew * Math.cos(t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.sin(t) * eh)) tmp = 0 if eh <= -1.1e+127: tmp = t_1 elif eh <= 1.25e-29: tmp = math.fabs((-ew * math.cos(t))) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * eh)) tmp = 0.0 if (eh <= -1.1e+127) tmp = t_1; elseif (eh <= 1.25e-29) tmp = abs(Float64(Float64(-ew) * cos(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((sin(t) * eh)); tmp = 0.0; if (eh <= -1.1e+127) tmp = t_1; elseif (eh <= 1.25e-29) tmp = abs((-ew * cos(t))); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -1.1e+127], t$95$1, If[LessEqual[eh, 1.25e-29], N[Abs[N[((-ew) * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot eh\right|\\
\mathbf{if}\;eh \leq -1.1 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 1.25 \cdot 10^{-29}:\\
\;\;\;\;\left|\left(-ew\right) \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.1000000000000001e127 or 1.24999999999999996e-29 < eh Initial program 99.8%
Applied rewrites35.0%
Applied rewrites49.7%
Taylor expanded in eh around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6471.6
Applied rewrites71.6%
if -1.1000000000000001e127 < eh < 1.24999999999999996e-29Initial program 99.7%
Applied rewrites83.8%
Applied rewrites93.8%
Taylor expanded in ew around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f6482.9
Applied rewrites82.9%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (fabs (* (sin t) eh)))) (if (<= t -2.5e-10) t_1 (if (<= t 5.8e-11) (fabs (- ew)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((sin(t) * eh));
double tmp;
if (t <= -2.5e-10) {
tmp = t_1;
} else if (t <= 5.8e-11) {
tmp = fabs(-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((sin(t) * eh))
if (t <= (-2.5d-10)) then
tmp = t_1
else if (t <= 5.8d-11) then
tmp = abs(-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.sin(t) * eh));
double tmp;
if (t <= -2.5e-10) {
tmp = t_1;
} else if (t <= 5.8e-11) {
tmp = Math.abs(-ew);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((math.sin(t) * eh)) tmp = 0 if t <= -2.5e-10: tmp = t_1 elif t <= 5.8e-11: tmp = math.fabs(-ew) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(sin(t) * eh)) tmp = 0.0 if (t <= -2.5e-10) tmp = t_1; elseif (t <= 5.8e-11) tmp = abs(Float64(-ew)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((sin(t) * eh)); tmp = 0.0; if (t <= -2.5e-10) tmp = t_1; elseif (t <= 5.8e-11) tmp = abs(-ew); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -2.5e-10], t$95$1, If[LessEqual[t, 5.8e-11], N[Abs[(-ew)], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin t \cdot eh\right|\\
\mathbf{if}\;t \leq -2.5 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{-11}:\\
\;\;\;\;\left|-ew\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.50000000000000016e-10 or 5.8e-11 < t Initial program 99.6%
Applied rewrites53.0%
Applied rewrites65.9%
Taylor expanded in eh around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6453.4
Applied rewrites53.4%
if -2.50000000000000016e-10 < t < 5.8e-11Initial program 100.0%
Applied rewrites78.3%
Applied rewrites88.9%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f6477.9
Applied rewrites77.9%
(FPCore (eh ew t) :precision binary64 (fabs (- ew)))
double code(double eh, double ew, double t) {
return fabs(-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(-ew)
end function
public static double code(double eh, double ew, double t) {
return Math.abs(-ew);
}
def code(eh, ew, t): return math.fabs(-ew)
function code(eh, ew, t) return abs(Float64(-ew)) end
function tmp = code(eh, ew, t) tmp = abs(-ew); end
code[eh_, ew_, t_] := N[Abs[(-ew)], $MachinePrecision]
\begin{array}{l}
\\
\left|-ew\right|
\end{array}
Initial program 99.7%
Applied rewrites63.6%
Applied rewrites75.5%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f6440.6
Applied rewrites40.6%
herbie shell --seed 2024276
(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)))))))