
(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 14 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 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* eh (cos t)) (sin t_1)) (* (* ew (sin t)) (cos t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((eh * cos(t)) * sin(t_1)) + ((ew * sin(t)) * cos(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((((eh * cos(t)) * sin(t_1)) + ((ew * sin(t)) * cos(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((((eh * Math.cos(t)) * Math.sin(t_1)) + ((ew * Math.sin(t)) * Math.cos(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((eh * math.cos(t)) * math.sin(t_1)) + ((ew * math.sin(t)) * math.cos(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(t_1)) + Float64(Float64(ew * sin(t)) * cos(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((eh * cos(t)) * sin(t_1)) + ((ew * sin(t)) * cos(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[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[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(eh \cdot \cos t\right) \cdot \sin t\_1 + \left(ew \cdot \sin t\right) \cdot \cos t\_1\right|
\end{array}
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (atan (/ (/ eh ew) (tan t)))))
(if (<=
(+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1)))
-5e-257)
(fabs
(*
t
(fma
(* t t)
(fma
(* t t)
(fma
-0.0001984126984126984
(* ew (* t t))
(* 0.008333333333333333 ew))
(* -0.16666666666666666 ew))
ew)))
(* (sin t) ew))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
double tmp;
if ((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))) <= -5e-257) {
tmp = fabs((t * fma((t * t), fma((t * t), fma(-0.0001984126984126984, (ew * (t * t)), (0.008333333333333333 * ew)), (-0.16666666666666666 * ew)), ew)));
} else {
tmp = sin(t) * ew;
}
return tmp;
}
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) tmp = 0.0 if (Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1))) <= -5e-257) tmp = abs(Float64(t * fma(Float64(t * t), fma(Float64(t * t), fma(-0.0001984126984126984, Float64(ew * Float64(t * t)), Float64(0.008333333333333333 * ew)), Float64(-0.16666666666666666 * ew)), ew))); else tmp = Float64(sin(t) * ew); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[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], -5e-257], N[Abs[N[(t * N[(N[(t * t), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * N[(-0.0001984126984126984 * N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision] + N[(0.008333333333333333 * ew), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * ew), $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\mathbf{if}\;\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1 \leq -5 \cdot 10^{-257}:\\
\;\;\;\;\left|t \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(-0.0001984126984126984, ew \cdot \left(t \cdot t\right), 0.008333333333333333 \cdot ew\right), -0.16666666666666666 \cdot ew\right), ew\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\sin t \cdot ew\\
\end{array}
\end{array}
if (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) < -4.99999999999999989e-257Initial program 99.8%
Applied rewrites67.7%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6443.1
Applied rewrites43.1%
Taylor expanded in t around 0
Applied rewrites19.6%
if -4.99999999999999989e-257 < (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) Initial program 99.8%
Applied rewrites74.1%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6449.4
Applied rewrites49.4%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrt49.4
Applied rewrites49.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)))
(if (or (<= eh -5.5e-24) (not (<= eh 4.5e+64)))
(fabs (* eh (cos t)))
(fabs (/ (fma (* (cos t) t_1) eh (* (sin t) ew)) (cosh (asinh t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
double tmp;
if ((eh <= -5.5e-24) || !(eh <= 4.5e+64)) {
tmp = fabs((eh * cos(t)));
} else {
tmp = fabs((fma((cos(t) * t_1), eh, (sin(t) * ew)) / cosh(asinh(t_1))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) tmp = 0.0 if ((eh <= -5.5e-24) || !(eh <= 4.5e+64)) tmp = abs(Float64(eh * cos(t))); else tmp = abs(Float64(fma(Float64(cos(t) * t_1), eh, Float64(sin(t) * ew)) / cosh(asinh(t_1)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, If[Or[LessEqual[eh, -5.5e-24], N[Not[LessEqual[eh, 4.5e+64]], $MachinePrecision]], N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
\mathbf{if}\;eh \leq -5.5 \cdot 10^{-24} \lor \neg \left(eh \leq 4.5 \cdot 10^{+64}\right):\\
\;\;\;\;\left|eh \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_1}\right|\\
\end{array}
\end{array}
if eh < -5.4999999999999999e-24 or 4.49999999999999973e64 < eh Initial program 99.8%
Applied rewrites37.7%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites30.8%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6485.7
Applied rewrites85.7%
if -5.4999999999999999e-24 < eh < 4.49999999999999973e64Initial program 99.8%
Applied rewrites94.2%
Final simplification90.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (sin t) ew))
(t_2 (/ eh (tan t)))
(t_3 (sqrt (+ 1.0 (pow (/ t_2 ew) 2.0))))
(t_4 (* eh (cos t))))
(if (<= ew -4.5e+65)
(fabs (/ (fma (/ t_4 (* (tan t) ew)) eh t_1) t_3))
(if (<= ew 4.4e-51)
(fabs (fma (* ew ew) (* 0.5 (/ (/ (pow (sin t) 2.0) eh) (cos t))) t_4))
(fabs (/ (fma (/ (* t_2 (cos t)) ew) eh t_1) t_3))))))
double code(double eh, double ew, double t) {
double t_1 = sin(t) * ew;
double t_2 = eh / tan(t);
double t_3 = sqrt((1.0 + pow((t_2 / ew), 2.0)));
double t_4 = eh * cos(t);
double tmp;
if (ew <= -4.5e+65) {
tmp = fabs((fma((t_4 / (tan(t) * ew)), eh, t_1) / t_3));
} else if (ew <= 4.4e-51) {
tmp = fabs(fma((ew * ew), (0.5 * ((pow(sin(t), 2.0) / eh) / cos(t))), t_4));
} else {
tmp = fabs((fma(((t_2 * cos(t)) / ew), eh, t_1) / t_3));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(sin(t) * ew) t_2 = Float64(eh / tan(t)) t_3 = sqrt(Float64(1.0 + (Float64(t_2 / ew) ^ 2.0))) t_4 = Float64(eh * cos(t)) tmp = 0.0 if (ew <= -4.5e+65) tmp = abs(Float64(fma(Float64(t_4 / Float64(tan(t) * ew)), eh, t_1) / t_3)); elseif (ew <= 4.4e-51) tmp = abs(fma(Float64(ew * ew), Float64(0.5 * Float64(Float64((sin(t) ^ 2.0) / eh) / cos(t))), t_4)); else tmp = abs(Float64(fma(Float64(Float64(t_2 * cos(t)) / ew), eh, t_1) / t_3)); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]}, Block[{t$95$2 = N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + N[Power[N[(t$95$2 / ew), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ew, -4.5e+65], N[Abs[N[(N[(N[(t$95$4 / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] * eh + t$95$1), $MachinePrecision] / t$95$3), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 4.4e-51], N[Abs[N[(N[(ew * ew), $MachinePrecision] * N[(0.5 * N[(N[(N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision] / eh), $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[(t$95$2 * N[Cos[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * eh + t$95$1), $MachinePrecision] / t$95$3), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin t \cdot ew\\
t_2 := \frac{eh}{\tan t}\\
t_3 := \sqrt{1 + {\left(\frac{t\_2}{ew}\right)}^{2}}\\
t_4 := eh \cdot \cos t\\
\mathbf{if}\;ew \leq -4.5 \cdot 10^{+65}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{t\_4}{\tan t \cdot ew}, eh, t\_1\right)}{t\_3}\right|\\
\mathbf{elif}\;ew \leq 4.4 \cdot 10^{-51}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew \cdot ew, 0.5 \cdot \frac{\frac{{\sin t}^{2}}{eh}}{\cos t}, t\_4\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{t\_2 \cdot \cos t}{ew}, eh, t\_1\right)}{t\_3}\right|\\
\end{array}
\end{array}
if ew < -4.5e65Initial program 99.6%
Applied rewrites95.5%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites96.2%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-/l/N/A
associate-*r/N/A
*-commutativeN/A
lift-cos.f64N/A
lower-/.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-tan.f6496.2
Applied rewrites96.2%
if -4.5e65 < ew < 4.4e-51Initial program 99.8%
Applied rewrites54.6%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites40.6%
Taylor expanded in ew around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6483.2
Applied rewrites83.2%
if 4.4e-51 < ew Initial program 99.8%
Applied rewrites86.7%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites85.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites85.1%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -4.5e+65) (not (<= ew 4.7e-51)))
(fabs
(/
(fma (* (cos t) (/ (/ eh (tan t)) ew)) eh (* (sin t) ew))
(sqrt (+ 1.0 (pow (/ eh (* (tan t) ew)) 2.0)))))
(fabs
(fma
(* ew ew)
(* 0.5 (/ (/ (pow (sin t) 2.0) eh) (cos t)))
(* eh (cos t))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -4.5e+65) || !(ew <= 4.7e-51)) {
tmp = fabs((fma((cos(t) * ((eh / tan(t)) / ew)), eh, (sin(t) * ew)) / sqrt((1.0 + pow((eh / (tan(t) * ew)), 2.0)))));
} else {
tmp = fabs(fma((ew * ew), (0.5 * ((pow(sin(t), 2.0) / eh) / cos(t))), (eh * cos(t))));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((ew <= -4.5e+65) || !(ew <= 4.7e-51)) tmp = abs(Float64(fma(Float64(cos(t) * Float64(Float64(eh / tan(t)) / ew)), eh, Float64(sin(t) * ew)) / sqrt(Float64(1.0 + (Float64(eh / Float64(tan(t) * ew)) ^ 2.0))))); else tmp = abs(fma(Float64(ew * ew), Float64(0.5 * Float64(Float64((sin(t) ^ 2.0) / eh) / cos(t))), Float64(eh * cos(t)))); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -4.5e+65], N[Not[LessEqual[ew, 4.7e-51]], $MachinePrecision]], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * ew), $MachinePrecision] * N[(0.5 * N[(N[(N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision] / eh), $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -4.5 \cdot 10^{+65} \lor \neg \left(ew \leq 4.7 \cdot 10^{-51}\right):\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{\sqrt{1 + {\left(\frac{eh}{\tan t \cdot ew}\right)}^{2}}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew \cdot ew, 0.5 \cdot \frac{\frac{{\sin t}^{2}}{eh}}{\cos t}, eh \cdot \cos t\right)\right|\\
\end{array}
\end{array}
if ew < -4.5e65 or 4.6999999999999997e-51 < ew Initial program 99.7%
Applied rewrites90.8%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites90.4%
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6490.3
Applied rewrites90.3%
if -4.5e65 < ew < 4.6999999999999997e-51Initial program 99.8%
Applied rewrites54.6%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites40.6%
Taylor expanded in ew around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6483.2
Applied rewrites83.2%
Final simplification86.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (sin t) ew))
(t_2 (/ (/ eh (tan t)) ew))
(t_3 (* eh (cos t)))
(t_4 (* (tan t) ew)))
(if (<= ew -4.5e+65)
(fabs (/ (fma (/ t_3 t_4) eh t_1) (sqrt (+ 1.0 (pow t_2 2.0)))))
(if (<= ew 4.7e-51)
(fabs (fma (* ew ew) (* 0.5 (/ (/ (pow (sin t) 2.0) eh) (cos t))) t_3))
(fabs
(/
(fma (* (cos t) t_2) eh t_1)
(sqrt (+ 1.0 (pow (/ eh t_4) 2.0)))))))))
double code(double eh, double ew, double t) {
double t_1 = sin(t) * ew;
double t_2 = (eh / tan(t)) / ew;
double t_3 = eh * cos(t);
double t_4 = tan(t) * ew;
double tmp;
if (ew <= -4.5e+65) {
tmp = fabs((fma((t_3 / t_4), eh, t_1) / sqrt((1.0 + pow(t_2, 2.0)))));
} else if (ew <= 4.7e-51) {
tmp = fabs(fma((ew * ew), (0.5 * ((pow(sin(t), 2.0) / eh) / cos(t))), t_3));
} else {
tmp = fabs((fma((cos(t) * t_2), eh, t_1) / sqrt((1.0 + pow((eh / t_4), 2.0)))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(sin(t) * ew) t_2 = Float64(Float64(eh / tan(t)) / ew) t_3 = Float64(eh * cos(t)) t_4 = Float64(tan(t) * ew) tmp = 0.0 if (ew <= -4.5e+65) tmp = abs(Float64(fma(Float64(t_3 / t_4), eh, t_1) / sqrt(Float64(1.0 + (t_2 ^ 2.0))))); elseif (ew <= 4.7e-51) tmp = abs(fma(Float64(ew * ew), Float64(0.5 * Float64(Float64((sin(t) ^ 2.0) / eh) / cos(t))), t_3)); else tmp = abs(Float64(fma(Float64(cos(t) * t_2), eh, t_1) / sqrt(Float64(1.0 + (Float64(eh / t_4) ^ 2.0))))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]}, Block[{t$95$2 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$3 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]}, If[LessEqual[ew, -4.5e+65], N[Abs[N[(N[(N[(t$95$3 / t$95$4), $MachinePrecision] * eh + t$95$1), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 4.7e-51], N[Abs[N[(N[(ew * ew), $MachinePrecision] * N[(0.5 * N[(N[(N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision] / eh), $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$2), $MachinePrecision] * eh + t$95$1), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[N[(eh / t$95$4), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin t \cdot ew\\
t_2 := \frac{\frac{eh}{\tan t}}{ew}\\
t_3 := eh \cdot \cos t\\
t_4 := \tan t \cdot ew\\
\mathbf{if}\;ew \leq -4.5 \cdot 10^{+65}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{t\_3}{t\_4}, eh, t\_1\right)}{\sqrt{1 + {t\_2}^{2}}}\right|\\
\mathbf{elif}\;ew \leq 4.7 \cdot 10^{-51}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew \cdot ew, 0.5 \cdot \frac{\frac{{\sin t}^{2}}{eh}}{\cos t}, t\_3\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_2, eh, t\_1\right)}{\sqrt{1 + {\left(\frac{eh}{t\_4}\right)}^{2}}}\right|\\
\end{array}
\end{array}
if ew < -4.5e65Initial program 99.6%
Applied rewrites95.5%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites96.2%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-/l/N/A
associate-*r/N/A
*-commutativeN/A
lift-cos.f64N/A
lower-/.f64N/A
lift-cos.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-tan.f6496.2
Applied rewrites96.2%
if -4.5e65 < ew < 4.6999999999999997e-51Initial program 99.8%
Applied rewrites54.6%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites40.6%
Taylor expanded in ew around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6483.2
Applied rewrites83.2%
if 4.6999999999999997e-51 < ew Initial program 99.8%
Applied rewrites86.7%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites85.1%
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6485.1
Applied rewrites85.1%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)))
(if (<= ew -1.9e+78)
(fabs (/ (fma (* (cos t) t_1) eh (* (sin t) ew)) 1.0))
(if (<= ew 8e-51)
(fabs
(fma
(* ew ew)
(* 0.5 (/ (/ (pow (sin t) 2.0) eh) (cos t)))
(* eh (cos t))))
(if (<= ew 1.35e+140)
(fabs
(/
(/ (fma (* ew ew) (sin t) (/ (* eh eh) t)) ew)
(cosh (asinh t_1))))
(fabs (* ew (sin t))))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
double tmp;
if (ew <= -1.9e+78) {
tmp = fabs((fma((cos(t) * t_1), eh, (sin(t) * ew)) / 1.0));
} else if (ew <= 8e-51) {
tmp = fabs(fma((ew * ew), (0.5 * ((pow(sin(t), 2.0) / eh) / cos(t))), (eh * cos(t))));
} else if (ew <= 1.35e+140) {
tmp = fabs(((fma((ew * ew), sin(t), ((eh * eh) / t)) / ew) / cosh(asinh(t_1))));
} else {
tmp = fabs((ew * sin(t)));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) tmp = 0.0 if (ew <= -1.9e+78) tmp = abs(Float64(fma(Float64(cos(t) * t_1), eh, Float64(sin(t) * ew)) / 1.0)); elseif (ew <= 8e-51) tmp = abs(fma(Float64(ew * ew), Float64(0.5 * Float64(Float64((sin(t) ^ 2.0) / eh) / cos(t))), Float64(eh * cos(t)))); elseif (ew <= 1.35e+140) tmp = abs(Float64(Float64(fma(Float64(ew * ew), sin(t), Float64(Float64(eh * eh) / t)) / ew) / cosh(asinh(t_1)))); else tmp = abs(Float64(ew * sin(t))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, If[LessEqual[ew, -1.9e+78], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 8e-51], N[Abs[N[(N[(ew * ew), $MachinePrecision] * N[(0.5 * N[(N[(N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision] / eh), $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 1.35e+140], N[Abs[N[(N[(N[(N[(ew * ew), $MachinePrecision] * N[Sin[t], $MachinePrecision] + N[(N[(eh * eh), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
\mathbf{if}\;ew \leq -1.9 \cdot 10^{+78}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{1}\right|\\
\mathbf{elif}\;ew \leq 8 \cdot 10^{-51}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew \cdot ew, 0.5 \cdot \frac{\frac{{\sin t}^{2}}{eh}}{\cos t}, eh \cdot \cos t\right)\right|\\
\mathbf{elif}\;ew \leq 1.35 \cdot 10^{+140}:\\
\;\;\;\;\left|\frac{\frac{\mathsf{fma}\left(ew \cdot ew, \sin t, \frac{eh \cdot eh}{t}\right)}{ew}}{\cosh \sinh^{-1} t\_1}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\end{array}
\end{array}
if ew < -1.9e78Initial program 99.6%
Applied rewrites95.5%
Taylor expanded in eh around 0
Applied rewrites87.8%
if -1.9e78 < ew < 8.0000000000000001e-51Initial program 99.8%
Applied rewrites55.2%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites41.5%
Taylor expanded in ew around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6482.8
Applied rewrites82.8%
if 8.0000000000000001e-51 < ew < 1.35000000000000009e140Initial program 99.9%
Applied rewrites84.7%
Taylor expanded in ew around 0
lower-/.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-sin.f6477.9
Applied rewrites77.9%
Taylor expanded in t around 0
Applied rewrites73.4%
if 1.35000000000000009e140 < ew Initial program 99.6%
Applied rewrites90.1%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6484.6
Applied rewrites84.6%
(FPCore (eh ew t)
:precision binary64
(if (<= ew -1.9e+78)
(fabs (/ (fma (* (cos t) (/ (/ eh (tan t)) ew)) eh (* (sin t) ew)) 1.0))
(if (<= ew 6.4e+34)
(fabs
(fma
(* ew ew)
(* 0.5 (/ (/ (pow (sin t) 2.0) eh) (cos t)))
(* eh (cos t))))
(fabs (* ew (sin t))))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.9e+78) {
tmp = fabs((fma((cos(t) * ((eh / tan(t)) / ew)), eh, (sin(t) * ew)) / 1.0));
} else if (ew <= 6.4e+34) {
tmp = fabs(fma((ew * ew), (0.5 * ((pow(sin(t), 2.0) / eh) / cos(t))), (eh * cos(t))));
} else {
tmp = fabs((ew * sin(t)));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (ew <= -1.9e+78) tmp = abs(Float64(fma(Float64(cos(t) * Float64(Float64(eh / tan(t)) / ew)), eh, Float64(sin(t) * ew)) / 1.0)); elseif (ew <= 6.4e+34) tmp = abs(fma(Float64(ew * ew), Float64(0.5 * Float64(Float64((sin(t) ^ 2.0) / eh) / cos(t))), Float64(eh * cos(t)))); else tmp = abs(Float64(ew * sin(t))); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[ew, -1.9e+78], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 6.4e+34], N[Abs[N[(N[(ew * ew), $MachinePrecision] * N[(0.5 * N[(N[(N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision] / eh), $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.9 \cdot 10^{+78}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{1}\right|\\
\mathbf{elif}\;ew \leq 6.4 \cdot 10^{+34}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew \cdot ew, 0.5 \cdot \frac{\frac{{\sin t}^{2}}{eh}}{\cos t}, eh \cdot \cos t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\end{array}
\end{array}
if ew < -1.9e78Initial program 99.6%
Applied rewrites95.5%
Taylor expanded in eh around 0
Applied rewrites87.8%
if -1.9e78 < ew < 6.3999999999999997e34Initial program 99.8%
Applied rewrites58.8%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites45.9%
Taylor expanded in ew around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f6479.2
Applied rewrites79.2%
if 6.3999999999999997e34 < ew Initial program 99.7%
Applied rewrites88.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6477.2
Applied rewrites77.2%
(FPCore (eh ew t) :precision binary64 (if (<= ew -1.9e+78) (fabs (/ (fma (* (cos t) (/ (/ eh (tan t)) ew)) eh (* (sin t) ew)) 1.0)) (if (<= ew 3.7e+34) (fabs (* eh (cos t))) (fabs (* ew (sin t))))))
double code(double eh, double ew, double t) {
double tmp;
if (ew <= -1.9e+78) {
tmp = fabs((fma((cos(t) * ((eh / tan(t)) / ew)), eh, (sin(t) * ew)) / 1.0));
} else if (ew <= 3.7e+34) {
tmp = fabs((eh * cos(t)));
} else {
tmp = fabs((ew * sin(t)));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (ew <= -1.9e+78) tmp = abs(Float64(fma(Float64(cos(t) * Float64(Float64(eh / tan(t)) / ew)), eh, Float64(sin(t) * ew)) / 1.0)); elseif (ew <= 3.7e+34) tmp = abs(Float64(eh * cos(t))); else tmp = abs(Float64(ew * sin(t))); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[ew, -1.9e+78], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 3.7e+34], N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.9 \cdot 10^{+78}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{1}\right|\\
\mathbf{elif}\;ew \leq 3.7 \cdot 10^{+34}:\\
\;\;\;\;\left|eh \cdot \cos t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\end{array}
\end{array}
if ew < -1.9e78Initial program 99.6%
Applied rewrites95.5%
Taylor expanded in eh around 0
Applied rewrites87.8%
if -1.9e78 < ew < 3.70000000000000009e34Initial program 99.8%
Applied rewrites58.8%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites45.9%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6479.0
Applied rewrites79.0%
if 3.70000000000000009e34 < ew Initial program 99.7%
Applied rewrites88.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6477.2
Applied rewrites77.2%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -1.9e+78) (not (<= ew 3.7e+34))) (fabs (* ew (sin t))) (fabs (* eh (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.9e+78) || !(ew <= 3.7e+34)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs((eh * cos(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 ((ew <= (-1.9d+78)) .or. (.not. (ew <= 3.7d+34))) then
tmp = abs((ew * sin(t)))
else
tmp = abs((eh * cos(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.9e+78) || !(ew <= 3.7e+34)) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs((eh * Math.cos(t)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -1.9e+78) or not (ew <= 3.7e+34): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs((eh * math.cos(t))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -1.9e+78) || !(ew <= 3.7e+34)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(eh * cos(t))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -1.9e+78) || ~((ew <= 3.7e+34))) tmp = abs((ew * sin(t))); else tmp = abs((eh * cos(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -1.9e+78], N[Not[LessEqual[ew, 3.7e+34]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.9 \cdot 10^{+78} \lor \neg \left(ew \leq 3.7 \cdot 10^{+34}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \cos t\right|\\
\end{array}
\end{array}
if ew < -1.9e78 or 3.70000000000000009e34 < ew Initial program 99.7%
Applied rewrites92.5%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6483.2
Applied rewrites83.2%
if -1.9e78 < ew < 3.70000000000000009e34Initial program 99.8%
Applied rewrites58.8%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites45.9%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-cos.f6479.0
Applied rewrites79.0%
Final simplification80.6%
(FPCore (eh ew t)
:precision binary64
(if (or (<= t -1.2e-223) (not (<= t 1.7e-246)))
(fabs (* ew (sin t)))
(fabs
(fma
(* t t)
(/
(fma
-0.5
(* (* ew ew) (fma -0.6666666666666666 (/ (* eh eh) (* ew ew)) 1.0))
(* ew (+ ew (* (/ (* eh eh) ew) -0.8333333333333334))))
eh)
eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -1.2e-223) || !(t <= 1.7e-246)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs(fma((t * t), (fma(-0.5, ((ew * ew) * fma(-0.6666666666666666, ((eh * eh) / (ew * ew)), 1.0)), (ew * (ew + (((eh * eh) / ew) * -0.8333333333333334)))) / eh), eh));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((t <= -1.2e-223) || !(t <= 1.7e-246)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(fma(Float64(t * t), Float64(fma(-0.5, Float64(Float64(ew * ew) * fma(-0.6666666666666666, Float64(Float64(eh * eh) / Float64(ew * ew)), 1.0)), Float64(ew * Float64(ew + Float64(Float64(Float64(eh * eh) / ew) * -0.8333333333333334)))) / eh), eh)); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -1.2e-223], N[Not[LessEqual[t, 1.7e-246]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(t * t), $MachinePrecision] * N[(N[(-0.5 * N[(N[(ew * ew), $MachinePrecision] * N[(-0.6666666666666666 * N[(N[(eh * eh), $MachinePrecision] / N[(ew * ew), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(ew * N[(ew + N[(N[(N[(eh * eh), $MachinePrecision] / ew), $MachinePrecision] * -0.8333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eh), $MachinePrecision] + eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{-223} \lor \neg \left(t \leq 1.7 \cdot 10^{-246}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(t \cdot t, \frac{\mathsf{fma}\left(-0.5, \left(ew \cdot ew\right) \cdot \mathsf{fma}\left(-0.6666666666666666, \frac{eh \cdot eh}{ew \cdot ew}, 1\right), ew \cdot \left(ew + \frac{eh \cdot eh}{ew} \cdot -0.8333333333333334\right)\right)}{eh}, eh\right)\right|\\
\end{array}
\end{array}
if t < -1.19999999999999993e-223 or 1.7000000000000001e-246 < t Initial program 99.7%
Applied rewrites75.1%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6450.9
Applied rewrites50.9%
if -1.19999999999999993e-223 < t < 1.7000000000000001e-246Initial program 100.0%
Applied rewrites41.9%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites32.7%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites48.4%
Final simplification50.6%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -2.3e+69) (not (<= ew 5.2e-12)))
(fabs (* ew t))
(fabs
(fma
(* t t)
(/
(fma
-0.5
(* (* ew ew) (fma -0.6666666666666666 (/ (* eh eh) (* ew ew)) 1.0))
(* ew (+ ew (* (/ (* eh eh) ew) -0.8333333333333334))))
eh)
eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -2.3e+69) || !(ew <= 5.2e-12)) {
tmp = fabs((ew * t));
} else {
tmp = fabs(fma((t * t), (fma(-0.5, ((ew * ew) * fma(-0.6666666666666666, ((eh * eh) / (ew * ew)), 1.0)), (ew * (ew + (((eh * eh) / ew) * -0.8333333333333334)))) / eh), eh));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((ew <= -2.3e+69) || !(ew <= 5.2e-12)) tmp = abs(Float64(ew * t)); else tmp = abs(fma(Float64(t * t), Float64(fma(-0.5, Float64(Float64(ew * ew) * fma(-0.6666666666666666, Float64(Float64(eh * eh) / Float64(ew * ew)), 1.0)), Float64(ew * Float64(ew + Float64(Float64(Float64(eh * eh) / ew) * -0.8333333333333334)))) / eh), eh)); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -2.3e+69], N[Not[LessEqual[ew, 5.2e-12]], $MachinePrecision]], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(t * t), $MachinePrecision] * N[(N[(-0.5 * N[(N[(ew * ew), $MachinePrecision] * N[(-0.6666666666666666 * N[(N[(eh * eh), $MachinePrecision] / N[(ew * ew), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(ew * N[(ew + N[(N[(N[(eh * eh), $MachinePrecision] / ew), $MachinePrecision] * -0.8333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eh), $MachinePrecision] + eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -2.3 \cdot 10^{+69} \lor \neg \left(ew \leq 5.2 \cdot 10^{-12}\right):\\
\;\;\;\;\left|ew \cdot t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(t \cdot t, \frac{\mathsf{fma}\left(-0.5, \left(ew \cdot ew\right) \cdot \mathsf{fma}\left(-0.6666666666666666, \frac{eh \cdot eh}{ew \cdot ew}, 1\right), ew \cdot \left(ew + \frac{eh \cdot eh}{ew} \cdot -0.8333333333333334\right)\right)}{eh}, eh\right)\right|\\
\end{array}
\end{array}
if ew < -2.30000000000000017e69 or 5.19999999999999965e-12 < ew Initial program 99.7%
Applied rewrites90.5%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6478.5
Applied rewrites78.5%
Taylor expanded in t around 0
Applied rewrites35.0%
if -2.30000000000000017e69 < ew < 5.19999999999999965e-12Initial program 99.8%
Applied rewrites56.9%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
rem-square-sqrtN/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
+-commutativeN/A
cosh-asinhN/A
lift-asinh.f64N/A
lift-cosh.f64N/A
Applied rewrites42.5%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites20.6%
Final simplification26.7%
(FPCore (eh ew t) :precision binary64 (fabs (* ew t)))
double code(double eh, double ew, double t) {
return fabs((ew * t));
}
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((ew * t))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * t));
}
def code(eh, ew, t): return math.fabs((ew * t))
function code(eh, ew, t) return abs(Float64(ew * t)) end
function tmp = code(eh, ew, t) tmp = abs((ew * t)); end
code[eh_, ew_, t_] := N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot t\right|
\end{array}
Initial program 99.8%
Applied rewrites71.0%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6446.4
Applied rewrites46.4%
Taylor expanded in t around 0
Applied rewrites20.7%
(FPCore (eh ew t) :precision binary64 (* ew t))
double code(double eh, double ew, double t) {
return ew * t;
}
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 = ew * t
end function
public static double code(double eh, double ew, double t) {
return ew * t;
}
def code(eh, ew, t): return ew * t
function code(eh, ew, t) return Float64(ew * t) end
function tmp = code(eh, ew, t) tmp = ew * t; end
code[eh_, ew_, t_] := N[(ew * t), $MachinePrecision]
\begin{array}{l}
\\
ew \cdot t
\end{array}
Initial program 99.8%
Applied rewrites71.0%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6446.4
Applied rewrites46.4%
Taylor expanded in t around 0
Applied rewrites20.7%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrt12.3
Applied rewrites12.3%
herbie shell --seed 2025005
(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))))))))