
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((eh / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* (cos (atan (/ eh (* ew (tan t))))) ew) (sin t)) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs((((cos(atan((eh / (ew * tan(t))))) * ew) * sin(t)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(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((((cos(atan((eh / (ew * tan(t))))) * ew) * sin(t)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((Math.cos(Math.atan((eh / (ew * Math.tan(t))))) * ew) * Math.sin(t)) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs((((math.cos(math.atan((eh / (ew * math.tan(t))))) * ew) * math.sin(t)) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(cos(atan(Float64(eh / Float64(ew * tan(t))))) * ew) * sin(t)) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((cos(atan((eh / (ew * tan(t))))) * ew) * sin(t)) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(N[Cos[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * ew), $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot ew\right) \cdot \sin t + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.8
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ eh (* (tan t) ew))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * sin(t)) * cos(atan(((eh / ew) / tan(t))))) + ((eh * cos(t)) * sin(atan((eh / (tan(t) * ew)))))));
}
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 * sin(t)) * cos(atan(((eh / ew) / tan(t))))) + ((eh * cos(t)) * sin(atan((eh / (tan(t) * ew)))))))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((((ew * Math.sin(t)) * Math.cos(Math.atan(((eh / ew) / Math.tan(t))))) + ((eh * Math.cos(t)) * Math.sin(Math.atan((eh / (Math.tan(t) * ew)))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.sin(t)) * math.cos(math.atan(((eh / ew) / math.tan(t))))) + ((eh * math.cos(t)) * math.sin(math.atan((eh / (math.tan(t) * ew)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(tan(t) * ew))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * sin(t)) * cos(atan(((eh / ew) / tan(t))))) + ((eh * cos(t)) * sin(atan((eh / (tan(t) * ew))))))); end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right|
\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%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* (sin t) ew))
(t_2 (/ eh (tan t)))
(t_3 (/ t_2 ew))
(t_4 (cosh (asinh t_3))))
(if (<= t -9.2e+35)
(fabs (/ (fma (* (cos t) t_3) eh t_1) t_4))
(if (<= t 2.65e+31)
(fabs
(+
(* (* (cos (atan (/ eh (* ew (tan t))))) ew) (sin t))
(* eh (sin (atan (/ (/ eh ew) (tan t)))))))
(fabs (/ (fma (/ (* t_2 (cos t)) ew) eh t_1) t_4))))))
double code(double eh, double ew, double t) {
double t_1 = sin(t) * ew;
double t_2 = eh / tan(t);
double t_3 = t_2 / ew;
double t_4 = cosh(asinh(t_3));
double tmp;
if (t <= -9.2e+35) {
tmp = fabs((fma((cos(t) * t_3), eh, t_1) / t_4));
} else if (t <= 2.65e+31) {
tmp = fabs((((cos(atan((eh / (ew * tan(t))))) * ew) * sin(t)) + (eh * sin(atan(((eh / ew) / tan(t)))))));
} else {
tmp = fabs((fma(((t_2 * cos(t)) / ew), eh, t_1) / t_4));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(sin(t) * ew) t_2 = Float64(eh / tan(t)) t_3 = Float64(t_2 / ew) t_4 = cosh(asinh(t_3)) tmp = 0.0 if (t <= -9.2e+35) tmp = abs(Float64(fma(Float64(cos(t) * t_3), eh, t_1) / t_4)); elseif (t <= 2.65e+31) tmp = abs(Float64(Float64(Float64(cos(atan(Float64(eh / Float64(ew * tan(t))))) * ew) * sin(t)) + Float64(eh * sin(atan(Float64(Float64(eh / ew) / tan(t))))))); else tmp = abs(Float64(fma(Float64(Float64(t_2 * cos(t)) / ew), eh, t_1) / t_4)); 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[(t$95$2 / ew), $MachinePrecision]}, Block[{t$95$4 = N[Cosh[N[ArcSinh[t$95$3], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -9.2e+35], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$3), $MachinePrecision] * eh + t$95$1), $MachinePrecision] / t$95$4), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 2.65e+31], N[Abs[N[(N[(N[(N[Cos[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * ew), $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $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$4), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin t \cdot ew\\
t_2 := \frac{eh}{\tan t}\\
t_3 := \frac{t\_2}{ew}\\
t_4 := \cosh \sinh^{-1} t\_3\\
\mathbf{if}\;t \leq -9.2 \cdot 10^{+35}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_3, eh, t\_1\right)}{t\_4}\right|\\
\mathbf{elif}\;t \leq 2.65 \cdot 10^{+31}:\\
\;\;\;\;\left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot ew\right) \cdot \sin t + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{t\_2 \cdot \cos t}{ew}, eh, t\_1\right)}{t\_4}\right|\\
\end{array}
\end{array}
if t < -9.1999999999999993e35Initial program 99.6%
Applied rewrites73.9%
if -9.1999999999999993e35 < t < 2.6500000000000002e31Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.9
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
unpow1N/A
metadata-evalN/A
pow-unpowN/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-pow.f6494.7
Applied rewrites94.7%
Taylor expanded in t around 0
Applied rewrites96.0%
if 2.6500000000000002e31 < t Initial program 99.6%
Applied rewrites74.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6474.9
Applied rewrites74.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t))))
(if (<= eh -4.3e+80)
(* -1.0 t_1)
(if (<= eh 3.9e+27)
(fabs
(/
(fma (/ (* (/ eh ew) (cos t)) (tan t)) eh (* (sin t) ew))
(cosh (asinh (/ (/ eh (tan t)) ew)))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if (eh <= -4.3e+80) {
tmp = -1.0 * t_1;
} else if (eh <= 3.9e+27) {
tmp = fabs((fma((((eh / ew) * cos(t)) / tan(t)), eh, (sin(t) * ew)) / cosh(asinh(((eh / tan(t)) / ew)))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) tmp = 0.0 if (eh <= -4.3e+80) tmp = Float64(-1.0 * t_1); elseif (eh <= 3.9e+27) tmp = abs(Float64(fma(Float64(Float64(Float64(eh / ew) * cos(t)) / tan(t)), eh, Float64(sin(t) * ew)) / cosh(asinh(Float64(Float64(eh / tan(t)) / ew))))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -4.3e+80], N[(-1.0 * t$95$1), $MachinePrecision], If[LessEqual[eh, 3.9e+27], N[Abs[N[(N[(N[(N[(N[(eh / ew), $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -4.3 \cdot 10^{+80}:\\
\;\;\;\;-1 \cdot t\_1\\
\mathbf{elif}\;eh \leq 3.9 \cdot 10^{+27}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew} \cdot \cos t}{\tan t}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -4.30000000000000004e80Initial program 99.8%
Applied rewrites13.7%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval12.9
Applied rewrites12.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f647.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.4
Applied rewrites7.4%
Taylor expanded in eh around -inf
lower-*.f64N/A
lower-*.f64N/A
lift-cos.f6467.1
Applied rewrites67.1%
if -4.30000000000000004e80 < eh < 3.8999999999999999e27Initial program 99.8%
Applied rewrites89.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6489.5
Applied rewrites89.5%
if 3.8999999999999999e27 < eh Initial program 99.8%
Applied rewrites17.0%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval15.5
Applied rewrites15.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6410.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6410.2
Applied rewrites10.2%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6465.2
Applied rewrites65.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)) (t_2 (* eh (cos t))))
(if (<= eh -4.3e+80)
(* -1.0 t_2)
(if (<= eh 3.9e+27)
(fabs (/ (fma (* (cos t) t_1) eh (* (sin t) ew)) (cosh (asinh t_1))))
t_2))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
double t_2 = eh * cos(t);
double tmp;
if (eh <= -4.3e+80) {
tmp = -1.0 * t_2;
} else if (eh <= 3.9e+27) {
tmp = fabs((fma((cos(t) * t_1), eh, (sin(t) * ew)) / cosh(asinh(t_1))));
} else {
tmp = t_2;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) t_2 = Float64(eh * cos(t)) tmp = 0.0 if (eh <= -4.3e+80) tmp = Float64(-1.0 * t_2); elseif (eh <= 3.9e+27) tmp = abs(Float64(fma(Float64(cos(t) * t_1), eh, Float64(sin(t) * ew)) / cosh(asinh(t_1)))); else tmp = t_2; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -4.3e+80], N[(-1.0 * t$95$2), $MachinePrecision], If[LessEqual[eh, 3.9e+27], 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], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
t_2 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -4.3 \cdot 10^{+80}:\\
\;\;\;\;-1 \cdot t\_2\\
\mathbf{elif}\;eh \leq 3.9 \cdot 10^{+27}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_1}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if eh < -4.30000000000000004e80Initial program 99.8%
Applied rewrites13.7%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval12.9
Applied rewrites12.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f647.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.4
Applied rewrites7.4%
Taylor expanded in eh around -inf
lower-*.f64N/A
lower-*.f64N/A
lift-cos.f6467.1
Applied rewrites67.1%
if -4.30000000000000004e80 < eh < 3.8999999999999999e27Initial program 99.8%
Applied rewrites89.5%
if 3.8999999999999999e27 < eh Initial program 99.8%
Applied rewrites17.0%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval15.5
Applied rewrites15.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6410.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6410.2
Applied rewrites10.2%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6465.2
Applied rewrites65.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t))))
(if (<= eh -4.3e+80)
(* -1.0 t_1)
(if (<= eh 3.9e+27)
(fabs
(/
(fma (/ (* (cos t) eh) (* (tan t) ew)) eh (* (sin t) ew))
(cosh (asinh (/ (/ eh (tan t)) ew)))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if (eh <= -4.3e+80) {
tmp = -1.0 * t_1;
} else if (eh <= 3.9e+27) {
tmp = fabs((fma(((cos(t) * eh) / (tan(t) * ew)), eh, (sin(t) * ew)) / cosh(asinh(((eh / tan(t)) / ew)))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) tmp = 0.0 if (eh <= -4.3e+80) tmp = Float64(-1.0 * t_1); elseif (eh <= 3.9e+27) tmp = abs(Float64(fma(Float64(Float64(cos(t) * eh) / Float64(tan(t) * ew)), eh, Float64(sin(t) * ew)) / cosh(asinh(Float64(Float64(eh / tan(t)) / ew))))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -4.3e+80], N[(-1.0 * t$95$1), $MachinePrecision], If[LessEqual[eh, 3.9e+27], N[Abs[N[(N[(N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -4.3 \cdot 10^{+80}:\\
\;\;\;\;-1 \cdot t\_1\\
\mathbf{elif}\;eh \leq 3.9 \cdot 10^{+27}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\cos t \cdot eh}{\tan t \cdot ew}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -4.30000000000000004e80Initial program 99.8%
Applied rewrites13.7%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval12.9
Applied rewrites12.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f647.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.4
Applied rewrites7.4%
Taylor expanded in eh around -inf
lower-*.f64N/A
lower-*.f64N/A
lift-cos.f6467.1
Applied rewrites67.1%
if -4.30000000000000004e80 < eh < 3.8999999999999999e27Initial program 99.8%
Applied rewrites89.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6483.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.9
Applied rewrites83.9%
if 3.8999999999999999e27 < eh Initial program 99.8%
Applied rewrites17.0%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval15.5
Applied rewrites15.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6410.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6410.2
Applied rewrites10.2%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6465.2
Applied rewrites65.2%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t))))
(if (<= eh -1.24e+64)
(* -1.0 t_1)
(if (<= eh 2.1)
(fabs
(/
(fma (* (cos t) (/ (/ eh (fma t 1.0 0.0)) ew)) eh (* (sin t) ew))
(cosh (asinh (/ (/ eh (tan t)) ew)))))
t_1))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if (eh <= -1.24e+64) {
tmp = -1.0 * t_1;
} else if (eh <= 2.1) {
tmp = fabs((fma((cos(t) * ((eh / fma(t, 1.0, 0.0)) / ew)), eh, (sin(t) * ew)) / cosh(asinh(((eh / tan(t)) / ew)))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) tmp = 0.0 if (eh <= -1.24e+64) tmp = Float64(-1.0 * t_1); elseif (eh <= 2.1) tmp = abs(Float64(fma(Float64(cos(t) * Float64(Float64(eh / fma(t, 1.0, 0.0)) / ew)), eh, Float64(sin(t) * ew)) / cosh(asinh(Float64(Float64(eh / tan(t)) / ew))))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -1.24e+64], N[(-1.0 * t$95$1), $MachinePrecision], If[LessEqual[eh, 2.1], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * N[(N[(eh / N[(t * 1.0 + 0.0), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -1.24 \cdot 10^{+64}:\\
\;\;\;\;-1 \cdot t\_1\\
\mathbf{elif}\;eh \leq 2.1:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\mathsf{fma}\left(t, 1, 0\right)}}{ew}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.24e64Initial program 99.8%
Applied rewrites15.0%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval13.7
Applied rewrites13.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f648.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f648.6
Applied rewrites8.6%
Taylor expanded in eh around -inf
lower-*.f64N/A
lower-*.f64N/A
lift-cos.f6466.0
Applied rewrites66.0%
if -1.24e64 < eh < 2.10000000000000009Initial program 99.8%
Applied rewrites90.4%
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 t around 0
unpow2N/A
sin-PIN/A
sin-PIN/A
metadata-evalN/A
cos-PIN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
cos-PIN/A
sin-PIN/A
metadata-evalN/A
sin-PIN/A
Applied rewrites77.7%
if 2.10000000000000009 < eh Initial program 99.8%
Applied rewrites19.2%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval17.2
Applied rewrites17.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6412.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.3
Applied rewrites12.3%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6463.4
Applied rewrites63.4%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t))))
(if (<= eh -4.2e+61)
(* -1.0 t_1)
(if (<= eh 0.0058) (fabs (* ew (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if (eh <= -4.2e+61) {
tmp = -1.0 * t_1;
} else if (eh <= 0.0058) {
tmp = fabs((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 <= (-4.2d+61)) then
tmp = (-1.0d0) * t_1
else if (eh <= 0.0058d0) then
tmp = abs((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 <= -4.2e+61) {
tmp = -1.0 * t_1;
} else if (eh <= 0.0058) {
tmp = Math.abs((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 <= -4.2e+61: tmp = -1.0 * t_1 elif eh <= 0.0058: tmp = math.fabs((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 <= -4.2e+61) tmp = Float64(-1.0 * t_1); elseif (eh <= 0.0058) tmp = abs(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 <= -4.2e+61) tmp = -1.0 * t_1; elseif (eh <= 0.0058) tmp = abs((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, -4.2e+61], N[(-1.0 * t$95$1), $MachinePrecision], If[LessEqual[eh, 0.0058], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -4.2 \cdot 10^{+61}:\\
\;\;\;\;-1 \cdot t\_1\\
\mathbf{elif}\;eh \leq 0.0058:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -4.2000000000000002e61Initial program 99.8%
Applied rewrites15.1%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval13.8
Applied rewrites13.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f648.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f648.8
Applied rewrites8.8%
Taylor expanded in eh around -inf
lower-*.f64N/A
lower-*.f64N/A
lift-cos.f6465.9
Applied rewrites65.9%
if -4.2000000000000002e61 < eh < 0.0058Initial program 99.8%
Applied rewrites90.5%
lift-tan.f64N/A
tan-+PI-revN/A
lower-tan.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f6474.0
Applied rewrites74.0%
Taylor expanded in eh around 0
lower-*.f64N/A
lift-sin.f6461.3
Applied rewrites61.3%
if 0.0058 < eh Initial program 99.8%
Applied rewrites19.4%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval17.4
Applied rewrites17.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6412.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.6
Applied rewrites12.6%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6463.4
Applied rewrites63.4%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (* eh (cos t)))) (if (<= eh -1.7e+244) t_1 (if (<= eh 0.0058) (fabs (* ew (sin t))) t_1))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if (eh <= -1.7e+244) {
tmp = t_1;
} else if (eh <= 0.0058) {
tmp = fabs((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 <= (-1.7d+244)) then
tmp = t_1
else if (eh <= 0.0058d0) then
tmp = abs((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 <= -1.7e+244) {
tmp = t_1;
} else if (eh <= 0.0058) {
tmp = Math.abs((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 <= -1.7e+244: tmp = t_1 elif eh <= 0.0058: tmp = math.fabs((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 <= -1.7e+244) tmp = t_1; elseif (eh <= 0.0058) tmp = abs(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 <= -1.7e+244) tmp = t_1; elseif (eh <= 0.0058) tmp = abs((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, -1.7e+244], t$95$1, If[LessEqual[eh, 0.0058], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -1.7 \cdot 10^{+244}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 0.0058:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -1.70000000000000005e244 or 0.0058 < eh Initial program 99.8%
Applied rewrites16.8%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval15.0
Applied rewrites15.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6410.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6410.5
Applied rewrites10.5%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6456.9
Applied rewrites56.9%
if -1.70000000000000005e244 < eh < 0.0058Initial program 99.8%
Applied rewrites78.7%
lift-tan.f64N/A
tan-+PI-revN/A
lower-tan.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-PI.f6464.4
Applied rewrites64.4%
Taylor expanded in eh around 0
lower-*.f64N/A
lift-sin.f6452.3
Applied rewrites52.3%
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (* eh (cos t)))) (if (<= eh -7e+205) t_1 (if (<= eh 2.4e-172) (* ew (sin t)) t_1))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if (eh <= -7e+205) {
tmp = t_1;
} else if (eh <= 2.4e-172) {
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 <= (-7d+205)) then
tmp = t_1
else if (eh <= 2.4d-172) 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 <= -7e+205) {
tmp = t_1;
} else if (eh <= 2.4e-172) {
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 <= -7e+205: tmp = t_1 elif eh <= 2.4e-172: 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 <= -7e+205) tmp = t_1; elseif (eh <= 2.4e-172) 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 <= -7e+205) tmp = t_1; elseif (eh <= 2.4e-172) 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, -7e+205], t$95$1, If[LessEqual[eh, 2.4e-172], 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 -7 \cdot 10^{+205}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;eh \leq 2.4 \cdot 10^{-172}:\\
\;\;\;\;ew \cdot \sin t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if eh < -6.9999999999999996e205 or 2.4000000000000001e-172 < eh Initial program 99.8%
Applied rewrites24.6%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval21.7
Applied rewrites21.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6418.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6418.1
Applied rewrites18.1%
Taylor expanded in eh around inf
lower-*.f64N/A
lift-cos.f6450.3
Applied rewrites50.3%
if -6.9999999999999996e205 < eh < 2.4000000000000001e-172Initial program 99.8%
Applied rewrites39.4%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval35.8
Applied rewrites35.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6431.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6431.6
Applied rewrites31.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lift-sin.f6427.9
Applied rewrites27.9%
(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%
Applied rewrites32.3%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval29.1
Applied rewrites29.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6425.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6425.2
Applied rewrites25.2%
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%
Applied rewrites32.3%
lift-cosh.f64N/A
lift-asinh.f64N/A
cosh-asinhN/A
+-commutativeN/A
lower-sqrt.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower--.f64N/A
pow2N/A
lower-pow.f64N/A
metadata-eval29.1
Applied rewrites29.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f6425.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6425.2
Applied rewrites25.2%
Taylor expanded in t around 0
Applied rewrites22.0%
herbie shell --seed 2025106
(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))))))))