
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((eh / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (eh ew t) :precision binary64 (let* ((t_1 (atan (/ (/ eh ew) (tan t))))) (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
double t_1 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = atan(((eh / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_1)) + ((eh * Math.cos(t)) * Math.sin(t_1))));
}
def code(eh, ew, t): t_1 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_1)) + ((eh * math.cos(t)) * math.sin(t_1))))
function code(eh, ew, t) t_1 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_1)) + Float64(Float64(eh * cos(t)) * sin(t_1)))) end
function tmp = code(eh, ew, t) t_1 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh ew) (tan t))))
(fabs
(-
(* (* eh (cos t)) (sin (atan t_1)))
(* (* ew (sin t)) (/ -1.0 (sqrt (+ 1.0 (pow t_1 2.0)))))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / tan(t);
return fabs((((eh * cos(t)) * sin(atan(t_1))) - ((ew * sin(t)) * (-1.0 / sqrt((1.0 + pow(t_1, 2.0)))))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: t_1
t_1 = (eh / ew) / tan(t)
code = abs((((eh * cos(t)) * sin(atan(t_1))) - ((ew * sin(t)) * ((-1.0d0) / sqrt((1.0d0 + (t_1 ** 2.0d0)))))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = (eh / ew) / Math.tan(t);
return Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(t_1))) - ((ew * Math.sin(t)) * (-1.0 / Math.sqrt((1.0 + Math.pow(t_1, 2.0)))))));
}
def code(eh, ew, t): t_1 = (eh / ew) / math.tan(t) return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(t_1))) - ((ew * math.sin(t)) * (-1.0 / math.sqrt((1.0 + math.pow(t_1, 2.0)))))))
function code(eh, ew, t) t_1 = Float64(Float64(eh / ew) / tan(t)) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(t_1))) - Float64(Float64(ew * sin(t)) * Float64(-1.0 / sqrt(Float64(1.0 + (t_1 ^ 2.0))))))) end
function tmp = code(eh, ew, t) t_1 = (eh / ew) / tan(t); tmp = abs((((eh * cos(t)) * sin(atan(t_1))) - ((ew * sin(t)) * (-1.0 / sqrt((1.0 + (t_1 ^ 2.0))))))); end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[Sqrt[N[(1.0 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t\_1 - \left(ew \cdot \sin t\right) \cdot \frac{-1}{\sqrt{1 + {t\_1}^{2}}}\right|
\end{array}
\end{array}
Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(fabs
(+
(*
(* eh (cos t))
(sin (atan (/ (/ (fma -0.3333333333333333 (* (* t t) eh) eh) ew) t))))
(* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs((((eh * cos(t)) * sin(atan(((fma(-0.3333333333333333, ((t * t) * eh), eh) / ew) / t)))) + ((ew * sin(t)) * cos(atan(((eh / ew) / tan(t)))))));
}
function code(eh, ew, t) return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(fma(-0.3333333333333333, Float64(Float64(t * t) * eh), eh) / ew) / t)))) + Float64(Float64(ew * sin(t)) * cos(atan(Float64(Float64(eh / ew) / tan(t))))))) end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[(-0.3333333333333333 * N[(N[(t * t), $MachinePrecision] * eh), $MachinePrecision] + eh), $MachinePrecision] / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{\mathsf{fma}\left(-0.3333333333333333, \left(t \cdot t\right) \cdot eh, eh\right)}{ew}}{t}\right) + \left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (sin t))) (t_2 (* eh (cos t))))
(if (or (<= eh -6.8e+76) (not (<= eh 2.3e+84)))
(fabs
(+
(* t_2 (sin (atan (/ (/ eh ew) (tan t)))))
(* t_1 (* (/ ew eh) (tan t)))))
(fabs
(* ew (+ (sin t) (/ (* eh (* (cos t) (sin (atan (/ t_2 t_1))))) ew)))))))
double code(double eh, double ew, double t) {
double t_1 = ew * sin(t);
double t_2 = eh * cos(t);
double tmp;
if ((eh <= -6.8e+76) || !(eh <= 2.3e+84)) {
tmp = fabs(((t_2 * sin(atan(((eh / ew) / tan(t))))) + (t_1 * ((ew / eh) * tan(t)))));
} else {
tmp = fabs((ew * (sin(t) + ((eh * (cos(t) * sin(atan((t_2 / t_1))))) / ew))));
}
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) :: t_2
real(8) :: tmp
t_1 = ew * sin(t)
t_2 = eh * cos(t)
if ((eh <= (-6.8d+76)) .or. (.not. (eh <= 2.3d+84))) then
tmp = abs(((t_2 * sin(atan(((eh / ew) / tan(t))))) + (t_1 * ((ew / eh) * tan(t)))))
else
tmp = abs((ew * (sin(t) + ((eh * (cos(t) * sin(atan((t_2 / t_1))))) / ew))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.sin(t);
double t_2 = eh * Math.cos(t);
double tmp;
if ((eh <= -6.8e+76) || !(eh <= 2.3e+84)) {
tmp = Math.abs(((t_2 * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + (t_1 * ((ew / eh) * Math.tan(t)))));
} else {
tmp = Math.abs((ew * (Math.sin(t) + ((eh * (Math.cos(t) * Math.sin(Math.atan((t_2 / t_1))))) / ew))));
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.sin(t) t_2 = eh * math.cos(t) tmp = 0 if (eh <= -6.8e+76) or not (eh <= 2.3e+84): tmp = math.fabs(((t_2 * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (t_1 * ((ew / eh) * math.tan(t))))) else: tmp = math.fabs((ew * (math.sin(t) + ((eh * (math.cos(t) * math.sin(math.atan((t_2 / t_1))))) / ew)))) return tmp
function code(eh, ew, t) t_1 = Float64(ew * sin(t)) t_2 = Float64(eh * cos(t)) tmp = 0.0 if ((eh <= -6.8e+76) || !(eh <= 2.3e+84)) tmp = abs(Float64(Float64(t_2 * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(t_1 * Float64(Float64(ew / eh) * tan(t))))); else tmp = abs(Float64(ew * Float64(sin(t) + Float64(Float64(eh * Float64(cos(t) * sin(atan(Float64(t_2 / t_1))))) / ew)))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * sin(t); t_2 = eh * cos(t); tmp = 0.0; if ((eh <= -6.8e+76) || ~((eh <= 2.3e+84))) tmp = abs(((t_2 * sin(atan(((eh / ew) / tan(t))))) + (t_1 * ((ew / eh) * tan(t))))); else tmp = abs((ew * (sin(t) + ((eh * (cos(t) * sin(atan((t_2 / t_1))))) / ew)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -6.8e+76], N[Not[LessEqual[eh, 2.3e+84]], $MachinePrecision]], N[Abs[N[(N[(t$95$2 * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(N[(ew / eh), $MachinePrecision] * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[(N[Sin[t], $MachinePrecision] + N[(N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(t$95$2 / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
t_2 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -6.8 \cdot 10^{+76} \lor \neg \left(eh \leq 2.3 \cdot 10^{+84}\right):\\
\;\;\;\;\left|t\_2 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t\_1 \cdot \left(\frac{ew}{eh} \cdot \tan t\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \left(\sin t + \frac{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{t\_2}{t\_1}\right)\right)}{ew}\right)\right|\\
\end{array}
\end{array}
if eh < -6.7999999999999994e76 or 2.2999999999999999e84 < eh Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around inf
unpow2N/A
cos-atanN/A
times-fracN/A
tan-quotN/A
lower-*.f64N/A
lower-/.f64N/A
lift-tan.f6492.5
Applied rewrites92.5%
if -6.7999999999999994e76 < eh < 2.2999999999999999e84Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in ew around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-+.f64N/A
Applied rewrites99.3%
Final simplification96.7%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1
(* eh (* (cos t) (sin (atan (/ (* eh (cos t)) (* ew (sin t)))))))))
(if (or (<= eh -6.8e+76) (not (<= eh 2.3e+84)))
(fabs t_1)
(fabs (* ew (+ (sin t) (/ t_1 ew)))))))
double code(double eh, double ew, double t) {
double t_1 = eh * (cos(t) * sin(atan(((eh * cos(t)) / (ew * sin(t))))));
double tmp;
if ((eh <= -6.8e+76) || !(eh <= 2.3e+84)) {
tmp = fabs(t_1);
} else {
tmp = fabs((ew * (sin(t) + (t_1 / ew))));
}
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) * sin(atan(((eh * cos(t)) / (ew * sin(t))))))
if ((eh <= (-6.8d+76)) .or. (.not. (eh <= 2.3d+84))) then
tmp = abs(t_1)
else
tmp = abs((ew * (sin(t) + (t_1 / ew))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh * (Math.cos(t) * Math.sin(Math.atan(((eh * Math.cos(t)) / (ew * Math.sin(t))))));
double tmp;
if ((eh <= -6.8e+76) || !(eh <= 2.3e+84)) {
tmp = Math.abs(t_1);
} else {
tmp = Math.abs((ew * (Math.sin(t) + (t_1 / ew))));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * (math.cos(t) * math.sin(math.atan(((eh * math.cos(t)) / (ew * math.sin(t)))))) tmp = 0 if (eh <= -6.8e+76) or not (eh <= 2.3e+84): tmp = math.fabs(t_1) else: tmp = math.fabs((ew * (math.sin(t) + (t_1 / ew)))) return tmp
function code(eh, ew, t) t_1 = Float64(eh * Float64(cos(t) * sin(atan(Float64(Float64(eh * cos(t)) / Float64(ew * sin(t))))))) tmp = 0.0 if ((eh <= -6.8e+76) || !(eh <= 2.3e+84)) tmp = abs(t_1); else tmp = abs(Float64(ew * Float64(sin(t) + Float64(t_1 / ew)))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * (cos(t) * sin(atan(((eh * cos(t)) / (ew * sin(t)))))); tmp = 0.0; if ((eh <= -6.8e+76) || ~((eh <= 2.3e+84))) tmp = abs(t_1); else tmp = abs((ew * (sin(t) + (t_1 / ew)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -6.8e+76], N[Not[LessEqual[eh, 2.3e+84]], $MachinePrecision]], N[Abs[t$95$1], $MachinePrecision], N[Abs[N[(ew * N[(N[Sin[t], $MachinePrecision] + N[(t$95$1 / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)\right)\\
\mathbf{if}\;eh \leq -6.8 \cdot 10^{+76} \lor \neg \left(eh \leq 2.3 \cdot 10^{+84}\right):\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \left(\sin t + \frac{t\_1}{ew}\right)\right|\\
\end{array}
\end{array}
if eh < -6.7999999999999994e76 or 2.2999999999999999e84 < eh Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites92.0%
if -6.7999999999999994e76 < eh < 2.2999999999999999e84Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in ew around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-+.f64N/A
Applied rewrites99.3%
Final simplification96.5%
(FPCore (eh ew t)
:precision binary64
(if (or (<= eh -6.8e+76) (not (<= eh 2.3e+84)))
(fabs (* eh (* (cos t) (sin (atan (/ (* eh (cos t)) (* ew (sin t))))))))
(fabs
(*
ew
(+
(sin t)
(/
(*
eh
(*
(cos t)
(sin
(atan
(/
(fma
(* t t)
(- (* -0.5 (/ eh ew)) (* -0.16666666666666666 (/ eh ew)))
(/ eh ew))
t)))))
ew))))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -6.8e+76) || !(eh <= 2.3e+84)) {
tmp = fabs((eh * (cos(t) * sin(atan(((eh * cos(t)) / (ew * sin(t))))))));
} else {
tmp = fabs((ew * (sin(t) + ((eh * (cos(t) * sin(atan((fma((t * t), ((-0.5 * (eh / ew)) - (-0.16666666666666666 * (eh / ew))), (eh / ew)) / t))))) / ew))));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((eh <= -6.8e+76) || !(eh <= 2.3e+84)) tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(Float64(eh * cos(t)) / Float64(ew * sin(t)))))))); else tmp = abs(Float64(ew * Float64(sin(t) + Float64(Float64(eh * Float64(cos(t) * sin(atan(Float64(fma(Float64(t * t), Float64(Float64(-0.5 * Float64(eh / ew)) - Float64(-0.16666666666666666 * Float64(eh / ew))), Float64(eh / ew)) / t))))) / ew)))); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -6.8e+76], N[Not[LessEqual[eh, 2.3e+84]], $MachinePrecision]], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[(N[Sin[t], $MachinePrecision] + N[(N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[(t * t), $MachinePrecision] * N[(N[(-0.5 * N[(eh / ew), $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[(eh / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -6.8 \cdot 10^{+76} \lor \neg \left(eh \leq 2.3 \cdot 10^{+84}\right):\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \left(\sin t + \frac{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\mathsf{fma}\left(t \cdot t, -0.5 \cdot \frac{eh}{ew} - -0.16666666666666666 \cdot \frac{eh}{ew}, \frac{eh}{ew}\right)}{t}\right)\right)}{ew}\right)\right|\\
\end{array}
\end{array}
if eh < -6.7999999999999994e76 or 2.2999999999999999e84 < eh Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites92.0%
if -6.7999999999999994e76 < eh < 2.2999999999999999e84Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in ew around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-+.f64N/A
Applied rewrites99.3%
Taylor expanded in t around 0
lower-/.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6496.8
Applied rewrites96.8%
Final simplification95.0%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -1.1e-190) (not (<= ew 2.75e-129)))
(fabs
(*
ew
(+
(sin t)
(/
(*
eh
(*
(cos t)
(sin
(atan
(/
(fma
(* t t)
(- (* -0.5 (/ eh ew)) (* -0.16666666666666666 (/ eh ew)))
(/ eh ew))
t)))))
ew))))
(fabs (* eh (* (cos t) (sin (atan (/ eh (* ew t)))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -1.1e-190) || !(ew <= 2.75e-129)) {
tmp = fabs((ew * (sin(t) + ((eh * (cos(t) * sin(atan((fma((t * t), ((-0.5 * (eh / ew)) - (-0.16666666666666666 * (eh / ew))), (eh / ew)) / t))))) / ew))));
} else {
tmp = fabs((eh * (cos(t) * sin(atan((eh / (ew * t)))))));
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if ((ew <= -1.1e-190) || !(ew <= 2.75e-129)) tmp = abs(Float64(ew * Float64(sin(t) + Float64(Float64(eh * Float64(cos(t) * sin(atan(Float64(fma(Float64(t * t), Float64(Float64(-0.5 * Float64(eh / ew)) - Float64(-0.16666666666666666 * Float64(eh / ew))), Float64(eh / ew)) / t))))) / ew)))); else tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(eh / Float64(ew * t))))))); end return tmp end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -1.1e-190], N[Not[LessEqual[ew, 2.75e-129]], $MachinePrecision]], N[Abs[N[(ew * N[(N[Sin[t], $MachinePrecision] + N[(N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[(t * t), $MachinePrecision] * N[(N[(-0.5 * N[(eh / ew), $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[(eh / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.1 \cdot 10^{-190} \lor \neg \left(ew \leq 2.75 \cdot 10^{-129}\right):\\
\;\;\;\;\left|ew \cdot \left(\sin t + \frac{eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\mathsf{fma}\left(t \cdot t, -0.5 \cdot \frac{eh}{ew} - -0.16666666666666666 \cdot \frac{eh}{ew}, \frac{eh}{ew}\right)}{t}\right)\right)}{ew}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right)\right|\\
\end{array}
\end{array}
if ew < -1.10000000000000002e-190 or 2.75000000000000012e-129 < ew Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in ew around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-+.f64N/A
Applied rewrites95.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6493.4
Applied rewrites93.4%
if -1.10000000000000002e-190 < ew < 2.75000000000000012e-129Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites97.3%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6487.3
Applied rewrites87.3%
Final simplification91.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (* (cos t) (sin (atan (/ eh (* ew t))))))))
(if (or (<= eh -6.8e+76) (not (<= eh 2.6e+84)))
(fabs t_1)
(fabs (* ew (+ (sin t) (/ t_1 ew)))))))
double code(double eh, double ew, double t) {
double t_1 = eh * (cos(t) * sin(atan((eh / (ew * t)))));
double tmp;
if ((eh <= -6.8e+76) || !(eh <= 2.6e+84)) {
tmp = fabs(t_1);
} else {
tmp = fabs((ew * (sin(t) + (t_1 / ew))));
}
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) * sin(atan((eh / (ew * t)))))
if ((eh <= (-6.8d+76)) .or. (.not. (eh <= 2.6d+84))) then
tmp = abs(t_1)
else
tmp = abs((ew * (sin(t) + (t_1 / ew))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh * (Math.cos(t) * Math.sin(Math.atan((eh / (ew * t)))));
double tmp;
if ((eh <= -6.8e+76) || !(eh <= 2.6e+84)) {
tmp = Math.abs(t_1);
} else {
tmp = Math.abs((ew * (Math.sin(t) + (t_1 / ew))));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * (math.cos(t) * math.sin(math.atan((eh / (ew * t))))) tmp = 0 if (eh <= -6.8e+76) or not (eh <= 2.6e+84): tmp = math.fabs(t_1) else: tmp = math.fabs((ew * (math.sin(t) + (t_1 / ew)))) return tmp
function code(eh, ew, t) t_1 = Float64(eh * Float64(cos(t) * sin(atan(Float64(eh / Float64(ew * t)))))) tmp = 0.0 if ((eh <= -6.8e+76) || !(eh <= 2.6e+84)) tmp = abs(t_1); else tmp = abs(Float64(ew * Float64(sin(t) + Float64(t_1 / ew)))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * (cos(t) * sin(atan((eh / (ew * t))))); tmp = 0.0; if ((eh <= -6.8e+76) || ~((eh <= 2.6e+84))) tmp = abs(t_1); else tmp = abs((ew * (sin(t) + (t_1 / ew)))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -6.8e+76], N[Not[LessEqual[eh, 2.6e+84]], $MachinePrecision]], N[Abs[t$95$1], $MachinePrecision], N[Abs[N[(ew * N[(N[Sin[t], $MachinePrecision] + N[(t$95$1 / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right)\\
\mathbf{if}\;eh \leq -6.8 \cdot 10^{+76} \lor \neg \left(eh \leq 2.6 \cdot 10^{+84}\right):\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \left(\sin t + \frac{t\_1}{ew}\right)\right|\\
\end{array}
\end{array}
if eh < -6.7999999999999994e76 or 2.6000000000000001e84 < eh Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites92.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6481.9
Applied rewrites81.9%
if -6.7999999999999994e76 < eh < 2.6000000000000001e84Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in ew around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-+.f64N/A
Applied rewrites99.3%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6489.5
Applied rewrites89.5%
Final simplification86.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (fabs (* ew (sin t)))))
(if (<= ew -2.15e+76)
t_1
(if (<= ew -1.95e-115)
(fabs
(*
eh
(*
(cos t)
(sin
(atan
(/
(fma
(* t t)
(- (* -0.5 (/ eh ew)) (* -0.16666666666666666 (/ eh ew)))
(/ eh ew))
t))))))
(if (<= ew 2.3e+35)
(fabs (* eh (* (cos t) (sin (atan (/ eh (* ew t)))))))
t_1)))))
double code(double eh, double ew, double t) {
double t_1 = fabs((ew * sin(t)));
double tmp;
if (ew <= -2.15e+76) {
tmp = t_1;
} else if (ew <= -1.95e-115) {
tmp = fabs((eh * (cos(t) * sin(atan((fma((t * t), ((-0.5 * (eh / ew)) - (-0.16666666666666666 * (eh / ew))), (eh / ew)) / t))))));
} else if (ew <= 2.3e+35) {
tmp = fabs((eh * (cos(t) * sin(atan((eh / (ew * t)))))));
} else {
tmp = t_1;
}
return tmp;
}
function code(eh, ew, t) t_1 = abs(Float64(ew * sin(t))) tmp = 0.0 if (ew <= -2.15e+76) tmp = t_1; elseif (ew <= -1.95e-115) tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(fma(Float64(t * t), Float64(Float64(-0.5 * Float64(eh / ew)) - Float64(-0.16666666666666666 * Float64(eh / ew))), Float64(eh / ew)) / t)))))); elseif (ew <= 2.3e+35) tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(eh / Float64(ew * t))))))); else tmp = t_1; end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -2.15e+76], t$95$1, If[LessEqual[ew, -1.95e-115], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[(t * t), $MachinePrecision] * N[(N[(-0.5 * N[(eh / ew), $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[(eh / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 2.3e+35], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;ew \leq -2.15 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq -1.95 \cdot 10^{-115}:\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\mathsf{fma}\left(t \cdot t, -0.5 \cdot \frac{eh}{ew} - -0.16666666666666666 \cdot \frac{eh}{ew}, \frac{eh}{ew}\right)}{t}\right)\right)\right|\\
\mathbf{elif}\;ew \leq 2.3 \cdot 10^{+35}:\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if ew < -2.14999999999999989e76 or 2.2999999999999998e35 < ew Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around 0
unpow2N/A
cos-atanN/A
lift-sin.f64N/A
lift-*.f6470.1
Applied rewrites70.1%
if -2.14999999999999989e76 < ew < -1.9499999999999999e-115Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites78.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6476.1
Applied rewrites76.1%
if -1.9499999999999999e-115 < ew < 2.2999999999999998e35Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites88.3%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6478.0
Applied rewrites78.0%
Final simplification74.8%
(FPCore (eh ew t) :precision binary64 (if (or (<= ew -2.1e+76) (not (<= ew 2.3e+35))) (fabs (* ew (sin t))) (fabs (* eh (* (cos t) (sin (atan (/ eh (* ew t)))))))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -2.1e+76) || !(ew <= 2.3e+35)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs((eh * (cos(t) * sin(atan((eh / (ew * t)))))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
real(8) :: tmp
if ((ew <= (-2.1d+76)) .or. (.not. (ew <= 2.3d+35))) then
tmp = abs((ew * sin(t)))
else
tmp = abs((eh * (cos(t) * sin(atan((eh / (ew * t)))))))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -2.1e+76) || !(ew <= 2.3e+35)) {
tmp = Math.abs((ew * Math.sin(t)));
} else {
tmp = Math.abs((eh * (Math.cos(t) * Math.sin(Math.atan((eh / (ew * t)))))));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -2.1e+76) or not (ew <= 2.3e+35): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs((eh * (math.cos(t) * math.sin(math.atan((eh / (ew * t))))))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -2.1e+76) || !(ew <= 2.3e+35)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(eh / Float64(ew * t))))))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -2.1e+76) || ~((ew <= 2.3e+35))) tmp = abs((ew * sin(t))); else tmp = abs((eh * (cos(t) * sin(atan((eh / (ew * t))))))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -2.1e+76], N[Not[LessEqual[ew, 2.3e+35]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -2.1 \cdot 10^{+76} \lor \neg \left(ew \leq 2.3 \cdot 10^{+35}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right)\right|\\
\end{array}
\end{array}
if ew < -2.10000000000000007e76 or 2.2999999999999998e35 < ew Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around 0
unpow2N/A
cos-atanN/A
lift-sin.f64N/A
lift-*.f6470.1
Applied rewrites70.1%
if -2.10000000000000007e76 < ew < 2.2999999999999998e35Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around inf
unpow2N/A
cos-atanN/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites86.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6473.9
Applied rewrites73.9%
Final simplification72.5%
(FPCore (eh ew t)
:precision binary64
(if (or (<= ew -2.1e+76) (not (<= ew 2.2e+35)))
(fabs (* ew (sin t)))
(fabs
(*
(tanh
(asinh
(* (/ 1.0 ew) (/ (+ eh (* 0.16666666666666666 (* eh (* t t)))) t))))
eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((ew <= -2.1e+76) || !(ew <= 2.2e+35)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs((tanh(asinh(((1.0 / ew) * ((eh + (0.16666666666666666 * (eh * (t * t)))) / t)))) * eh));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (ew <= -2.1e+76) or not (ew <= 2.2e+35): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs((math.tanh(math.asinh(((1.0 / ew) * ((eh + (0.16666666666666666 * (eh * (t * t)))) / t)))) * eh)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((ew <= -2.1e+76) || !(ew <= 2.2e+35)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(tanh(asinh(Float64(Float64(1.0 / ew) * Float64(Float64(eh + Float64(0.16666666666666666 * Float64(eh * Float64(t * t)))) / t)))) * eh)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((ew <= -2.1e+76) || ~((ew <= 2.2e+35))) tmp = abs((ew * sin(t))); else tmp = abs((tanh(asinh(((1.0 / ew) * ((eh + (0.16666666666666666 * (eh * (t * t)))) / t)))) * eh)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -2.1e+76], N[Not[LessEqual[ew, 2.2e+35]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Tanh[N[ArcSinh[N[(N[(1.0 / ew), $MachinePrecision] * N[(N[(eh + N[(0.16666666666666666 * N[(eh * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ew \leq -2.1 \cdot 10^{+76} \lor \neg \left(ew \leq 2.2 \cdot 10^{+35}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\tanh \sinh^{-1} \left(\frac{1}{ew} \cdot \frac{eh + 0.16666666666666666 \cdot \left(eh \cdot \left(t \cdot t\right)\right)}{t}\right) \cdot eh\right|\\
\end{array}
\end{array}
if ew < -2.10000000000000007e76 or 2.1999999999999999e35 < ew Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around 0
unpow2N/A
cos-atanN/A
lift-sin.f64N/A
lift-*.f6470.1
Applied rewrites70.1%
if -2.10000000000000007e76 < ew < 2.1999999999999999e35Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites60.1%
Taylor expanded in t around 0
Applied rewrites60.1%
Taylor expanded in t around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6460.2
Applied rewrites60.2%
Final simplification63.8%
(FPCore (eh ew t) :precision binary64 (if (or (<= t -2.8e-22) (not (<= t 2.4e-9))) (fabs (* ew (sin t))) (fabs (* (tanh (asinh (/ eh (* ew t)))) eh))))
double code(double eh, double ew, double t) {
double tmp;
if ((t <= -2.8e-22) || !(t <= 2.4e-9)) {
tmp = fabs((ew * sin(t)));
} else {
tmp = fabs((tanh(asinh((eh / (ew * t)))) * eh));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (t <= -2.8e-22) or not (t <= 2.4e-9): tmp = math.fabs((ew * math.sin(t))) else: tmp = math.fabs((math.tanh(math.asinh((eh / (ew * t)))) * eh)) return tmp
function code(eh, ew, t) tmp = 0.0 if ((t <= -2.8e-22) || !(t <= 2.4e-9)) tmp = abs(Float64(ew * sin(t))); else tmp = abs(Float64(tanh(asinh(Float64(eh / Float64(ew * t)))) * eh)); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((t <= -2.8e-22) || ~((t <= 2.4e-9))) tmp = abs((ew * sin(t))); else tmp = abs((tanh(asinh((eh / (ew * t)))) * eh)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -2.8e-22], N[Not[LessEqual[t, 2.4e-9]], $MachinePrecision]], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Tanh[N[ArcSinh[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-22} \lor \neg \left(t \leq 2.4 \cdot 10^{-9}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right|\\
\end{array}
\end{array}
if t < -2.79999999999999995e-22 or 2.4e-9 < t Initial program 99.6%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.6
Applied rewrites99.6%
Taylor expanded in eh around 0
unpow2N/A
cos-atanN/A
lift-sin.f64N/A
lift-*.f6447.8
Applied rewrites47.8%
if -2.79999999999999995e-22 < t < 2.4e-9Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites75.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6475.8
Applied rewrites75.8%
Final simplification63.0%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ eh (* ew t))))
(if (<= eh -1.75e+44)
(fabs (* (/ t_1 (sqrt (+ 1.0 (* t_1 t_1)))) eh))
(fabs (* ew (sin t))))))
double code(double eh, double ew, double t) {
double t_1 = eh / (ew * t);
double tmp;
if (eh <= -1.75e+44) {
tmp = fabs(((t_1 / sqrt((1.0 + (t_1 * t_1)))) * eh));
} else {
tmp = fabs((ew * sin(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) :: t_1
real(8) :: tmp
t_1 = eh / (ew * t)
if (eh <= (-1.75d+44)) then
tmp = abs(((t_1 / sqrt((1.0d0 + (t_1 * t_1)))) * eh))
else
tmp = abs((ew * sin(t)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh / (ew * t);
double tmp;
if (eh <= -1.75e+44) {
tmp = Math.abs(((t_1 / Math.sqrt((1.0 + (t_1 * t_1)))) * eh));
} else {
tmp = Math.abs((ew * Math.sin(t)));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh / (ew * t) tmp = 0 if eh <= -1.75e+44: tmp = math.fabs(((t_1 / math.sqrt((1.0 + (t_1 * t_1)))) * eh)) else: tmp = math.fabs((ew * math.sin(t))) return tmp
function code(eh, ew, t) t_1 = Float64(eh / Float64(ew * t)) tmp = 0.0 if (eh <= -1.75e+44) tmp = abs(Float64(Float64(t_1 / sqrt(Float64(1.0 + Float64(t_1 * t_1)))) * eh)); else tmp = abs(Float64(ew * sin(t))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh / (ew * t); tmp = 0.0; if (eh <= -1.75e+44) tmp = abs(((t_1 / sqrt((1.0 + (t_1 * t_1)))) * eh)); else tmp = abs((ew * sin(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -1.75e+44], N[Abs[N[(N[(t$95$1 / N[Sqrt[N[(1.0 + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot t}\\
\mathbf{if}\;eh \leq -1.75 \cdot 10^{+44}:\\
\;\;\;\;\left|\frac{t\_1}{\sqrt{1 + t\_1 \cdot t\_1}} \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\
\end{array}
\end{array}
if eh < -1.75e44Initial program 99.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites63.3%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6462.0
Applied rewrites62.0%
lift-tanh.f64N/A
lift-asinh.f64N/A
tanh-asinhN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites17.7%
if -1.75e44 < eh Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around 0
unpow2N/A
cos-atanN/A
lift-sin.f64N/A
lift-*.f6445.6
Applied rewrites45.6%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ eh (* ew t))))
(if (<= eh -6.5e+43)
(fabs (* (/ t_1 (sqrt (+ 1.0 (* t_1 t_1)))) eh))
(fabs (* ew t)))))
double code(double eh, double ew, double t) {
double t_1 = eh / (ew * t);
double tmp;
if (eh <= -6.5e+43) {
tmp = fabs(((t_1 / sqrt((1.0 + (t_1 * t_1)))) * eh));
} else {
tmp = fabs((ew * 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) :: t_1
real(8) :: tmp
t_1 = eh / (ew * t)
if (eh <= (-6.5d+43)) then
tmp = abs(((t_1 / sqrt((1.0d0 + (t_1 * t_1)))) * eh))
else
tmp = abs((ew * t))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = eh / (ew * t);
double tmp;
if (eh <= -6.5e+43) {
tmp = Math.abs(((t_1 / Math.sqrt((1.0 + (t_1 * t_1)))) * eh));
} else {
tmp = Math.abs((ew * t));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh / (ew * t) tmp = 0 if eh <= -6.5e+43: tmp = math.fabs(((t_1 / math.sqrt((1.0 + (t_1 * t_1)))) * eh)) else: tmp = math.fabs((ew * t)) return tmp
function code(eh, ew, t) t_1 = Float64(eh / Float64(ew * t)) tmp = 0.0 if (eh <= -6.5e+43) tmp = abs(Float64(Float64(t_1 / sqrt(Float64(1.0 + Float64(t_1 * t_1)))) * eh)); else tmp = abs(Float64(ew * t)); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh / (ew * t); tmp = 0.0; if (eh <= -6.5e+43) tmp = abs(((t_1 / sqrt((1.0 + (t_1 * t_1)))) * eh)); else tmp = abs((ew * t)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -6.5e+43], N[Abs[N[(N[(t$95$1 / N[Sqrt[N[(1.0 + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot t}\\
\mathbf{if}\;eh \leq -6.5 \cdot 10^{+43}:\\
\;\;\;\;\left|\frac{t\_1}{\sqrt{1 + t\_1 \cdot t\_1}} \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ew \cdot t\right|\\
\end{array}
\end{array}
if eh < -6.4999999999999998e43Initial program 99.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites63.3%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6462.0
Applied rewrites62.0%
lift-tanh.f64N/A
lift-asinh.f64N/A
tanh-asinhN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
Applied rewrites17.7%
if -6.4999999999999998e43 < eh Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around 0
unpow2N/A
cos-atanN/A
lift-sin.f64N/A
lift-*.f6445.6
Applied rewrites45.6%
Taylor expanded in t around 0
Applied rewrites23.9%
(FPCore (eh ew t) :precision binary64 (fabs (* ew t)))
double code(double eh, double ew, double t) {
return fabs((ew * t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = abs((ew * t))
end function
public static double code(double eh, double ew, double t) {
return Math.abs((ew * t));
}
def code(eh, ew, t): return math.fabs((ew * t))
function code(eh, ew, t) return abs(Float64(ew * t)) end
function tmp = code(eh, ew, t) tmp = abs((ew * t)); end
code[eh_, ew_, t_] := N[Abs[N[(ew * t), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|ew \cdot t\right|
\end{array}
Initial program 99.8%
lift-cos.f64N/A
lift-atan.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
cos-atanN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lower-pow.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f6499.8
Applied rewrites99.8%
Taylor expanded in eh around 0
unpow2N/A
cos-atanN/A
lift-sin.f64N/A
lift-*.f6437.2
Applied rewrites37.2%
Taylor expanded in t around 0
Applied rewrites19.9%
herbie shell --seed 2025072
(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))))))))