
(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}
Herbie found 9 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 (* (tan t) ew))))) (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 / (tan(t) * ew)));
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 / (tan(t) * ew)))
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 / (Math.tan(t) * ew)));
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 / (math.tan(t) * ew))) 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(eh / Float64(tan(t) * ew))) 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 / (tan(t) * ew))); 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[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $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{eh}{\tan t \cdot ew}\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}
Initial program 99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (sin t) ew)) (t_2 (/ (/ eh (tan t)) ew)))
(if (<= eh -8.8e+27)
(* eh (- (cos t)))
(if (<= eh 5.5e-48)
(fabs
(/
(fma (/ (* (/ eh ew) eh) (tan t)) (cos t) t_1)
(sqrt (+ 1.0 (pow t_2 2.0)))))
(if (<= eh 1.7e+106)
(fabs
(/
(fma (/ (* eh eh) (* (tan t) ew)) (cos t) t_1)
(cosh (asinh t_2))))
(* eh (cos t)))))))
double code(double eh, double ew, double t) {
double t_1 = sin(t) * ew;
double t_2 = (eh / tan(t)) / ew;
double tmp;
if (eh <= -8.8e+27) {
tmp = eh * -cos(t);
} else if (eh <= 5.5e-48) {
tmp = fabs((fma((((eh / ew) * eh) / tan(t)), cos(t), t_1) / sqrt((1.0 + pow(t_2, 2.0)))));
} else if (eh <= 1.7e+106) {
tmp = fabs((fma(((eh * eh) / (tan(t) * ew)), cos(t), t_1) / cosh(asinh(t_2))));
} else {
tmp = eh * cos(t);
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(sin(t) * ew) t_2 = Float64(Float64(eh / tan(t)) / ew) tmp = 0.0 if (eh <= -8.8e+27) tmp = Float64(eh * Float64(-cos(t))); elseif (eh <= 5.5e-48) tmp = abs(Float64(fma(Float64(Float64(Float64(eh / ew) * eh) / tan(t)), cos(t), t_1) / sqrt(Float64(1.0 + (t_2 ^ 2.0))))); elseif (eh <= 1.7e+106) tmp = abs(Float64(fma(Float64(Float64(eh * eh) / Float64(tan(t) * ew)), cos(t), t_1) / cosh(asinh(t_2)))); else tmp = Float64(eh * cos(t)); 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]}, If[LessEqual[eh, -8.8e+27], N[(eh * (-N[Cos[t], $MachinePrecision])), $MachinePrecision], If[LessEqual[eh, 5.5e-48], N[Abs[N[(N[(N[(N[(N[(eh / ew), $MachinePrecision] * eh), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t], $MachinePrecision] + t$95$1), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 1.7e+106], N[Abs[N[(N[(N[(N[(eh * eh), $MachinePrecision] / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] * N[Cos[t], $MachinePrecision] + t$95$1), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin t \cdot ew\\
t_2 := \frac{\frac{eh}{\tan t}}{ew}\\
\mathbf{if}\;eh \leq -8.8 \cdot 10^{+27}:\\
\;\;\;\;eh \cdot \left(-\cos t\right)\\
\mathbf{elif}\;eh \leq 5.5 \cdot 10^{-48}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew} \cdot eh}{\tan t}, \cos t, t\_1\right)}{\sqrt{1 + {t\_2}^{2}}}\right|\\
\mathbf{elif}\;eh \leq 1.7 \cdot 10^{+106}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{eh \cdot eh}{\tan t \cdot ew}, \cos t, t\_1\right)}{\cosh \sinh^{-1} t\_2}\right|\\
\mathbf{else}:\\
\;\;\;\;eh \cdot \cos t\\
\end{array}
\end{array}
if eh < -8.7999999999999995e27Initial program 99.8%
Applied rewrites17.4%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites15.4%
lift-tan.f64N/A
tan-+PI-revN/A
tan-quotN/A
sin-+PI-revN/A
lift-sin.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f6414.6
Applied rewrites14.6%
Taylor expanded in eh around -inf
lower-*.f64N/A
cos-+PIN/A
lower-neg.f64N/A
lift-cos.f6464.7
Applied rewrites64.7%
if -8.7999999999999995e27 < eh < 5.50000000000000047e-48Initial program 99.8%
Applied rewrites88.9%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites80.6%
if 5.50000000000000047e-48 < eh < 1.69999999999999997e106Initial program 99.8%
Applied rewrites72.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6472.1
Applied rewrites72.1%
if 1.69999999999999997e106 < eh Initial program 99.8%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrt52.7
lift-+.f64N/A
+-commutativeN/A
Applied rewrites13.5%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites13.1%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f645.0
Applied rewrites5.0%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6468.7
Applied rewrites68.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)))
(if (<= eh -1.2e+31)
(* eh (- (cos t)))
(if (<= eh 1.7e+106)
(fabs (/ (fma (* t_1 eh) (cos t) (* (sin t) ew)) (cosh (asinh t_1))))
(* eh (cos t))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
double tmp;
if (eh <= -1.2e+31) {
tmp = eh * -cos(t);
} else if (eh <= 1.7e+106) {
tmp = fabs((fma((t_1 * eh), cos(t), (sin(t) * ew)) / cosh(asinh(t_1))));
} else {
tmp = eh * cos(t);
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) tmp = 0.0 if (eh <= -1.2e+31) tmp = Float64(eh * Float64(-cos(t))); elseif (eh <= 1.7e+106) tmp = abs(Float64(fma(Float64(t_1 * eh), cos(t), Float64(sin(t) * ew)) / cosh(asinh(t_1)))); else tmp = Float64(eh * cos(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[eh, -1.2e+31], N[(eh * (-N[Cos[t], $MachinePrecision])), $MachinePrecision], If[LessEqual[eh, 1.7e+106], N[Abs[N[(N[(N[(t$95$1 * eh), $MachinePrecision] * N[Cos[t], $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
\mathbf{if}\;eh \leq -1.2 \cdot 10^{+31}:\\
\;\;\;\;eh \cdot \left(-\cos t\right)\\
\mathbf{elif}\;eh \leq 1.7 \cdot 10^{+106}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(t\_1 \cdot eh, \cos t, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_1}\right|\\
\mathbf{else}:\\
\;\;\;\;eh \cdot \cos t\\
\end{array}
\end{array}
if eh < -1.19999999999999991e31Initial program 99.8%
Applied rewrites16.9%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites15.1%
lift-tan.f64N/A
tan-+PI-revN/A
tan-quotN/A
sin-+PI-revN/A
lift-sin.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f6414.2
Applied rewrites14.2%
Taylor expanded in eh around -inf
lower-*.f64N/A
cos-+PIN/A
lower-neg.f64N/A
lift-cos.f6465.0
Applied rewrites65.0%
if -1.19999999999999991e31 < eh < 1.69999999999999997e106Initial program 99.8%
Applied rewrites85.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6488.3
Applied rewrites88.3%
if 1.69999999999999997e106 < eh Initial program 99.8%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrt52.7
lift-+.f64N/A
+-commutativeN/A
Applied rewrites13.5%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites13.1%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f645.0
Applied rewrites5.0%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6468.7
Applied rewrites68.7%
(FPCore (eh ew t)
:precision binary64
(if (<= eh -8.8e+27)
(* eh (- (cos t)))
(if (<= eh 1.1e+95)
(fabs
(/
(fma (/ (* (/ eh ew) eh) (tan t)) (cos t) (* (sin t) ew))
(sqrt (+ 1.0 (pow (/ (/ eh (tan t)) ew) 2.0)))))
(* eh (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -8.8e+27) {
tmp = eh * -cos(t);
} else if (eh <= 1.1e+95) {
tmp = fabs((fma((((eh / ew) * eh) / tan(t)), cos(t), (sin(t) * ew)) / sqrt((1.0 + pow(((eh / tan(t)) / ew), 2.0)))));
} else {
tmp = eh * cos(t);
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (eh <= -8.8e+27) tmp = Float64(eh * Float64(-cos(t))); elseif (eh <= 1.1e+95) tmp = abs(Float64(fma(Float64(Float64(Float64(eh / ew) * eh) / tan(t)), cos(t), Float64(sin(t) * ew)) / sqrt(Float64(1.0 + (Float64(Float64(eh / tan(t)) / ew) ^ 2.0))))); else tmp = Float64(eh * cos(t)); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[eh, -8.8e+27], N[(eh * (-N[Cos[t], $MachinePrecision])), $MachinePrecision], If[LessEqual[eh, 1.1e+95], N[Abs[N[(N[(N[(N[(N[(eh / ew), $MachinePrecision] * eh), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t], $MachinePrecision] + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -8.8 \cdot 10^{+27}:\\
\;\;\;\;eh \cdot \left(-\cos t\right)\\
\mathbf{elif}\;eh \leq 1.1 \cdot 10^{+95}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew} \cdot eh}{\tan t}, \cos t, \sin t \cdot ew\right)}{\sqrt{1 + {\left(\frac{\frac{eh}{\tan t}}{ew}\right)}^{2}}}\right|\\
\mathbf{else}:\\
\;\;\;\;eh \cdot \cos t\\
\end{array}
\end{array}
if eh < -8.7999999999999995e27Initial program 99.8%
Applied rewrites17.4%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites15.4%
lift-tan.f64N/A
tan-+PI-revN/A
tan-quotN/A
sin-+PI-revN/A
lift-sin.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f6414.6
Applied rewrites14.6%
Taylor expanded in eh around -inf
lower-*.f64N/A
cos-+PIN/A
lower-neg.f64N/A
lift-cos.f6464.7
Applied rewrites64.7%
if -8.7999999999999995e27 < eh < 1.0999999999999999e95Initial program 99.8%
Applied rewrites86.0%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites76.3%
if 1.0999999999999999e95 < eh Initial program 99.8%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrt52.4
lift-+.f64N/A
+-commutativeN/A
Applied rewrites14.0%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites13.6%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f646.0
Applied rewrites6.0%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6468.4
Applied rewrites68.4%
(FPCore (eh ew t) :precision binary64 (if (<= eh -2e+27) (* eh (- (cos t))) (if (<= eh 3.35e-15) (fabs (* ew (sin t))) (* eh (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -2e+27) {
tmp = eh * -cos(t);
} else if (eh <= 3.35e-15) {
tmp = fabs((ew * sin(t)));
} else {
tmp = 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 (eh <= (-2d+27)) then
tmp = eh * -cos(t)
else if (eh <= 3.35d-15) then
tmp = abs((ew * sin(t)))
else
tmp = eh * cos(t)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= -2e+27) {
tmp = eh * -Math.cos(t);
} else if (eh <= 3.35e-15) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = eh * Math.cos(t);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -2e+27: tmp = eh * -math.cos(t) elif eh <= 3.35e-15: tmp = math.fabs((ew * math.sin(t))) else: tmp = eh * math.cos(t) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -2e+27) tmp = Float64(eh * Float64(-cos(t))); elseif (eh <= 3.35e-15) tmp = abs(Float64(ew * sin(t))); else tmp = Float64(eh * cos(t)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= -2e+27) tmp = eh * -cos(t); elseif (eh <= 3.35e-15) tmp = abs((ew * sin(t))); else tmp = eh * cos(t); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -2e+27], N[(eh * (-N[Cos[t], $MachinePrecision])), $MachinePrecision], If[LessEqual[eh, 3.35e-15], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -2 \cdot 10^{+27}:\\
\;\;\;\;eh \cdot \left(-\cos t\right)\\
\mathbf{elif}\;eh \leq 3.35 \cdot 10^{-15}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;eh \cdot \cos t\\
\end{array}
\end{array}
if eh < -2e27Initial program 99.8%
Applied rewrites17.5%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites15.5%
lift-tan.f64N/A
tan-+PI-revN/A
tan-quotN/A
sin-+PI-revN/A
lift-sin.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f6414.5
Applied rewrites14.5%
Taylor expanded in eh around -inf
lower-*.f64N/A
cos-+PIN/A
lower-neg.f64N/A
lift-cos.f6464.7
Applied rewrites64.7%
if -2e27 < eh < 3.35e-15Initial program 99.8%
Applied rewrites88.7%
lift-tan.f64N/A
tan-+PI-revN/A
lower-tan.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f6473.8
Applied rewrites73.8%
Taylor expanded in eh around 0
lift-sin.f64N/A
lift-*.f6462.4
Applied rewrites62.4%
if 3.35e-15 < eh Initial program 99.8%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrt51.1
lift-+.f64N/A
+-commutativeN/A
Applied rewrites20.4%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites17.5%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6412.5
Applied rewrites12.5%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6463.4
Applied rewrites63.4%
(FPCore (eh ew t) :precision binary64 (if (<= eh -1.3e-248) (* eh (- (cos t))) (if (<= eh 1.65e-169) (* ew (sin t)) (* eh (cos t)))))
double code(double eh, double ew, double t) {
double tmp;
if (eh <= -1.3e-248) {
tmp = eh * -cos(t);
} else if (eh <= 1.65e-169) {
tmp = ew * sin(t);
} else {
tmp = 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 (eh <= (-1.3d-248)) then
tmp = eh * -cos(t)
else if (eh <= 1.65d-169) then
tmp = ew * sin(t)
else
tmp = eh * cos(t)
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (eh <= -1.3e-248) {
tmp = eh * -Math.cos(t);
} else if (eh <= 1.65e-169) {
tmp = ew * Math.sin(t);
} else {
tmp = eh * Math.cos(t);
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if eh <= -1.3e-248: tmp = eh * -math.cos(t) elif eh <= 1.65e-169: tmp = ew * math.sin(t) else: tmp = eh * math.cos(t) return tmp
function code(eh, ew, t) tmp = 0.0 if (eh <= -1.3e-248) tmp = Float64(eh * Float64(-cos(t))); elseif (eh <= 1.65e-169) tmp = Float64(ew * sin(t)); else tmp = Float64(eh * cos(t)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (eh <= -1.3e-248) tmp = eh * -cos(t); elseif (eh <= 1.65e-169) tmp = ew * sin(t); else tmp = eh * cos(t); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[eh, -1.3e-248], N[(eh * (-N[Cos[t], $MachinePrecision])), $MachinePrecision], If[LessEqual[eh, 1.65e-169], N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.3 \cdot 10^{-248}:\\
\;\;\;\;eh \cdot \left(-\cos t\right)\\
\mathbf{elif}\;eh \leq 1.65 \cdot 10^{-169}:\\
\;\;\;\;ew \cdot \sin t\\
\mathbf{else}:\\
\;\;\;\;eh \cdot \cos t\\
\end{array}
\end{array}
if eh < -1.30000000000000003e-248Initial program 99.8%
Applied rewrites30.7%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites27.1%
lift-tan.f64N/A
tan-+PI-revN/A
tan-quotN/A
sin-+PI-revN/A
lift-sin.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f6426.7
Applied rewrites26.7%
Taylor expanded in eh around -inf
lower-*.f64N/A
cos-+PIN/A
lower-neg.f64N/A
lift-cos.f6452.2
Applied rewrites52.2%
if -1.30000000000000003e-248 < eh < 1.65000000000000013e-169Initial program 99.8%
Applied rewrites45.6%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites44.1%
lift-tan.f64N/A
tan-+PI-revN/A
tan-quotN/A
sin-+PI-revN/A
lift-sin.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f6443.5
Applied rewrites43.5%
Taylor expanded in eh around 0
lift-sin.f64N/A
lift-*.f6441.0
Applied rewrites41.0%
if 1.65000000000000013e-169 < eh Initial program 99.8%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrt51.0
lift-+.f64N/A
+-commutativeN/A
Applied rewrites29.0%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites24.5%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6419.1
Applied rewrites19.1%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6456.0
Applied rewrites56.0%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (* eh (cos t)))) (if (<= eh -5.6e-15) t_1 (if (<= eh 1.65e-169) (* ew (sin t)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if (eh <= -5.6e-15) {
tmp = t_1;
} else if (eh <= 1.65e-169) {
tmp = ew * sin(t);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = eh * cos(t)
if (eh <= (-5.6d-15)) then
tmp = t_1
else if (eh <= 1.65d-169) then
tmp = ew * sin(t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh * Math.cos(t);
double tmp;
if (eh <= -5.6e-15) {
tmp = t_1;
} else if (eh <= 1.65e-169) {
tmp = ew * Math.sin(t);
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * math.cos(t) tmp = 0 if eh <= -5.6e-15: tmp = t_1 elif eh <= 1.65e-169: tmp = ew * math.sin(t) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) tmp = 0.0 if (eh <= -5.6e-15) tmp = t_1; elseif (eh <= 1.65e-169) tmp = Float64(ew * sin(t)); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * cos(t); tmp = 0.0; if (eh <= -5.6e-15) tmp = t_1; elseif (eh <= 1.65e-169) tmp = ew * sin(t); else tmp = t_1; end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -5.6e-15], t$95$1, If[LessEqual[eh, 1.65e-169], N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -5.6 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 1.65 \cdot 10^{-169}:\\
\;\;\;\;ew \cdot \sin t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -5.60000000000000028e-15 or 1.65000000000000013e-169 < eh Initial program 99.8%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrt51.5
lift-+.f64N/A
+-commutativeN/A
Applied rewrites25.7%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites22.0%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6417.0
Applied rewrites17.0%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6441.4
Applied rewrites41.4%
if -5.60000000000000028e-15 < eh < 1.65000000000000013e-169Initial program 99.8%
Applied rewrites45.0%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites41.6%
lift-tan.f64N/A
tan-+PI-revN/A
tan-quotN/A
sin-+PI-revN/A
lift-sin.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f6441.7
Applied rewrites41.7%
Taylor expanded in eh around 0
lift-sin.f64N/A
lift-*.f6435.6
Applied rewrites35.6%
(FPCore (eh ew t) :precision binary64 (* eh (cos t)))
double code(double eh, double ew, double t) {
return eh * cos(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 = eh * cos(t)
end function
public static double code(double eh, double ew, double t) {
return eh * Math.cos(t);
}
def code(eh, ew, t): return eh * math.cos(t)
function code(eh, ew, t) return Float64(eh * cos(t)) end
function tmp = code(eh, ew, t) tmp = eh * cos(t); end
code[eh_, ew_, t_] := N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
eh \cdot \cos t
\end{array}
Initial program 99.8%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrt51.4
lift-+.f64N/A
+-commutativeN/A
Applied rewrites33.8%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites30.1%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6422.3
Applied rewrites22.3%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6432.1
Applied rewrites32.1%
(FPCore (eh ew t) :precision binary64 eh)
double code(double eh, double ew, double t) {
return eh;
}
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 = eh
end function
public static double code(double eh, double ew, double t) {
return eh;
}
def code(eh, ew, t): return eh
function code(eh, ew, t) return eh end
function tmp = code(eh, ew, t) tmp = eh; end
code[eh_, ew_, t_] := eh
\begin{array}{l}
\\
eh
\end{array}
Initial program 99.8%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
rem-square-sqrt51.4
lift-+.f64N/A
+-commutativeN/A
Applied rewrites33.8%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites30.1%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6422.3
Applied rewrites22.3%
Taylor expanded in t around 0
Applied rewrites22.4%
herbie shell --seed 2025107
(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))))))))