
(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 (/ (- eh) (/ ew (tan t)))))) (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 / (ew / tan(t))));
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 / (ew / tan(t))))
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 / (ew / Math.tan(t))));
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 / (ew / math.tan(t)))) 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(-eh) / Float64(ew / tan(t)))) return abs(Float64(Float64(ew * Float64(cos(t) * cos(t_1))) - Float64(eh * Float64(sin(t) * sin(t_1))))) end
function tmp = code(eh, ew, t) t_1 = atan((-eh / (ew / tan(t)))); 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[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(ew * N[(N[Cos[t], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $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(\frac{-eh}{\frac{ew}{\tan t}}\right)\\
\left|ew \cdot \left(\cos t \cdot \cos t_1\right) - eh \cdot \left(\sin t \cdot \sin t_1\right)\right|
\end{array}
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ ew (/ (hypot 1.0 (* (tan t) (/ eh ew))) (cos t))) (* eh (* (sin t) (sin (atan (/ (- eh) (/ ew (tan t))))))))))
double code(double eh, double ew, double t) {
return fabs(((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))) - (eh * (sin(t) * sin(atan((-eh / (ew / tan(t)))))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew / (Math.hypot(1.0, (Math.tan(t) * (eh / ew))) / Math.cos(t))) - (eh * (Math.sin(t) * Math.sin(Math.atan((-eh / (ew / Math.tan(t)))))))));
}
def code(eh, ew, t): return math.fabs(((ew / (math.hypot(1.0, (math.tan(t) * (eh / ew))) / math.cos(t))) - (eh * (math.sin(t) * math.sin(math.atan((-eh / (ew / math.tan(t)))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew / Float64(hypot(1.0, Float64(tan(t) * Float64(eh / ew))) / cos(t))) - Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(-eh) / Float64(ew / tan(t))))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))) - (eh * (sin(t) * sin(atan((-eh / (ew / tan(t))))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew / N[(N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
expm1-log1p-u75.0%
expm1-udef58.9%
Applied egg-rr60.5%
expm1-def76.6%
expm1-log1p99.8%
associate-*r/99.8%
associate-/l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (- (/ ew (/ (hypot 1.0 (* (tan t) (/ eh ew))) (cos t))) (* eh (* (sin t) (sin (atan (/ (- t) (/ ew eh)))))))))
double code(double eh, double ew, double t) {
return fabs(((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))) - (eh * (sin(t) * sin(atan((-t / (ew / eh))))))));
}
public static double code(double eh, double ew, double t) {
return Math.abs(((ew / (Math.hypot(1.0, (Math.tan(t) * (eh / ew))) / Math.cos(t))) - (eh * (Math.sin(t) * Math.sin(Math.atan((-t / (ew / eh))))))));
}
def code(eh, ew, t): return math.fabs(((ew / (math.hypot(1.0, (math.tan(t) * (eh / ew))) / math.cos(t))) - (eh * (math.sin(t) * math.sin(math.atan((-t / (ew / eh))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew / Float64(hypot(1.0, Float64(tan(t) * Float64(eh / ew))) / cos(t))) - Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(-t) / Float64(ew / eh)))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))) - (eh * (sin(t) * sin(atan((-t / (ew / eh)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew / N[(N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[((-t) / N[(ew / eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\right)\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
expm1-log1p-u75.0%
expm1-udef58.9%
Applied egg-rr60.5%
expm1-def76.6%
expm1-log1p99.8%
associate-*r/99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 99.3%
mul-1-neg99.3%
associate-/l*99.3%
distribute-neg-frac99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* eh (* (sin t) (sin (atan (/ (- eh) (/ ew (tan t))))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - (eh * (sin(t) * sin(atan((-eh / (ew / tan(t)))))))));
}
real(8) function code(eh, ew, t)
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs(((ew * cos(t)) - (eh * (sin(t) * sin(atan((-eh / (ew / tan(t)))))))))
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 / (ew / Math.tan(t)))))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - (eh * (math.sin(t) * math.sin(math.atan((-eh / (ew / math.tan(t)))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(-eh) / Float64(ew / tan(t))))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - (eh * (sin(t) * sin(atan((-eh / (ew / tan(t))))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
add-cbrt-cube56.7%
pow356.7%
Applied egg-rr58.5%
Taylor expanded in ew around inf 98.4%
Final simplification98.4%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* eh (* (sin t) (sin (atan (/ (- t) (/ ew eh)))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - (eh * (sin(t) * sin(atan((-t / (ew / 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(((ew * cos(t)) - (eh * (sin(t) * sin(atan((-t / (ew / eh))))))))
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((-t / (ew / eh))))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - (eh * (math.sin(t) * math.sin(math.atan((-t / (ew / eh))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(-t) / Float64(ew / eh)))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - (eh * (sin(t) * sin(atan((-t / (ew / eh)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[((-t) / N[(ew / eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\right)\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
expm1-log1p-u75.0%
expm1-udef58.9%
Applied egg-rr60.5%
expm1-def76.6%
expm1-log1p99.8%
associate-*r/99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 99.3%
mul-1-neg99.3%
associate-/l*99.3%
distribute-neg-frac99.3%
Simplified99.3%
Taylor expanded in ew around inf 98.3%
Final simplification98.3%
(FPCore (eh ew t) :precision binary64 (fabs (- (* ew (cos t)) (* eh (* (sin t) (sin (atan (* t (/ eh ew)))))))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) - (eh * (sin(t) * sin(atan((t * (eh / 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((t * (eh / 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((t * (eh / ew))))))));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) - (eh * (math.sin(t) * math.sin(math.atan((t * (eh / ew))))))))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) - Float64(eh * Float64(sin(t) * sin(atan(Float64(t * Float64(eh / ew)))))))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) - (eh * (sin(t) * sin(atan((t * (eh / ew)))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(t * N[(eh / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(t \cdot \frac{eh}{ew}\right)\right)\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
expm1-log1p-u75.0%
expm1-udef58.9%
Applied egg-rr60.5%
expm1-def76.6%
expm1-log1p99.8%
associate-*r/99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 99.3%
mul-1-neg99.3%
associate-/l*99.3%
distribute-neg-frac99.3%
Simplified99.3%
Taylor expanded in ew around inf 98.3%
expm1-log1p-u98.3%
expm1-udef87.4%
add-sqr-sqrt40.7%
sqrt-unprod84.6%
sqr-neg84.6%
sqrt-unprod46.7%
add-sqr-sqrt87.4%
div-inv87.4%
clear-num87.4%
Applied egg-rr87.4%
expm1-def98.3%
expm1-log1p98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -6.5e-98) (not (<= eh 3.2e-99))) (fabs (- ew (* eh (* (sin t) (sin (atan (/ (- t) (/ ew eh)))))))) (fabs (+ (* ew (cos t)) (* eh 0.0)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -6.5e-98) || !(eh <= 3.2e-99)) {
tmp = fabs((ew - (eh * (sin(t) * sin(atan((-t / (ew / eh))))))));
} else {
tmp = fabs(((ew * cos(t)) + (eh * 0.0)));
}
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 <= (-6.5d-98)) .or. (.not. (eh <= 3.2d-99))) then
tmp = abs((ew - (eh * (sin(t) * sin(atan((-t / (ew / eh))))))))
else
tmp = abs(((ew * cos(t)) + (eh * 0.0d0)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -6.5e-98) || !(eh <= 3.2e-99)) {
tmp = Math.abs((ew - (eh * (Math.sin(t) * Math.sin(Math.atan((-t / (ew / eh))))))));
} else {
tmp = Math.abs(((ew * Math.cos(t)) + (eh * 0.0)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -6.5e-98) or not (eh <= 3.2e-99): tmp = math.fabs((ew - (eh * (math.sin(t) * math.sin(math.atan((-t / (ew / eh)))))))) else: tmp = math.fabs(((ew * math.cos(t)) + (eh * 0.0))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -6.5e-98) || !(eh <= 3.2e-99)) tmp = abs(Float64(ew - Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(-t) / Float64(ew / eh)))))))); else tmp = abs(Float64(Float64(ew * cos(t)) + Float64(eh * 0.0))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -6.5e-98) || ~((eh <= 3.2e-99))) tmp = abs((ew - (eh * (sin(t) * sin(atan((-t / (ew / eh)))))))); else tmp = abs(((ew * cos(t)) + (eh * 0.0))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -6.5e-98], N[Not[LessEqual[eh, 3.2e-99]], $MachinePrecision]], N[Abs[N[(ew - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[((-t) / N[(ew / eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] + N[(eh * 0.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -6.5 \cdot 10^{-98} \lor \neg \left(eh \leq 3.2 \cdot 10^{-99}\right):\\
\;\;\;\;\left|ew - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t + eh \cdot 0\right|\\
\end{array}
\end{array}
if eh < -6.50000000000000017e-98 or 3.2000000000000001e-99 < eh Initial program 99.9%
fabs-neg99.9%
sub0-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--r+99.9%
Simplified99.9%
expm1-log1p-u77.8%
expm1-udef72.4%
Applied egg-rr75.0%
expm1-def80.4%
expm1-log1p99.9%
associate-*r/99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t around 0 99.9%
mul-1-neg99.9%
associate-/l*99.9%
distribute-neg-frac99.9%
Simplified99.9%
Taylor expanded in t around 0 90.7%
if -6.50000000000000017e-98 < eh < 3.2000000000000001e-99Initial program 99.7%
fabs-neg99.7%
sub0-neg99.7%
sub-neg99.7%
+-commutative99.7%
associate--r+99.7%
Simplified99.7%
expm1-log1p-u70.7%
expm1-udef38.3%
Applied egg-rr38.3%
expm1-def70.7%
expm1-log1p99.7%
associate-*r/99.7%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in t around 0 98.5%
mul-1-neg98.5%
associate-/l*98.5%
distribute-neg-frac98.5%
Simplified98.5%
Taylor expanded in ew around inf 97.6%
sin-mult88.5%
div-sub88.5%
Applied egg-rr88.5%
+-inverses88.5%
Simplified88.5%
Final simplification89.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (cos t)) (* eh 0.0))))
double code(double eh, double ew, double t) {
return fabs(((ew * cos(t)) + (eh * 0.0)));
}
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 * 0.0d0)))
end function
public static double code(double eh, double ew, double t) {
return Math.abs(((ew * Math.cos(t)) + (eh * 0.0)));
}
def code(eh, ew, t): return math.fabs(((ew * math.cos(t)) + (eh * 0.0)))
function code(eh, ew, t) return abs(Float64(Float64(ew * cos(t)) + Float64(eh * 0.0))) end
function tmp = code(eh, ew, t) tmp = abs(((ew * cos(t)) + (eh * 0.0))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] + N[(eh * 0.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot \cos t + eh \cdot 0\right|
\end{array}
Initial program 99.8%
fabs-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
expm1-log1p-u75.0%
expm1-udef58.9%
Applied egg-rr60.5%
expm1-def76.6%
expm1-log1p99.8%
associate-*r/99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 99.3%
mul-1-neg99.3%
associate-/l*99.3%
distribute-neg-frac99.3%
Simplified99.3%
Taylor expanded in ew around inf 98.3%
sin-mult62.9%
div-sub62.9%
Applied egg-rr62.0%
+-inverses62.0%
Simplified62.0%
Final simplification62.0%
(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-neg99.8%
sub0-neg99.8%
sub-neg99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
add-cbrt-cube56.7%
pow356.7%
Applied egg-rr58.5%
Taylor expanded in t around 0 79.4%
sin-mult43.9%
associate-*r/43.9%
Applied egg-rr43.0%
+-inverses43.0%
mul0-rgt43.0%
metadata-eval43.0%
Simplified43.0%
Final simplification43.0%
herbie shell --seed 2023214
(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)))))))