
(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 11 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 ew (* (cos t_1) (- (cos t))) (* eh (* (sin t) (sin t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = atan((eh * (tan(t) / -ew)));
return fabs(fma(ew, (cos(t_1) * -cos(t)), (eh * (sin(t) * sin(t_1)))));
}
function code(eh, ew, t) t_1 = atan(Float64(eh * Float64(tan(t) / Float64(-ew)))) return abs(fma(ew, Float64(cos(t_1) * Float64(-cos(t))), Float64(eh * Float64(sin(t) * 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[(ew * N[(N[Cos[t$95$1], $MachinePrecision] * (-N[Cos[t], $MachinePrecision])), $MachinePrecision] + N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $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(ew, \cos t\_1 \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin t\_1\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew)))) (fabs (- (* (cos t_1) (* ew (cos t))) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((-eh * tan(t)) / ew));
return fabs(((cos(t_1) * (ew * cos(t))) - ((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(((cos(t_1) * (ew * cos(t))) - ((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(((Math.cos(t_1) * (ew * Math.cos(t))) - ((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(((math.cos(t_1) * (ew * math.cos(t))) - ((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(cos(t_1) * Float64(ew * cos(t))) - Float64(Float64(eh * sin(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((-eh * tan(t)) / ew)); tmp = abs(((cos(t_1) * (ew * cos(t))) - ((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[Cos[t$95$1], $MachinePrecision] * N[(ew * N[Cos[t], $MachinePrecision]), $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|\cos t\_1 \cdot \left(ew \cdot \cos t\right) - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -1.4e-67) (not (<= ew 1.15e-126)))
(fabs
(*
ew
(+
(cos t)
(* eh (* (sin t) (/ (sin (atan (* (tan t) (/ eh (- ew))))) ew))))))
(fabs (+ ew (* (sin (atan (* eh (/ (tan t) (- ew))))) (* eh (sin t)))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.4e-67) || !(ew <= 1.15e-126)) {
tmp = fabs((ew * (cos(t) + (eh * (sin(t) * (sin(atan((tan(t) * (eh / -ew)))) / ew))))));
} else {
tmp = fabs((ew + (sin(atan((eh * (tan(t) / -ew)))) * (eh * sin(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 ((ew <= (-1.4d-67)) .or. (.not. (ew <= 1.15d-126))) then
tmp = abs((ew * (cos(t) + (eh * (sin(t) * (sin(atan((tan(t) * (eh / -ew)))) / ew))))))
else
tmp = abs((ew + (sin(atan((eh * (tan(t) / -ew)))) * (eh * sin(t)))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.4e-67) || !(ew <= 1.15e-126)) {
tmp = Math.abs((ew * (Math.cos(t) + (eh * (Math.sin(t) * (Math.sin(Math.atan((Math.tan(t) * (eh / -ew)))) / ew))))));
} else {
tmp = Math.abs((ew + (Math.sin(Math.atan((eh * (Math.tan(t) / -ew)))) * (eh * Math.sin(t)))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -1.4e-67) or not (ew <= 1.15e-126): tmp = math.fabs((ew * (math.cos(t) + (eh * (math.sin(t) * (math.sin(math.atan((math.tan(t) * (eh / -ew)))) / ew)))))) else: tmp = math.fabs((ew + (math.sin(math.atan((eh * (math.tan(t) / -ew)))) * (eh * math.sin(t))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -1.4e-67) || !(ew <= 1.15e-126)) tmp = abs(Float64(ew * Float64(cos(t) + Float64(eh * Float64(sin(t) * Float64(sin(atan(Float64(tan(t) * Float64(eh / Float64(-ew))))) / ew)))))); else tmp = abs(Float64(ew + Float64(sin(atan(Float64(eh * Float64(tan(t) / Float64(-ew))))) * Float64(eh * sin(t))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -1.4e-67) || ~((ew <= 1.15e-126))) tmp = abs((ew * (cos(t) + (eh * (sin(t) * (sin(atan((tan(t) * (eh / -ew)))) / ew)))))); else tmp = abs((ew + (sin(atan((eh * (tan(t) / -ew)))) * (eh * sin(t))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -1.4e-67], N[Not[LessEqual[ew, 1.15e-126]], $MachinePrecision]], N[Abs[N[(ew * N[(N[Cos[t], $MachinePrecision] + N[(eh * N[(N[Sin[t], $MachinePrecision] * N[(N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew + N[(N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.4 \cdot 10^{-67} \lor \neg \left(ew \leq 1.15 \cdot 10^{-126}\right):\\
\;\;\;\;\left|ew \cdot \left(\cos t + eh \cdot \left(\sin t \cdot \frac{\sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-ew}\right)}{ew}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew + \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right) \cdot \left(eh \cdot \sin t\right)\right|\\
\end{array}
\end{array}
if ew < -1.40000000000000005e-67 or 1.15000000000000005e-126 < ew Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
add-cbrt-cube99.7%
pow399.7%
Applied egg-rr99.5%
Taylor expanded in ew around inf 98.6%
associate-/l*98.6%
associate-/l*98.6%
mul-1-neg98.6%
associate-*l/98.6%
*-commutative98.6%
distribute-rgt-neg-in98.6%
mul-1-neg98.6%
associate-*r/98.6%
neg-mul-198.6%
Simplified98.6%
if -1.40000000000000005e-67 < ew < 1.15000000000000005e-126Initial program 99.9%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
add-cbrt-cube99.8%
pow399.8%
Applied egg-rr98.9%
Taylor expanded in t around 0 95.4%
Taylor expanded in ew around 0 95.4%
associate-*r*95.4%
mul-1-neg95.4%
associate-*r/95.4%
Simplified95.4%
Final simplification97.5%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((-eh * tan(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(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((-eh * tan(t)) / ew))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((-eh * Math.tan(t)) / ew))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - ((eh * math.sin(t)) * math.sin(math.atan(((-eh * math.tan(t)) / ew))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-eh) * tan(t)) / ew)))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((-eh * tan(t)) / ew)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
\end{array}
Initial program 99.8%
add-cube-cbrt98.7%
pow398.7%
Applied egg-rr98.7%
Taylor expanded in ew around -inf 99.1%
associate-*r*99.1%
neg-mul-199.1%
rem-cube-cbrt99.1%
neg-mul-199.1%
Simplified99.1%
Final simplification99.1%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -5.1e-92) (not (<= eh 4e-255))) (fabs (+ ew (* (sin (atan (* eh (/ (tan t) (- ew))))) (* eh (sin t))))) (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -5.1e-92) || !(eh <= 4e-255)) {
tmp = fabs((ew + (sin(atan((eh * (tan(t) / -ew)))) * (eh * sin(t)))));
} else {
tmp = fabs((ew * cos(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 <= (-5.1d-92)) .or. (.not. (eh <= 4d-255))) then
tmp = abs((ew + (sin(atan((eh * (tan(t) / -ew)))) * (eh * sin(t)))))
else
tmp = abs((ew * cos(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -5.1e-92) || !(eh <= 4e-255)) {
tmp = Math.abs((ew + (Math.sin(Math.atan((eh * (Math.tan(t) / -ew)))) * (eh * Math.sin(t)))));
} else {
tmp = Math.abs((ew * Math.cos(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -5.1e-92) or not (eh <= 4e-255): tmp = math.fabs((ew + (math.sin(math.atan((eh * (math.tan(t) / -ew)))) * (eh * math.sin(t))))) else: tmp = math.fabs((ew * math.cos(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -5.1e-92) || !(eh <= 4e-255)) tmp = abs(Float64(ew + Float64(sin(atan(Float64(eh * Float64(tan(t) / Float64(-ew))))) * Float64(eh * sin(t))))); else tmp = abs(Float64(ew * cos(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -5.1e-92) || ~((eh <= 4e-255))) tmp = abs((ew + (sin(atan((eh * (tan(t) / -ew)))) * (eh * sin(t))))); else tmp = abs((ew * cos(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -5.1e-92], N[Not[LessEqual[eh, 4e-255]], $MachinePrecision]], N[Abs[N[(ew + N[(N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -5.1 \cdot 10^{-92} \lor \neg \left(eh \leq 4 \cdot 10^{-255}\right):\\
\;\;\;\;\left|ew + \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right) \cdot \left(eh \cdot \sin t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\end{array}
\end{array}
if eh < -5.09999999999999972e-92 or 4e-255 < eh Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.9%
Simplified99.9%
add-cbrt-cube99.8%
pow399.8%
Applied egg-rr99.6%
Taylor expanded in t around 0 89.8%
Taylor expanded in ew around 0 89.8%
associate-*r*89.8%
mul-1-neg89.8%
associate-*r/89.8%
Simplified89.8%
if -5.09999999999999972e-92 < eh < 4e-255Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
add-cbrt-cube99.5%
pow399.5%
Applied egg-rr98.0%
Taylor expanded in ew around inf 95.0%
Final simplification90.9%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -3.8e-15) (not (<= ew 9.5e-127))) (fabs (* ew (cos t))) (fabs (* (* eh (sin t)) (sin (atan (* (tan t) (/ eh ew))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -3.8e-15) || !(ew <= 9.5e-127)) {
tmp = fabs((ew * cos(t)));
} else {
tmp = fabs(((eh * sin(t)) * sin(atan((tan(t) * (eh / ew))))));
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if ((ew <= (-3.8d-15)) .or. (.not. (ew <= 9.5d-127))) then
tmp = abs((ew * cos(t)))
else
tmp = abs(((eh * sin(t)) * sin(atan((tan(t) * (eh / ew))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -3.8e-15) || !(ew <= 9.5e-127)) {
tmp = Math.abs((ew * Math.cos(t)));
} else {
tmp = Math.abs(((eh * Math.sin(t)) * Math.sin(Math.atan((Math.tan(t) * (eh / ew))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -3.8e-15) or not (ew <= 9.5e-127): tmp = math.fabs((ew * math.cos(t))) else: tmp = math.fabs(((eh * math.sin(t)) * math.sin(math.atan((math.tan(t) * (eh / ew)))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -3.8e-15) || !(ew <= 9.5e-127)) tmp = abs(Float64(ew * cos(t))); else tmp = abs(Float64(Float64(eh * sin(t)) * sin(atan(Float64(tan(t) * Float64(eh / ew)))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -3.8e-15) || ~((ew <= 9.5e-127))) tmp = abs((ew * cos(t))); else tmp = abs(((eh * sin(t)) * sin(atan((tan(t) * (eh / ew)))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -3.8e-15], N[Not[LessEqual[ew, 9.5e-127]], $MachinePrecision]], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -3.8 \cdot 10^{-15} \lor \neg \left(ew \leq 9.5 \cdot 10^{-127}\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right|\\
\end{array}
\end{array}
if ew < -3.8000000000000002e-15 or 9.4999999999999997e-127 < ew Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
add-cbrt-cube99.7%
pow399.7%
Applied egg-rr99.5%
Taylor expanded in ew around inf 80.7%
if -3.8000000000000002e-15 < ew < 9.4999999999999997e-127Initial program 99.9%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
add-cbrt-cube99.8%
pow399.8%
Applied egg-rr98.9%
Taylor expanded in t around 0 94.4%
associate-*r*94.4%
associate-*r/94.4%
add-sqr-sqrt60.9%
pow260.9%
Applied egg-rr45.3%
Taylor expanded in ew around 0 77.0%
associate-*r*77.0%
*-commutative77.0%
associate-*r/77.0%
*-commutative77.0%
Simplified77.0%
Final simplification79.3%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -1.35e-62) (not (<= ew 4.1e-131))) (fabs (* ew (cos t))) (- ew (* (* eh (sin t)) (sin (atan (* eh (/ (tan t) ew))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.35e-62) || !(ew <= 4.1e-131)) {
tmp = fabs((ew * cos(t)));
} else {
tmp = ew - ((eh * sin(t)) * sin(atan((eh * (tan(t) / ew)))));
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if ((ew <= (-1.35d-62)) .or. (.not. (ew <= 4.1d-131))) then
tmp = abs((ew * cos(t)))
else
tmp = ew - ((eh * sin(t)) * sin(atan((eh * (tan(t) / ew)))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.35e-62) || !(ew <= 4.1e-131)) {
tmp = Math.abs((ew * Math.cos(t)));
} else {
tmp = ew - ((eh * Math.sin(t)) * Math.sin(Math.atan((eh * (Math.tan(t) / ew)))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -1.35e-62) or not (ew <= 4.1e-131): tmp = math.fabs((ew * math.cos(t))) else: tmp = ew - ((eh * math.sin(t)) * math.sin(math.atan((eh * (math.tan(t) / ew))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -1.35e-62) || !(ew <= 4.1e-131)) tmp = abs(Float64(ew * cos(t))); else tmp = Float64(ew - Float64(Float64(eh * sin(t)) * sin(atan(Float64(eh * Float64(tan(t) / ew)))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -1.35e-62) || ~((ew <= 4.1e-131))) tmp = abs((ew * cos(t))); else tmp = ew - ((eh * sin(t)) * sin(atan((eh * (tan(t) / ew))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -1.35e-62], N[Not[LessEqual[ew, 4.1e-131]], $MachinePrecision]], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(ew - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.35 \cdot 10^{-62} \lor \neg \left(ew \leq 4.1 \cdot 10^{-131}\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\\
\end{array}
\end{array}
if ew < -1.3500000000000001e-62 or 4.1000000000000002e-131 < ew Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
add-cbrt-cube99.7%
pow399.7%
Applied egg-rr99.5%
Taylor expanded in ew around inf 78.8%
if -1.3500000000000001e-62 < ew < 4.1000000000000002e-131Initial program 99.9%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
add-cbrt-cube99.8%
pow399.8%
Applied egg-rr98.9%
Taylor expanded in t around 0 95.2%
*-un-lft-identity95.2%
associate-*r*95.2%
distribute-lft-neg-out95.2%
atan-neg95.2%
Applied egg-rr95.2%
*-lft-identity95.2%
rem-square-sqrt52.2%
fabs-sqr52.2%
rem-square-sqrt54.1%
sin-neg54.1%
associate-*r/54.1%
*-commutative54.1%
associate-*r/54.1%
distribute-rgt-neg-out54.1%
Simplified54.1%
Final simplification70.2%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -3.2e-192) (not (<= ew 1.45e-142))) (fabs (* ew (cos t))) (fabs (* (sin (atan (* (tan t) (/ eh (- ew))))) (* eh t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -3.2e-192) || !(ew <= 1.45e-142)) {
tmp = fabs((ew * cos(t)));
} else {
tmp = fabs((sin(atan((tan(t) * (eh / -ew)))) * (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 ((ew <= (-3.2d-192)) .or. (.not. (ew <= 1.45d-142))) then
tmp = abs((ew * cos(t)))
else
tmp = abs((sin(atan((tan(t) * (eh / -ew)))) * (eh * t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -3.2e-192) || !(ew <= 1.45e-142)) {
tmp = Math.abs((ew * Math.cos(t)));
} else {
tmp = Math.abs((Math.sin(Math.atan((Math.tan(t) * (eh / -ew)))) * (eh * t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -3.2e-192) or not (ew <= 1.45e-142): tmp = math.fabs((ew * math.cos(t))) else: tmp = math.fabs((math.sin(math.atan((math.tan(t) * (eh / -ew)))) * (eh * t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -3.2e-192) || !(ew <= 1.45e-142)) tmp = abs(Float64(ew * cos(t))); else tmp = abs(Float64(sin(atan(Float64(tan(t) * Float64(eh / Float64(-ew))))) * Float64(eh * t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -3.2e-192) || ~((ew <= 1.45e-142))) tmp = abs((ew * cos(t))); else tmp = abs((sin(atan((tan(t) * (eh / -ew)))) * (eh * t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -3.2e-192], N[Not[LessEqual[ew, 1.45e-142]], $MachinePrecision]], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-ew)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(eh * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -3.2 \cdot 10^{-192} \lor \neg \left(ew \leq 1.45 \cdot 10^{-142}\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-ew}\right) \cdot \left(eh \cdot t\right)\right|\\
\end{array}
\end{array}
if ew < -3.2000000000000002e-192 or 1.44999999999999995e-142 < ew Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
add-cbrt-cube99.7%
pow399.7%
Applied egg-rr99.5%
Taylor expanded in ew around inf 74.1%
if -3.2000000000000002e-192 < ew < 1.44999999999999995e-142Initial program 99.9%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in t around 0 48.4%
Taylor expanded in ew around 0 36.8%
associate-*r*36.8%
mul-1-neg36.8%
associate-*l/36.8%
*-commutative36.8%
distribute-rgt-neg-in36.8%
mul-1-neg36.8%
associate-*r/36.8%
neg-mul-136.8%
Simplified36.8%
Final simplification64.8%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -6.2e-179) (not (<= ew 1.3e-142))) (fabs (* ew (cos t))) (fabs (* (* eh t) (sin (atan (/ (* eh t) (- ew))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -6.2e-179) || !(ew <= 1.3e-142)) {
tmp = fabs((ew * cos(t)));
} else {
tmp = fabs(((eh * t) * sin(atan(((eh * t) / -ew)))));
}
return tmp;
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if ((ew <= (-6.2d-179)) .or. (.not. (ew <= 1.3d-142))) then
tmp = abs((ew * cos(t)))
else
tmp = abs(((eh * t) * sin(atan(((eh * t) / -ew)))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -6.2e-179) || !(ew <= 1.3e-142)) {
tmp = Math.abs((ew * Math.cos(t)));
} else {
tmp = Math.abs(((eh * t) * Math.sin(Math.atan(((eh * t) / -ew)))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -6.2e-179) or not (ew <= 1.3e-142): tmp = math.fabs((ew * math.cos(t))) else: tmp = math.fabs(((eh * t) * math.sin(math.atan(((eh * t) / -ew))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -6.2e-179) || !(ew <= 1.3e-142)) tmp = abs(Float64(ew * cos(t))); else tmp = abs(Float64(Float64(eh * t) * sin(atan(Float64(Float64(eh * t) / Float64(-ew)))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -6.2e-179) || ~((ew <= 1.3e-142))) tmp = abs((ew * cos(t))); else tmp = abs(((eh * t) * sin(atan(((eh * t) / -ew))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -6.2e-179], N[Not[LessEqual[ew, 1.3e-142]], $MachinePrecision]], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(eh * t), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * t), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -6.2 \cdot 10^{-179} \lor \neg \left(ew \leq 1.3 \cdot 10^{-142}\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot t}{-ew}\right)\right|\\
\end{array}
\end{array}
if ew < -6.2000000000000005e-179 or 1.3e-142 < ew Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
add-cbrt-cube99.7%
pow399.7%
Applied egg-rr99.5%
Taylor expanded in ew around inf 74.1%
if -6.2000000000000005e-179 < ew < 1.3e-142Initial program 99.9%
fabs-sub99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in t around 0 48.4%
Taylor expanded in ew around 0 36.8%
associate-*r*36.8%
mul-1-neg36.8%
associate-*l/36.8%
*-commutative36.8%
distribute-rgt-neg-in36.8%
mul-1-neg36.8%
associate-*r/36.8%
neg-mul-136.8%
Simplified36.8%
Taylor expanded in t around 0 36.8%
mul-1-neg36.8%
*-commutative36.8%
associate-/l*36.8%
distribute-rgt-neg-out36.8%
distribute-neg-frac36.8%
associate-*r/36.8%
Simplified36.8%
Final simplification64.8%
(FPCore (eh ew t) :precision binary64 (fabs (* ew (cos t))))
double code(double eh, double ew, double t) {
return fabs((ew * cos(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((ew * cos(t)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * Math.cos(t)));
}
def code(eh, ew, t): return math.fabs((ew * math.cos(t)))
function code(eh, ew, t) return abs(Float64(ew * cos(t))) end
function tmp = code(eh, ew, t) tmp = abs((ew * cos(t))); end
code[eh_, ew_, t_] := N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t\right|
\end{array}
Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
add-cbrt-cube99.7%
pow399.8%
Applied egg-rr99.3%
Taylor expanded in ew around inf 60.5%
(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(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.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
Simplified99.8%
add-cbrt-cube99.7%
pow399.8%
Applied egg-rr99.3%
Taylor expanded in t around 0 46.6%
herbie shell --seed 2024170
(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)))))))