
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
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 * sin(t)) * cos(t_1)) + ((eh * cos(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.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
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 * sin(t)) * cos(t_1)) + ((eh * cos(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.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)))
(fabs
(fma
(* (tanh (asinh t_1)) (cos t))
eh
(* (/ (sin t) (hypot -1.0 t_1)) ew)))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
return fabs(fma((tanh(asinh(t_1)) * cos(t)), eh, ((sin(t) / hypot(-1.0, t_1)) * ew)));
}
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) return abs(fma(Float64(tanh(asinh(t_1)) * cos(t)), eh, Float64(Float64(sin(t) / hypot(-1.0, t_1)) * ew))) end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, N[Abs[N[(N[(N[Tanh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh + N[(N[(N[Sin[t], $MachinePrecision] / N[Sqrt[-1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
\left|\mathsf{fma}\left(\tanh \sinh^{-1} t\_1 \cdot \cos t, eh, \frac{\sin t}{\mathsf{hypot}\left(-1, t\_1\right)} \cdot ew\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (tanh (asinh (/ (/ eh (tan t)) ew))) (cos t)) eh (* (/ (sin t) (hypot -1.0 (/ eh (* ew t)))) ew))))
double code(double eh, double ew, double t) {
return fabs(fma((tanh(asinh(((eh / tan(t)) / ew))) * cos(t)), eh, ((sin(t) / hypot(-1.0, (eh / (ew * t)))) * ew)));
}
function code(eh, ew, t) return abs(fma(Float64(tanh(asinh(Float64(Float64(eh / tan(t)) / ew))) * cos(t)), eh, Float64(Float64(sin(t) / hypot(-1.0, Float64(eh / Float64(ew * t)))) * ew))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Tanh[N[ArcSinh[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh + N[(N[(N[Sin[t], $MachinePrecision] / N[Sqrt[-1.0 ^ 2 + N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\tanh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right) \cdot \cos t, eh, \frac{\sin t}{\mathsf{hypot}\left(-1, \frac{eh}{ew \cdot t}\right)} \cdot ew\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
Final simplification99.5%
(FPCore (eh ew t) :precision binary64 (fabs (fma (* (tanh (asinh (/ (/ eh (tan t)) ew))) (cos t)) eh (* ew (sin t)))))
double code(double eh, double ew, double t) {
return fabs(fma((tanh(asinh(((eh / tan(t)) / ew))) * cos(t)), eh, (ew * sin(t))));
}
function code(eh, ew, t) return abs(fma(Float64(tanh(asinh(Float64(Float64(eh / tan(t)) / ew))) * cos(t)), eh, Float64(ew * sin(t)))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[Tanh[N[ArcSinh[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * eh + N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\mathsf{fma}\left(\tanh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right) \cdot \cos t, eh, ew \cdot \sin t\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6498.1
Applied rewrites98.1%
(FPCore (eh ew t)
:precision binary64
(if (or (<= eh -1.02e-72) (not (<= eh 1.22e+64)))
(fabs (* eh (cos t)))
(fabs
(/
(fma (sin t) ew (* (/ (* (/ eh ew) eh) (tan t)) (cos t)))
(hypot -1.0 (/ eh (* ew t)))))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.02e-72) || !(eh <= 1.22e+64)) {
tmp = fabs((eh * cos(t)));
} else {
tmp = fabs((fma(sin(t), ew, ((((eh / ew) * eh) / tan(t)) * cos(t))) / hypot(-1.0, (eh / (ew * t)))));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.02e-72) || !(eh <= 1.22e+64)) tmp = abs(Float64(eh * cos(t))); else tmp = abs(Float64(fma(sin(t), ew, Float64(Float64(Float64(Float64(eh / ew) * eh) / tan(t)) * cos(t))) / hypot(-1.0, Float64(eh / Float64(ew * t))))); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.02e-72], N[Not[LessEqual[eh, 1.22e+64]], $MachinePrecision]], N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * ew + N[(N[(N[(N[(eh / ew), $MachinePrecision] * eh), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[-1.0 ^ 2 + N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.02 \cdot 10^{-72} \lor \neg \left(eh \leq 1.22 \cdot 10^{+64}\right):\\
\;\;\;\;\left|eh \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\sin t, ew, \frac{\frac{eh}{ew} \cdot eh}{\tan t} \cdot \cos t\right)}{\mathsf{hypot}\left(-1, \frac{eh}{ew \cdot t}\right)}\right|\\
\end{array}
\end{array}
if eh < -1.02e-72 or 1.21999999999999994e64 < eh Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites42.1%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6487.6
Applied rewrites87.6%
if -1.02e-72 < eh < 1.21999999999999994e64Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites94.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6479.9
Applied rewrites79.9%
Final simplification83.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t))) (t_2 (fabs t_1)))
(if (<= eh -4.1e-74)
t_2
(if (<= eh 3.5e-85)
(fabs
(fma
ew
(sin t)
(* eh (* eh (/ (* 0.5 (pow (cos t) 2.0)) (* ew (sin t)))))))
(if (<= eh 1.25e-27)
(fabs
(fma eh (cos t) (* (* ew ew) (* 0.5 (/ (pow (sin t) 2.0) t_1)))))
(if (<= eh 5.9e+63)
(fabs (fma ew (sin t) (* (* eh eh) (* 0.5 (/ (pow ew -1.0) t)))))
t_2))))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double t_2 = fabs(t_1);
double tmp;
if (eh <= -4.1e-74) {
tmp = t_2;
} else if (eh <= 3.5e-85) {
tmp = fabs(fma(ew, sin(t), (eh * (eh * ((0.5 * pow(cos(t), 2.0)) / (ew * sin(t)))))));
} else if (eh <= 1.25e-27) {
tmp = fabs(fma(eh, cos(t), ((ew * ew) * (0.5 * (pow(sin(t), 2.0) / t_1)))));
} else if (eh <= 5.9e+63) {
tmp = fabs(fma(ew, sin(t), ((eh * eh) * (0.5 * (pow(ew, -1.0) / t)))));
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) t_2 = abs(t_1) tmp = 0.0 if (eh <= -4.1e-74) tmp = t_2; elseif (eh <= 3.5e-85) tmp = abs(fma(ew, sin(t), Float64(eh * Float64(eh * Float64(Float64(0.5 * (cos(t) ^ 2.0)) / Float64(ew * sin(t))))))); elseif (eh <= 1.25e-27) tmp = abs(fma(eh, cos(t), Float64(Float64(ew * ew) * Float64(0.5 * Float64((sin(t) ^ 2.0) / t_1))))); elseif (eh <= 5.9e+63) tmp = abs(fma(ew, sin(t), Float64(Float64(eh * eh) * Float64(0.5 * Float64((ew ^ -1.0) / t))))); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[t$95$1], $MachinePrecision]}, If[LessEqual[eh, -4.1e-74], t$95$2, If[LessEqual[eh, 3.5e-85], N[Abs[N[(ew * N[Sin[t], $MachinePrecision] + N[(eh * N[(eh * N[(N[(0.5 * N[Power[N[Cos[t], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 1.25e-27], N[Abs[N[(eh * N[Cos[t], $MachinePrecision] + N[(N[(ew * ew), $MachinePrecision] * N[(0.5 * N[(N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 5.9e+63], N[Abs[N[(ew * N[Sin[t], $MachinePrecision] + N[(N[(eh * eh), $MachinePrecision] * N[(0.5 * N[(N[Power[ew, -1.0], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
t_2 := \left|t\_1\right|\\
\mathbf{if}\;eh \leq -4.1 \cdot 10^{-74}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 3.5 \cdot 10^{-85}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew, \sin t, eh \cdot \left(eh \cdot \frac{0.5 \cdot {\cos t}^{2}}{ew \cdot \sin t}\right)\right)\right|\\
\mathbf{elif}\;eh \leq 1.25 \cdot 10^{-27}:\\
\;\;\;\;\left|\mathsf{fma}\left(eh, \cos t, \left(ew \cdot ew\right) \cdot \left(0.5 \cdot \frac{{\sin t}^{2}}{t\_1}\right)\right)\right|\\
\mathbf{elif}\;eh \leq 5.9 \cdot 10^{+63}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew, \sin t, \left(eh \cdot eh\right) \cdot \left(0.5 \cdot \frac{{ew}^{-1}}{t}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -4.10000000000000032e-74 or 5.90000000000000029e63 < eh Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites42.1%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6487.6
Applied rewrites87.6%
if -4.10000000000000032e-74 < eh < 3.49999999999999978e-85Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites96.0%
Taylor expanded in eh around 0
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6480.3
Applied rewrites80.3%
Applied rewrites81.1%
if 3.49999999999999978e-85 < eh < 1.25e-27Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites88.9%
Taylor expanded in ew around 0
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6484.9
Applied rewrites84.9%
if 1.25e-27 < eh < 5.90000000000000029e63Initial program 99.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites95.0%
Taylor expanded in eh around 0
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6469.9
Applied rewrites69.9%
Taylor expanded in t around 0
Applied rewrites70.3%
Final simplification83.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t)))
(t_2 (fabs t_1))
(t_3
(fabs (fma ew (sin t) (* (* eh eh) (* 0.5 (/ (pow ew -1.0) t)))))))
(if (<= eh -4.1e-74)
t_2
(if (<= eh 3.5e-85)
t_3
(if (<= eh 1.25e-27)
(fabs
(fma eh (cos t) (* (* ew ew) (* 0.5 (/ (pow (sin t) 2.0) t_1)))))
(if (<= eh 5.9e+63) t_3 t_2))))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double t_2 = fabs(t_1);
double t_3 = fabs(fma(ew, sin(t), ((eh * eh) * (0.5 * (pow(ew, -1.0) / t)))));
double tmp;
if (eh <= -4.1e-74) {
tmp = t_2;
} else if (eh <= 3.5e-85) {
tmp = t_3;
} else if (eh <= 1.25e-27) {
tmp = fabs(fma(eh, cos(t), ((ew * ew) * (0.5 * (pow(sin(t), 2.0) / t_1)))));
} else if (eh <= 5.9e+63) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) t_2 = abs(t_1) t_3 = abs(fma(ew, sin(t), Float64(Float64(eh * eh) * Float64(0.5 * Float64((ew ^ -1.0) / t))))) tmp = 0.0 if (eh <= -4.1e-74) tmp = t_2; elseif (eh <= 3.5e-85) tmp = t_3; elseif (eh <= 1.25e-27) tmp = abs(fma(eh, cos(t), Float64(Float64(ew * ew) * Float64(0.5 * Float64((sin(t) ^ 2.0) / t_1))))); elseif (eh <= 5.9e+63) tmp = t_3; else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision] + N[(N[(eh * eh), $MachinePrecision] * N[(0.5 * N[(N[Power[ew, -1.0], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -4.1e-74], t$95$2, If[LessEqual[eh, 3.5e-85], t$95$3, If[LessEqual[eh, 1.25e-27], N[Abs[N[(eh * N[Cos[t], $MachinePrecision] + N[(N[(ew * ew), $MachinePrecision] * N[(0.5 * N[(N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 5.9e+63], t$95$3, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
t_2 := \left|t\_1\right|\\
t_3 := \left|\mathsf{fma}\left(ew, \sin t, \left(eh \cdot eh\right) \cdot \left(0.5 \cdot \frac{{ew}^{-1}}{t}\right)\right)\right|\\
\mathbf{if}\;eh \leq -4.1 \cdot 10^{-74}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;eh \leq 3.5 \cdot 10^{-85}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;eh \leq 1.25 \cdot 10^{-27}:\\
\;\;\;\;\left|\mathsf{fma}\left(eh, \cos t, \left(ew \cdot ew\right) \cdot \left(0.5 \cdot \frac{{\sin t}^{2}}{t\_1}\right)\right)\right|\\
\mathbf{elif}\;eh \leq 5.9 \cdot 10^{+63}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -4.10000000000000032e-74 or 5.90000000000000029e63 < eh Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites42.1%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6487.6
Applied rewrites87.6%
if -4.10000000000000032e-74 < eh < 3.49999999999999978e-85 or 1.25e-27 < eh < 5.90000000000000029e63Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites95.8%
Taylor expanded in eh around 0
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6478.1
Applied rewrites78.1%
Taylor expanded in t around 0
Applied rewrites78.2%
if 3.49999999999999978e-85 < eh < 1.25e-27Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites88.9%
Taylor expanded in ew around 0
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f6484.9
Applied rewrites84.9%
Final simplification83.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* eh (cos t)))))
(if (<= eh -6.8e-76)
t_1
(if (<= eh -3.3e-200)
(fabs
(/
(fma
(/ eh ew)
(* eh 0.5)
(* (* (fma -0.4166666666666667 (* (/ eh ew) eh) ew) t) t))
t))
(if (<= eh 2.15e-227) (pow (pow (* ew (sin t)) -1.0) -1.0) t_1)))))
double code(double eh, double ew, double t) {
double t_1 = fabs((eh * cos(t)));
double tmp;
if (eh <= -6.8e-76) {
tmp = t_1;
} else if (eh <= -3.3e-200) {
tmp = fabs((fma((eh / ew), (eh * 0.5), ((fma(-0.4166666666666667, ((eh / ew) * eh), ew) * t) * t)) / t));
} else if (eh <= 2.15e-227) {
tmp = pow(pow((ew * sin(t)), -1.0), -1.0);
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(eh * cos(t))) tmp = 0.0 if (eh <= -6.8e-76) tmp = t_1; elseif (eh <= -3.3e-200) tmp = abs(Float64(fma(Float64(eh / ew), Float64(eh * 0.5), Float64(Float64(fma(-0.4166666666666667, Float64(Float64(eh / ew) * eh), ew) * t) * t)) / t)); elseif (eh <= 2.15e-227) tmp = (Float64(ew * sin(t)) ^ -1.0) ^ -1.0; else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -6.8e-76], t$95$1, If[LessEqual[eh, -3.3e-200], N[Abs[N[(N[(N[(eh / ew), $MachinePrecision] * N[(eh * 0.5), $MachinePrecision] + N[(N[(N[(-0.4166666666666667 * N[(N[(eh / ew), $MachinePrecision] * eh), $MachinePrecision] + ew), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 2.15e-227], N[Power[N[Power[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], -1.0], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|eh \cdot \cos t\right|\\
\mathbf{if}\;eh \leq -6.8 \cdot 10^{-76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq -3.3 \cdot 10^{-200}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{eh}{ew}, eh \cdot 0.5, \left(\mathsf{fma}\left(-0.4166666666666667, \frac{eh}{ew} \cdot eh, ew\right) \cdot t\right) \cdot t\right)}{t}\right|\\
\mathbf{elif}\;eh \leq 2.15 \cdot 10^{-227}:\\
\;\;\;\;{\left({\left(ew \cdot \sin t\right)}^{-1}\right)}^{-1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -6.7999999999999998e-76 or 2.1500000000000001e-227 < eh Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites60.2%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6474.0
Applied rewrites74.0%
if -6.7999999999999998e-76 < eh < -3.2999999999999998e-200Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites99.7%
Taylor expanded in eh around 0
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6486.4
Applied rewrites86.4%
Taylor expanded in t around 0
Applied rewrites50.5%
Applied rewrites59.6%
if -3.2999999999999998e-200 < eh < 2.1500000000000001e-227Initial program 99.7%
Applied rewrites99.7%
Applied rewrites56.5%
Taylor expanded in eh around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6449.6
Applied rewrites49.6%
Final simplification69.4%
(FPCore (eh ew t)
:precision binary64
(if (or (<= eh -4.1e-74)
(not
(or (<= eh 3.5e-85)
(not (or (<= eh 1.25e-27) (not (<= eh 5.9e+63)))))))
(fabs (* eh (cos t)))
(fabs (fma ew (sin t) (* (* eh eh) (* 0.5 (/ (pow ew -1.0) t)))))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -4.1e-74) || !((eh <= 3.5e-85) || !((eh <= 1.25e-27) || !(eh <= 5.9e+63)))) {
tmp = fabs((eh * cos(t)));
} else {
tmp = fabs(fma(ew, sin(t), ((eh * eh) * (0.5 * (pow(ew, -1.0) / t)))));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((eh <= -4.1e-74) || !((eh <= 3.5e-85) || !((eh <= 1.25e-27) || !(eh <= 5.9e+63)))) tmp = abs(Float64(eh * cos(t))); else tmp = abs(fma(ew, sin(t), Float64(Float64(eh * eh) * Float64(0.5 * Float64((ew ^ -1.0) / t))))); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -4.1e-74], N[Not[Or[LessEqual[eh, 3.5e-85], N[Not[Or[LessEqual[eh, 1.25e-27], N[Not[LessEqual[eh, 5.9e+63]], $MachinePrecision]]], $MachinePrecision]]], $MachinePrecision]], N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Sin[t], $MachinePrecision] + N[(N[(eh * eh), $MachinePrecision] * N[(0.5 * N[(N[Power[ew, -1.0], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -4.1 \cdot 10^{-74} \lor \neg \left(eh \leq 3.5 \cdot 10^{-85} \lor \neg \left(eh \leq 1.25 \cdot 10^{-27} \lor \neg \left(eh \leq 5.9 \cdot 10^{+63}\right)\right)\right):\\
\;\;\;\;\left|eh \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew, \sin t, \left(eh \cdot eh\right) \cdot \left(0.5 \cdot \frac{{ew}^{-1}}{t}\right)\right)\right|\\
\end{array}
\end{array}
if eh < -4.10000000000000032e-74 or 3.49999999999999978e-85 < eh < 1.25e-27 or 5.90000000000000029e63 < eh Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites48.0%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6487.3
Applied rewrites87.3%
if -4.10000000000000032e-74 < eh < 3.49999999999999978e-85 or 1.25e-27 < eh < 5.90000000000000029e63Initial program 99.7%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites95.8%
Taylor expanded in eh around 0
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6478.1
Applied rewrites78.1%
Taylor expanded in t around 0
Applied rewrites78.2%
Final simplification83.5%
(FPCore (eh ew t)
:precision binary64
(if (or (<= eh -6.8e-76) (not (<= eh 4e-279)))
(fabs (* eh (cos t)))
(fabs
(/
(fma
(/ eh ew)
(* eh 0.5)
(* (* (fma -0.4166666666666667 (* (/ eh ew) eh) ew) t) t))
t))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -6.8e-76) || !(eh <= 4e-279)) {
tmp = fabs((eh * cos(t)));
} else {
tmp = fabs((fma((eh / ew), (eh * 0.5), ((fma(-0.4166666666666667, ((eh / ew) * eh), ew) * t) * t)) / t));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((eh <= -6.8e-76) || !(eh <= 4e-279)) tmp = abs(Float64(eh * cos(t))); else tmp = abs(Float64(fma(Float64(eh / ew), Float64(eh * 0.5), Float64(Float64(fma(-0.4166666666666667, Float64(Float64(eh / ew) * eh), ew) * t) * t)) / t)); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -6.8e-76], N[Not[LessEqual[eh, 4e-279]], $MachinePrecision]], N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(eh / ew), $MachinePrecision] * N[(eh * 0.5), $MachinePrecision] + N[(N[(N[(-0.4166666666666667 * N[(N[(eh / ew), $MachinePrecision] * eh), $MachinePrecision] + ew), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -6.8 \cdot 10^{-76} \lor \neg \left(eh \leq 4 \cdot 10^{-279}\right):\\
\;\;\;\;\left|eh \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{eh}{ew}, eh \cdot 0.5, \left(\mathsf{fma}\left(-0.4166666666666667, \frac{eh}{ew} \cdot eh, ew\right) \cdot t\right) \cdot t\right)}{t}\right|\\
\end{array}
\end{array}
if eh < -6.7999999999999998e-76 or 4.00000000000000022e-279 < eh Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites61.6%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6471.1
Applied rewrites71.1%
if -6.7999999999999998e-76 < eh < 4.00000000000000022e-279Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites96.2%
Taylor expanded in eh around 0
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6487.8
Applied rewrites87.8%
Taylor expanded in t around 0
Applied rewrites31.3%
Applied rewrites39.3%
Final simplification65.4%
(FPCore (eh ew t)
:precision binary64
(if (or (<= eh -1.1e-75) (not (<= eh 4e-279)))
(fabs (* eh 1.0))
(fabs
(/
(fma
(/ eh ew)
(* eh 0.5)
(* (* (fma -0.4166666666666667 (* (/ eh ew) eh) ew) t) t))
t))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -1.1e-75) || !(eh <= 4e-279)) {
tmp = fabs((eh * 1.0));
} else {
tmp = fabs((fma((eh / ew), (eh * 0.5), ((fma(-0.4166666666666667, ((eh / ew) * eh), ew) * t) * t)) / t));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((eh <= -1.1e-75) || !(eh <= 4e-279)) tmp = abs(Float64(eh * 1.0)); else tmp = abs(Float64(fma(Float64(eh / ew), Float64(eh * 0.5), Float64(Float64(fma(-0.4166666666666667, Float64(Float64(eh / ew) * eh), ew) * t) * t)) / t)); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -1.1e-75], N[Not[LessEqual[eh, 4e-279]], $MachinePrecision]], N[Abs[N[(eh * 1.0), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(eh / ew), $MachinePrecision] * N[(eh * 0.5), $MachinePrecision] + N[(N[(N[(-0.4166666666666667 * N[(N[(eh / ew), $MachinePrecision] * eh), $MachinePrecision] + ew), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.1 \cdot 10^{-75} \lor \neg \left(eh \leq 4 \cdot 10^{-279}\right):\\
\;\;\;\;\left|eh \cdot 1\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{eh}{ew}, eh \cdot 0.5, \left(\mathsf{fma}\left(-0.4166666666666667, \frac{eh}{ew} \cdot eh, ew\right) \cdot t\right) \cdot t\right)}{t}\right|\\
\end{array}
\end{array}
if eh < -1.10000000000000003e-75 or 4.00000000000000022e-279 < eh Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites61.6%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6471.1
Applied rewrites71.1%
Taylor expanded in t around 0
Applied rewrites46.9%
if -1.10000000000000003e-75 < eh < 4.00000000000000022e-279Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites96.2%
Taylor expanded in eh around 0
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6487.8
Applied rewrites87.8%
Taylor expanded in t around 0
Applied rewrites31.3%
Applied rewrites39.3%
Final simplification45.5%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -6.8e-76) (not (<= eh -6.8e-230))) (fabs (* eh 1.0)) (fabs (/ (* ew (* t t)) t))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -6.8e-76) || !(eh <= -6.8e-230)) {
tmp = fabs((eh * 1.0));
} else {
tmp = fabs(((ew * (t * t)) / t));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if ((eh <= (-6.8d-76)) .or. (.not. (eh <= (-6.8d-230)))) then
tmp = abs((eh * 1.0d0))
else
tmp = abs(((ew * (t * t)) / t))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -6.8e-76) || !(eh <= -6.8e-230)) {
tmp = Math.abs((eh * 1.0));
} else {
tmp = Math.abs(((ew * (t * t)) / t));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -6.8e-76) or not (eh <= -6.8e-230): tmp = math.fabs((eh * 1.0)) else: tmp = math.fabs(((ew * (t * t)) / t)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -6.8e-76) || !(eh <= -6.8e-230)) tmp = abs(Float64(eh * 1.0)); else tmp = abs(Float64(Float64(ew * Float64(t * t)) / t)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -6.8e-76) || ~((eh <= -6.8e-230))) tmp = abs((eh * 1.0)); else tmp = abs(((ew * (t * t)) / t)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -6.8e-76], N[Not[LessEqual[eh, -6.8e-230]], $MachinePrecision]], N[Abs[N[(eh * 1.0), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -6.8 \cdot 10^{-76} \lor \neg \left(eh \leq -6.8 \cdot 10^{-230}\right):\\
\;\;\;\;\left|eh \cdot 1\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{ew \cdot \left(t \cdot t\right)}{t}\right|\\
\end{array}
\end{array}
if eh < -6.7999999999999998e-76 or -6.8e-230 < eh Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites64.2%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6466.6
Applied rewrites66.6%
Taylor expanded in t around 0
Applied rewrites44.3%
if -6.7999999999999998e-76 < eh < -6.8e-230Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites97.3%
Taylor expanded in eh around 0
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6487.3
Applied rewrites87.3%
Taylor expanded in t around 0
Applied rewrites44.4%
Taylor expanded in eh around 0
Applied rewrites44.3%
Final simplification44.3%
(FPCore (eh ew t) :precision binary64 (fabs (* eh 1.0)))
double code(double eh, double ew, double t) {
return fabs((eh * 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((eh * 1.0d0))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((eh * 1.0));
}
def code(eh, ew, t): return math.fabs((eh * 1.0))
function code(eh, ew, t) return abs(Float64(eh * 1.0)) end
function tmp = code(eh, ew, t) tmp = abs((eh * 1.0)); end
code[eh_, ew_, t_] := N[Abs[N[(eh * 1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|eh \cdot 1\right|
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
lift-atan.f64N/A
cos-atanN/A
associate-*l/N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-atan.f64N/A
sin-atanN/A
Applied rewrites67.8%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6461.0
Applied rewrites61.0%
Taylor expanded in t around 0
Applied rewrites40.9%
herbie shell --seed 2024357
(FPCore (eh ew t)
:name "Example from Robby"
:precision binary64
(fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))