
(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 7 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 (/ (tan t) (/ ew eh))))
(fabs
(+
(* (sin t) (* eh (sin (atan t_1))))
(/ (* ew (cos t)) (hypot 1.0 t_1))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / (ew / eh);
return fabs(((sin(t) * (eh * sin(atan(t_1)))) + ((ew * cos(t)) / hypot(1.0, t_1))));
}
public static double code(double eh, double ew, double t) {
double t_1 = Math.tan(t) / (ew / eh);
return Math.abs(((Math.sin(t) * (eh * Math.sin(Math.atan(t_1)))) + ((ew * Math.cos(t)) / Math.hypot(1.0, t_1))));
}
def code(eh, ew, t): t_1 = math.tan(t) / (ew / eh) return math.fabs(((math.sin(t) * (eh * math.sin(math.atan(t_1)))) + ((ew * math.cos(t)) / math.hypot(1.0, t_1))))
function code(eh, ew, t) t_1 = Float64(tan(t) / Float64(ew / eh)) return abs(Float64(Float64(sin(t) * Float64(eh * sin(atan(t_1)))) + Float64(Float64(ew * cos(t)) / hypot(1.0, t_1)))) end
function tmp = code(eh, ew, t) t_1 = tan(t) / (ew / eh); tmp = abs(((sin(t) * (eh * sin(atan(t_1)))) + ((ew * cos(t)) / hypot(1.0, t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / N[(ew / eh), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{\frac{ew}{eh}}\\
\left|\sin t \cdot \left(eh \cdot \sin \tan^{-1} t_1\right) + \frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, t_1\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-def99.8%
Simplified99.8%
fma-udef99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*r/99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (tan t) (/ ew eh))))
(fabs
(+
(* (sin t) (* eh (sin (atan t_1))))
(* ew (/ (cos t) (hypot 1.0 t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = tan(t) / (ew / eh);
return fabs(((sin(t) * (eh * sin(atan(t_1)))) + (ew * (cos(t) / hypot(1.0, t_1)))));
}
public static double code(double eh, double ew, double t) {
double t_1 = Math.tan(t) / (ew / eh);
return Math.abs(((Math.sin(t) * (eh * Math.sin(Math.atan(t_1)))) + (ew * (Math.cos(t) / Math.hypot(1.0, t_1)))));
}
def code(eh, ew, t): t_1 = math.tan(t) / (ew / eh) return math.fabs(((math.sin(t) * (eh * math.sin(math.atan(t_1)))) + (ew * (math.cos(t) / math.hypot(1.0, t_1)))))
function code(eh, ew, t) t_1 = Float64(tan(t) / Float64(ew / eh)) return abs(Float64(Float64(sin(t) * Float64(eh * sin(atan(t_1)))) + Float64(ew * Float64(cos(t) / hypot(1.0, t_1))))) end
function tmp = code(eh, ew, t) t_1 = tan(t) / (ew / eh); tmp = abs(((sin(t) * (eh * sin(atan(t_1)))) + (ew * (cos(t) / hypot(1.0, t_1))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / N[(ew / eh), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(ew * N[(N[Cos[t], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\tan t}{\frac{ew}{eh}}\\
\left|\sin t \cdot \left(eh \cdot \sin \tan^{-1} t_1\right) + ew \cdot \frac{\cos t}{\mathsf{hypot}\left(1, t_1\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-def99.8%
Simplified99.8%
fma-udef99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (sin t) (* eh (sin (atan (/ (* t eh) ew))))) (* ew (/ 1.0 (/ (hypot 1.0 (* (tan t) (/ eh ew))) (cos t)))))))
double code(double eh, double ew, double t) {
return fabs(((sin(t) * (eh * sin(atan(((t * eh) / ew))))) + (ew * (1.0 / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.sin(t) * (eh * Math.sin(Math.atan(((t * eh) / ew))))) + (ew * (1.0 / (Math.hypot(1.0, (Math.tan(t) * (eh / ew))) / Math.cos(t))))));
}
def code(eh, ew, t): return math.fabs(((math.sin(t) * (eh * math.sin(math.atan(((t * eh) / ew))))) + (ew * (1.0 / (math.hypot(1.0, (math.tan(t) * (eh / ew))) / math.cos(t))))))
function code(eh, ew, t) return abs(Float64(Float64(sin(t) * Float64(eh * sin(atan(Float64(Float64(t * eh) / ew))))) + Float64(ew * Float64(1.0 / Float64(hypot(1.0, Float64(tan(t) * Float64(eh / ew))) / cos(t)))))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(t) * (eh * sin(atan(((t * eh) / ew))))) + (ew * (1.0 / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t)))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[(N[(t * eh), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(ew * N[(1.0 / N[(N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{t \cdot eh}{ew}\right)\right) + ew \cdot \frac{1}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\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-def99.8%
Simplified99.8%
fma-udef99.8%
+-commutative99.8%
Applied egg-rr99.8%
add-cbrt-cube99.6%
pow199.6%
pow199.6%
pow-prod-up99.6%
metadata-eval99.6%
Applied egg-rr99.6%
unpow299.6%
add-cbrt-cube99.8%
clear-num99.8%
div-inv99.8%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 98.9%
Final simplification98.9%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (sin t) (* eh (sin (atan (/ (tan t) (/ ew eh)))))) (* ew (cos t)))))
double code(double eh, double ew, double t) {
return fabs(((sin(t) * (eh * sin(atan((tan(t) / (ew / eh)))))) + (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(((sin(t) * (eh * sin(atan((tan(t) / (ew / eh)))))) + (ew * cos(t))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((Math.sin(t) * (eh * Math.sin(Math.atan((Math.tan(t) / (ew / eh)))))) + (ew * Math.cos(t))));
}
def code(eh, ew, t): return math.fabs(((math.sin(t) * (eh * math.sin(math.atan((math.tan(t) / (ew / eh)))))) + (ew * math.cos(t))))
function code(eh, ew, t) return abs(Float64(Float64(sin(t) * Float64(eh * sin(atan(Float64(tan(t) / Float64(ew / eh)))))) + Float64(ew * cos(t)))) end
function tmp = code(eh, ew, t) tmp = abs(((sin(t) * (eh * sin(atan((tan(t) / (ew / eh)))))) + (ew * cos(t)))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] / N[(ew / eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{\tan t}{\frac{ew}{eh}}\right)\right) + 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-def99.8%
Simplified99.8%
fma-udef99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in ew around inf 98.6%
Final simplification98.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (* (sin t) (sin (atan (* eh (/ (tan t) ew)))))))))
(if (<= eh -5.5e+100)
t_1
(if (<= eh 2.9e+79)
(* (fabs (* ew (cos t))) (fabs (pow 1.0 0.3333333333333333)))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * (sin(t) * sin(atan((eh * (tan(t) / ew)))))));
double tmp;
if (eh <= -5.5e+100) {
tmp = t_1;
} else if (eh <= 2.9e+79) {
tmp = fabs((ew * cos(t))) * fabs(pow(1.0, 0.3333333333333333));
} 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 * (sin(t) * sin(atan((eh * (tan(t) / ew)))))))
if (eh <= (-5.5d+100)) then
tmp = t_1
else if (eh <= 2.9d+79) then
tmp = abs((ew * cos(t))) * abs((1.0d0 ** 0.3333333333333333d0))
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 * (Math.sin(t) * Math.sin(Math.atan((eh * (Math.tan(t) / ew)))))));
double tmp;
if (eh <= -5.5e+100) {
tmp = t_1;
} else if (eh <= 2.9e+79) {
tmp = Math.abs((ew * Math.cos(t))) * Math.abs(Math.pow(1.0, 0.3333333333333333));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = math.fabs((eh * (math.sin(t) * math.sin(math.atan((eh * (math.tan(t) / ew))))))) tmp = 0 if eh <= -5.5e+100: tmp = t_1 elif eh <= 2.9e+79: tmp = math.fabs((ew * math.cos(t))) * math.fabs(math.pow(1.0, 0.3333333333333333)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = abs(Float64(eh * Float64(sin(t) * sin(atan(Float64(eh * Float64(tan(t) / ew))))))) tmp = 0.0 if (eh <= -5.5e+100) tmp = t_1; elseif (eh <= 2.9e+79) tmp = Float64(abs(Float64(ew * cos(t))) * abs((1.0 ^ 0.3333333333333333))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = abs((eh * (sin(t) * sin(atan((eh * (tan(t) / ew))))))); tmp = 0.0; if (eh <= -5.5e+100) tmp = t_1; elseif (eh <= 2.9e+79) tmp = abs((ew * cos(t))) * abs((1.0 ^ 0.3333333333333333)); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -5.5e+100], t$95$1, If[LessEqual[eh, 2.9e+79], N[(N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Abs[N[Power[1.0, 0.3333333333333333], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\right)\right|\\
\mathbf{if}\;eh \leq -5.5 \cdot 10^{+100}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;eh \leq 2.9 \cdot 10^{+79}:\\
\;\;\;\;\left|ew \cdot \cos t\right| \cdot \left|{1}^{0.3333333333333333}\right|\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if eh < -5.5000000000000002e100 or 2.89999999999999992e79 < eh Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
Simplified99.8%
add-cube-cbrt98.0%
pow398.1%
Applied egg-rr98.1%
Taylor expanded in ew around 0 78.1%
pow-base-178.1%
*-rgt-identity78.1%
associate-/l*78.1%
*-commutative78.1%
*-commutative78.1%
associate-*l*78.1%
associate-/l*78.1%
*-commutative78.1%
associate-*l/78.0%
*-commutative78.0%
Simplified78.0%
if -5.5000000000000002e100 < eh < 2.89999999999999992e79Initial program 99.8%
fabs-sub99.8%
sub-neg99.8%
+-commutative99.8%
associate-*l*99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
Simplified99.8%
add-cube-cbrt97.9%
pow397.9%
Applied egg-rr97.9%
Taylor expanded in eh around 0 83.3%
Final simplification81.4%
(FPCore (eh ew t) :precision binary64 (* (fabs (* ew (cos t))) (fabs (pow 1.0 0.3333333333333333))))
double code(double eh, double ew, double t) {
return fabs((ew * cos(t))) * fabs(pow(1.0, 0.3333333333333333));
}
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))) * abs((1.0d0 ** 0.3333333333333333d0))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * Math.cos(t))) * Math.abs(Math.pow(1.0, 0.3333333333333333));
}
def code(eh, ew, t): return math.fabs((ew * math.cos(t))) * math.fabs(math.pow(1.0, 0.3333333333333333))
function code(eh, ew, t) return Float64(abs(Float64(ew * cos(t))) * abs((1.0 ^ 0.3333333333333333))) end
function tmp = code(eh, ew, t) tmp = abs((ew * cos(t))) * abs((1.0 ^ 0.3333333333333333)); end
code[eh_, ew_, t_] := N[(N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Abs[N[Power[1.0, 0.3333333333333333], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t\right| \cdot \left|{1}^{0.3333333333333333}\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-def99.8%
Simplified99.8%
add-cube-cbrt97.9%
pow398.0%
Applied egg-rr98.0%
Taylor expanded in eh around 0 61.9%
Final simplification61.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(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-def99.8%
Simplified99.8%
add-cube-cbrt97.9%
pow398.0%
Applied egg-rr98.0%
Taylor expanded in t around 0 21.4%
unpow1/340.0%
Simplified40.0%
rem-cube-cbrt40.7%
expm1-log1p-u28.0%
expm1-udef14.2%
Applied egg-rr14.2%
expm1-def28.0%
expm1-log1p40.7%
Simplified40.7%
Final simplification40.7%
herbie shell --seed 2023274
(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)))))))