
(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 16 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 (- (cos t))) (t_2 (atan (/ (/ eh ew) (tan t)))))
(fabs
(+
(* (* ew (sin t)) (cos t_2))
(* (* eh (/ (* t_1 (cos t)) t_1)) (sin t_2))))))
double code(double eh, double ew, double t) {
double t_1 = -cos(t);
double t_2 = atan(((eh / ew) / tan(t)));
return fabs((((ew * sin(t)) * cos(t_2)) + ((eh * ((t_1 * cos(t)) / t_1)) * sin(t_2))));
}
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
t_1 = -cos(t)
t_2 = atan(((eh / ew) / tan(t)))
code = abs((((ew * sin(t)) * cos(t_2)) + ((eh * ((t_1 * cos(t)) / t_1)) * sin(t_2))))
end function
public static double code(double eh, double ew, double t) {
double t_1 = -Math.cos(t);
double t_2 = Math.atan(((eh / ew) / Math.tan(t)));
return Math.abs((((ew * Math.sin(t)) * Math.cos(t_2)) + ((eh * ((t_1 * Math.cos(t)) / t_1)) * Math.sin(t_2))));
}
def code(eh, ew, t): t_1 = -math.cos(t) t_2 = math.atan(((eh / ew) / math.tan(t))) return math.fabs((((ew * math.sin(t)) * math.cos(t_2)) + ((eh * ((t_1 * math.cos(t)) / t_1)) * math.sin(t_2))))
function code(eh, ew, t) t_1 = Float64(-cos(t)) t_2 = atan(Float64(Float64(eh / ew) / tan(t))) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(t_2)) + Float64(Float64(eh * Float64(Float64(t_1 * cos(t)) / t_1)) * sin(t_2)))) end
function tmp = code(eh, ew, t) t_1 = -cos(t); t_2 = atan(((eh / ew) / tan(t))); tmp = abs((((ew * sin(t)) * cos(t_2)) + ((eh * ((t_1 * cos(t)) / t_1)) * sin(t_2)))); end
code[eh_, ew_, t_] := Block[{t$95$1 = (-N[Cos[t], $MachinePrecision])}, Block[{t$95$2 = 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$2], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[(N[(t$95$1 * N[Cos[t], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\cos t\\
t_2 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_2 + \left(eh \cdot \frac{t\_1 \cdot \cos t}{t\_1}\right) \cdot \sin t\_2\right|
\end{array}
\end{array}
Initial program 99.8%
lift-cos.f64N/A
sin-+PI/2-revN/A
sin-sumN/A
flip-+N/A
lower-/.f64N/A
Applied rewrites99.8%
Final simplification99.8%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t)))
(t_2 (* ew (sin t)))
(t_3 (atan (/ (/ eh ew) (tan t))))
(t_4 (+ (* t_2 (cos t_3)) (* t_1 (sin t_3)))))
(if (<= t_4 -5e+254)
(fabs
(*
(sin
(atan
(*
(fma
(* t t)
(- (* 0.041666666666666664 (/ (* t t) ew)) (/ 0.5 ew))
(pow ew -1.0))
(/ (+ eh (* 0.16666666666666666 (* eh (* t t)))) t))))
eh))
(if (<= t_4 -5e-287)
(* (- (sin t)) ew)
(* t_1 (sin (atan (/ t_1 t_2))))))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double t_2 = ew * sin(t);
double t_3 = atan(((eh / ew) / tan(t)));
double t_4 = (t_2 * cos(t_3)) + (t_1 * sin(t_3));
double tmp;
if (t_4 <= -5e+254) {
tmp = fabs((sin(atan((fma((t * t), ((0.041666666666666664 * ((t * t) / ew)) - (0.5 / ew)), pow(ew, -1.0)) * ((eh + (0.16666666666666666 * (eh * (t * t)))) / t)))) * eh));
} else if (t_4 <= -5e-287) {
tmp = -sin(t) * ew;
} else {
tmp = t_1 * sin(atan((t_1 / t_2)));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) t_2 = Float64(ew * sin(t)) t_3 = atan(Float64(Float64(eh / ew) / tan(t))) t_4 = Float64(Float64(t_2 * cos(t_3)) + Float64(t_1 * sin(t_3))) tmp = 0.0 if (t_4 <= -5e+254) tmp = abs(Float64(sin(atan(Float64(fma(Float64(t * t), Float64(Float64(0.041666666666666664 * Float64(Float64(t * t) / ew)) - Float64(0.5 / ew)), (ew ^ -1.0)) * Float64(Float64(eh + Float64(0.16666666666666666 * Float64(eh * Float64(t * t)))) / t)))) * eh)); elseif (t_4 <= -5e-287) tmp = Float64(Float64(-sin(t)) * ew); else tmp = Float64(t_1 * sin(atan(Float64(t_1 / t_2)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$2 * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -5e+254], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(t * t), $MachinePrecision] * N[(N[(0.041666666666666664 * N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] - N[(0.5 / ew), $MachinePrecision]), $MachinePrecision] + N[Power[ew, -1.0], $MachinePrecision]), $MachinePrecision] * N[(N[(eh + N[(0.16666666666666666 * N[(eh * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$4, -5e-287], N[((-N[Sin[t], $MachinePrecision]) * ew), $MachinePrecision], N[(t$95$1 * N[Sin[N[ArcTan[N[(t$95$1 / t$95$2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
t_2 := ew \cdot \sin t\\
t_3 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
t_4 := t\_2 \cdot \cos t\_3 + t\_1 \cdot \sin t\_3\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{+254}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\mathsf{fma}\left(t \cdot t, 0.041666666666666664 \cdot \frac{t \cdot t}{ew} - \frac{0.5}{ew}, {ew}^{-1}\right) \cdot \frac{eh + 0.16666666666666666 \cdot \left(eh \cdot \left(t \cdot t\right)\right)}{t}\right) \cdot eh\right|\\
\mathbf{elif}\;t\_4 \leq -5 \cdot 10^{-287}:\\
\;\;\;\;\left(-\sin t\right) \cdot ew\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sin \tan^{-1} \left(\frac{t\_1}{t\_2}\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) < -4.99999999999999994e254Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6446.1
Applied rewrites46.1%
Taylor expanded in t around 0
Applied rewrites46.2%
Taylor expanded in t around 0
Applied rewrites46.2%
if -4.99999999999999994e254 < (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) < -5.00000000000000025e-287Initial program 99.8%
Applied rewrites1.3%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f642.0
Applied rewrites2.0%
Applied rewrites20.2%
Applied rewrites46.6%
if -5.00000000000000025e-287 < (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6437.6
Applied rewrites37.6%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
pow2N/A
Applied rewrites35.2%
Taylor expanded in eh around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6458.2
Applied rewrites58.2%
Final simplification52.5%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (sin t))) (t_2 (atan (/ (/ eh ew) (tan t)))))
(if (<= (+ (* t_1 (cos t_2)) (* (* eh (cos t)) (sin t_2))) -2e-216)
(* (- (sin t)) ew)
t_1)))
double code(double eh, double ew, double t) {
double t_1 = ew * sin(t);
double t_2 = atan(((eh / ew) / tan(t)));
double tmp;
if (((t_1 * cos(t_2)) + ((eh * cos(t)) * sin(t_2))) <= -2e-216) {
tmp = -sin(t) * ew;
} 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) :: t_2
real(8) :: tmp
t_1 = ew * sin(t)
t_2 = atan(((eh / ew) / tan(t)))
if (((t_1 * cos(t_2)) + ((eh * cos(t)) * sin(t_2))) <= (-2d-216)) then
tmp = -sin(t) * ew
else
tmp = t_1
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 = Math.atan(((eh / ew) / Math.tan(t)));
double tmp;
if (((t_1 * Math.cos(t_2)) + ((eh * Math.cos(t)) * Math.sin(t_2))) <= -2e-216) {
tmp = -Math.sin(t) * ew;
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.sin(t) t_2 = math.atan(((eh / ew) / math.tan(t))) tmp = 0 if ((t_1 * math.cos(t_2)) + ((eh * math.cos(t)) * math.sin(t_2))) <= -2e-216: tmp = -math.sin(t) * ew else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(ew * sin(t)) t_2 = atan(Float64(Float64(eh / ew) / tan(t))) tmp = 0.0 if (Float64(Float64(t_1 * cos(t_2)) + Float64(Float64(eh * cos(t)) * sin(t_2))) <= -2e-216) tmp = Float64(Float64(-sin(t)) * ew); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * sin(t); t_2 = atan(((eh / ew) / tan(t))); tmp = 0.0; if (((t_1 * cos(t_2)) + ((eh * cos(t)) * sin(t_2))) <= -2e-216) tmp = -sin(t) * ew; else tmp = t_1; 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[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-216], N[((-N[Sin[t], $MachinePrecision]) * ew), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
t_2 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\mathbf{if}\;t\_1 \cdot \cos t\_2 + \left(eh \cdot \cos t\right) \cdot \sin t\_2 \leq -2 \cdot 10^{-216}:\\
\;\;\;\;\left(-\sin t\right) \cdot ew\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) < -2.0000000000000001e-216Initial program 99.8%
Applied rewrites1.0%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f641.7
Applied rewrites1.7%
Applied rewrites18.9%
Applied rewrites42.9%
if -2.0000000000000001e-216 < (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) Initial program 99.8%
Applied rewrites66.1%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6444.3
Applied rewrites44.3%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (sin t))) (t_2 (atan (/ (/ eh ew) (tan t)))))
(if (<= (+ (* t_1 (cos t_2)) (* (* eh (cos t)) (sin t_2))) -2e-216)
(* ew (sin (fabs t)))
t_1)))
double code(double eh, double ew, double t) {
double t_1 = ew * sin(t);
double t_2 = atan(((eh / ew) / tan(t)));
double tmp;
if (((t_1 * cos(t_2)) + ((eh * cos(t)) * sin(t_2))) <= -2e-216) {
tmp = ew * sin(fabs(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) :: t_2
real(8) :: tmp
t_1 = ew * sin(t)
t_2 = atan(((eh / ew) / tan(t)))
if (((t_1 * cos(t_2)) + ((eh * cos(t)) * sin(t_2))) <= (-2d-216)) then
tmp = ew * sin(abs(t))
else
tmp = t_1
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 = Math.atan(((eh / ew) / Math.tan(t)));
double tmp;
if (((t_1 * Math.cos(t_2)) + ((eh * Math.cos(t)) * Math.sin(t_2))) <= -2e-216) {
tmp = ew * Math.sin(Math.abs(t));
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.sin(t) t_2 = math.atan(((eh / ew) / math.tan(t))) tmp = 0 if ((t_1 * math.cos(t_2)) + ((eh * math.cos(t)) * math.sin(t_2))) <= -2e-216: tmp = ew * math.sin(math.fabs(t)) else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(ew * sin(t)) t_2 = atan(Float64(Float64(eh / ew) / tan(t))) tmp = 0.0 if (Float64(Float64(t_1 * cos(t_2)) + Float64(Float64(eh * cos(t)) * sin(t_2))) <= -2e-216) tmp = Float64(ew * sin(abs(t))); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * sin(t); t_2 = atan(((eh / ew) / tan(t))); tmp = 0.0; if (((t_1 * cos(t_2)) + ((eh * cos(t)) * sin(t_2))) <= -2e-216) tmp = ew * sin(abs(t)); else tmp = t_1; 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[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-216], N[(ew * N[Sin[N[Abs[t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
t_2 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\mathbf{if}\;t\_1 \cdot \cos t\_2 + \left(eh \cdot \cos t\right) \cdot \sin t\_2 \leq -2 \cdot 10^{-216}:\\
\;\;\;\;ew \cdot \sin \left(\left|t\right|\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) < -2.0000000000000001e-216Initial program 99.8%
Applied rewrites1.0%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f641.7
Applied rewrites1.7%
Applied rewrites21.4%
if -2.0000000000000001e-216 < (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) Initial program 99.8%
Applied rewrites66.1%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6444.3
Applied rewrites44.3%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (sin t))) (t_2 (atan (/ (/ eh ew) (tan t)))))
(if (<= (+ (* t_1 (cos t_2)) (* (* eh (cos t)) (sin t_2))) -5e-211)
(* (fabs ew) t)
t_1)))
double code(double eh, double ew, double t) {
double t_1 = ew * sin(t);
double t_2 = atan(((eh / ew) / tan(t)));
double tmp;
if (((t_1 * cos(t_2)) + ((eh * cos(t)) * sin(t_2))) <= -5e-211) {
tmp = fabs(ew) * 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) :: t_2
real(8) :: tmp
t_1 = ew * sin(t)
t_2 = atan(((eh / ew) / tan(t)))
if (((t_1 * cos(t_2)) + ((eh * cos(t)) * sin(t_2))) <= (-5d-211)) then
tmp = abs(ew) * t
else
tmp = t_1
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 = Math.atan(((eh / ew) / Math.tan(t)));
double tmp;
if (((t_1 * Math.cos(t_2)) + ((eh * Math.cos(t)) * Math.sin(t_2))) <= -5e-211) {
tmp = Math.abs(ew) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.sin(t) t_2 = math.atan(((eh / ew) / math.tan(t))) tmp = 0 if ((t_1 * math.cos(t_2)) + ((eh * math.cos(t)) * math.sin(t_2))) <= -5e-211: tmp = math.fabs(ew) * t else: tmp = t_1 return tmp
function code(eh, ew, t) t_1 = Float64(ew * sin(t)) t_2 = atan(Float64(Float64(eh / ew) / tan(t))) tmp = 0.0 if (Float64(Float64(t_1 * cos(t_2)) + Float64(Float64(eh * cos(t)) * sin(t_2))) <= -5e-211) tmp = Float64(abs(ew) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * sin(t); t_2 = atan(((eh / ew) / tan(t))); tmp = 0.0; if (((t_1 * cos(t_2)) + ((eh * cos(t)) * sin(t_2))) <= -5e-211) tmp = abs(ew) * t; else tmp = t_1; 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[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-211], N[(N[Abs[ew], $MachinePrecision] * t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
t_2 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\mathbf{if}\;t\_1 \cdot \cos t\_2 + \left(eh \cdot \cos t\right) \cdot \sin t\_2 \leq -5 \cdot 10^{-211}:\\
\;\;\;\;\left|ew\right| \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) < -5.0000000000000002e-211Initial program 99.8%
Applied rewrites1.0%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f641.7
Applied rewrites1.7%
Taylor expanded in t around 0
Applied rewrites2.4%
Applied rewrites8.2%
if -5.0000000000000002e-211 < (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) Initial program 99.8%
Applied rewrites65.6%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6444.0
Applied rewrites44.0%
(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}
Initial program 99.8%
(FPCore (eh ew t) :precision binary64 (fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) t)))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
return fabs((((ew * sin(t)) * cos(atan(((eh / ew) / 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((((ew * sin(t)) * cos(atan(((eh / ew) / 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((((ew * Math.sin(t)) * Math.cos(Math.atan(((eh / ew) / t)))) + ((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
}
def code(eh, ew, t): return math.fabs((((ew * math.sin(t)) * math.cos(math.atan(((eh / ew) / t)))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t) return abs(Float64(Float64(Float64(ew * sin(t)) * cos(atan(Float64(Float64(eh / ew) / t)))) + Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))))) end
function tmp = code(eh, ew, t) tmp = abs((((ew * sin(t)) * cos(atan(((eh / ew) / t)))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))))); 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] / t), $MachinePrecision]], $MachinePrecision]], $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(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right) + \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%
Taylor expanded in t around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.3
Applied rewrites99.3%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (/ (/ eh (tan t)) ew)))
(if (or (<= eh -4.3e+23) (not (<= eh 3.8e+57)))
(fabs (* eh (* (cos t) (sin (atan (/ (* eh (cos t)) (* ew (sin t))))))))
(fabs (/ (fma (* (cos t) t_1) eh (* (sin t) ew)) (cosh (asinh t_1)))))))
double code(double eh, double ew, double t) {
double t_1 = (eh / tan(t)) / ew;
double tmp;
if ((eh <= -4.3e+23) || !(eh <= 3.8e+57)) {
tmp = fabs((eh * (cos(t) * sin(atan(((eh * cos(t)) / (ew * sin(t))))))));
} else {
tmp = fabs((fma((cos(t) * t_1), eh, (sin(t) * ew)) / cosh(asinh(t_1))));
}
return tmp;
}
function code(eh, ew, t) t_1 = Float64(Float64(eh / tan(t)) / ew) tmp = 0.0 if ((eh <= -4.3e+23) || !(eh <= 3.8e+57)) tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(Float64(eh * cos(t)) / Float64(ew * sin(t)))))))); else tmp = abs(Float64(fma(Float64(cos(t) * t_1), eh, Float64(sin(t) * ew)) / cosh(asinh(t_1)))); end return tmp end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, If[Or[LessEqual[eh, -4.3e+23], N[Not[LessEqual[eh, 3.8e+57]], $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[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
\mathbf{if}\;eh \leq -4.3 \cdot 10^{+23} \lor \neg \left(eh \leq 3.8 \cdot 10^{+57}\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|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_1}\right|\\
\end{array}
\end{array}
if eh < -4.2999999999999999e23 or 3.7999999999999999e57 < eh Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6452.0
Applied rewrites52.0%
Taylor expanded in t around 0
Applied rewrites52.1%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6485.1
Applied rewrites85.1%
if -4.2999999999999999e23 < eh < 3.7999999999999999e57Initial program 99.9%
Applied rewrites92.1%
Final simplification89.0%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* eh (cos t))))
(if (or (<= eh -2.3e-219) (not (<= eh 1.2e-10)))
(fabs (* eh (* (cos t) (sin (atan (/ t_1 (* ew (sin t))))))))
(fabs (* (* ew (cos (atan (/ (/ t_1 ew) (sin t))))) (sin t))))))
double code(double eh, double ew, double t) {
double t_1 = eh * cos(t);
double tmp;
if ((eh <= -2.3e-219) || !(eh <= 1.2e-10)) {
tmp = fabs((eh * (cos(t) * sin(atan((t_1 / (ew * sin(t))))))));
} else {
tmp = fabs(((ew * cos(atan(((t_1 / ew) / sin(t))))) * 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 * cos(t)
if ((eh <= (-2.3d-219)) .or. (.not. (eh <= 1.2d-10))) then
tmp = abs((eh * (cos(t) * sin(atan((t_1 / (ew * sin(t))))))))
else
tmp = abs(((ew * cos(atan(((t_1 / ew) / sin(t))))) * sin(t)))
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 <= -2.3e-219) || !(eh <= 1.2e-10)) {
tmp = Math.abs((eh * (Math.cos(t) * Math.sin(Math.atan((t_1 / (ew * Math.sin(t))))))));
} else {
tmp = Math.abs(((ew * Math.cos(Math.atan(((t_1 / ew) / Math.sin(t))))) * Math.sin(t)));
}
return tmp;
}
def code(eh, ew, t): t_1 = eh * math.cos(t) tmp = 0 if (eh <= -2.3e-219) or not (eh <= 1.2e-10): tmp = math.fabs((eh * (math.cos(t) * math.sin(math.atan((t_1 / (ew * math.sin(t)))))))) else: tmp = math.fabs(((ew * math.cos(math.atan(((t_1 / ew) / math.sin(t))))) * math.sin(t))) return tmp
function code(eh, ew, t) t_1 = Float64(eh * cos(t)) tmp = 0.0 if ((eh <= -2.3e-219) || !(eh <= 1.2e-10)) tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(t_1 / Float64(ew * sin(t)))))))); else tmp = abs(Float64(Float64(ew * cos(atan(Float64(Float64(t_1 / ew) / sin(t))))) * sin(t))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = eh * cos(t); tmp = 0.0; if ((eh <= -2.3e-219) || ~((eh <= 1.2e-10))) tmp = abs((eh * (cos(t) * sin(atan((t_1 / (ew * sin(t)))))))); else tmp = abs(((ew * cos(atan(((t_1 / ew) / sin(t))))) * sin(t))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eh, -2.3e-219], N[Not[LessEqual[eh, 1.2e-10]], $MachinePrecision]], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(t$95$1 / N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[Cos[N[ArcTan[N[(N[(t$95$1 / ew), $MachinePrecision] / N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
\mathbf{if}\;eh \leq -2.3 \cdot 10^{-219} \lor \neg \left(eh \leq 1.2 \cdot 10^{-10}\right):\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{t\_1}{ew \cdot \sin t}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(ew \cdot \cos \tan^{-1} \left(\frac{\frac{t\_1}{ew}}{\sin t}\right)\right) \cdot \sin t\right|\\
\end{array}
\end{array}
if eh < -2.29999999999999988e-219 or 1.2e-10 < eh Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6448.3
Applied rewrites48.3%
Taylor expanded in t around 0
Applied rewrites48.5%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6477.5
Applied rewrites77.5%
if -2.29999999999999988e-219 < eh < 1.2e-10Initial program 99.8%
lift-cos.f64N/A
sin-+PI/2-revN/A
sin-sumN/A
flip-+N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in eh around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-sin.f6478.7
Applied rewrites78.7%
Final simplification77.9%
(FPCore (eh ew t) :precision binary64 (if (or (<= eh -2.3e-219) (not (<= eh 1.2e-10))) (fabs (* eh (* (cos t) (sin (atan (/ (* eh (cos t)) (* ew (sin t)))))))) (fabs (* (cos (atan (* (/ (cos t) ew) (/ eh (sin t))))) (* (sin t) ew)))))
double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -2.3e-219) || !(eh <= 1.2e-10)) {
tmp = fabs((eh * (cos(t) * sin(atan(((eh * cos(t)) / (ew * sin(t))))))));
} else {
tmp = fabs((cos(atan(((cos(t) / ew) * (eh / sin(t))))) * (sin(t) * 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) :: tmp
if ((eh <= (-2.3d-219)) .or. (.not. (eh <= 1.2d-10))) then
tmp = abs((eh * (cos(t) * sin(atan(((eh * cos(t)) / (ew * sin(t))))))))
else
tmp = abs((cos(atan(((cos(t) / ew) * (eh / sin(t))))) * (sin(t) * ew)))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if ((eh <= -2.3e-219) || !(eh <= 1.2e-10)) {
tmp = Math.abs((eh * (Math.cos(t) * Math.sin(Math.atan(((eh * Math.cos(t)) / (ew * Math.sin(t))))))));
} else {
tmp = Math.abs((Math.cos(Math.atan(((Math.cos(t) / ew) * (eh / Math.sin(t))))) * (Math.sin(t) * ew)));
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if (eh <= -2.3e-219) or not (eh <= 1.2e-10): tmp = math.fabs((eh * (math.cos(t) * math.sin(math.atan(((eh * math.cos(t)) / (ew * math.sin(t)))))))) else: tmp = math.fabs((math.cos(math.atan(((math.cos(t) / ew) * (eh / math.sin(t))))) * (math.sin(t) * ew))) return tmp
function code(eh, ew, t) tmp = 0.0 if ((eh <= -2.3e-219) || !(eh <= 1.2e-10)) tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(Float64(eh * cos(t)) / Float64(ew * sin(t)))))))); else tmp = abs(Float64(cos(atan(Float64(Float64(cos(t) / ew) * Float64(eh / sin(t))))) * Float64(sin(t) * ew))); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if ((eh <= -2.3e-219) || ~((eh <= 1.2e-10))) tmp = abs((eh * (cos(t) * sin(atan(((eh * cos(t)) / (ew * sin(t)))))))); else tmp = abs((cos(atan(((cos(t) / ew) * (eh / sin(t))))) * (sin(t) * ew))); end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -2.3e-219], N[Not[LessEqual[eh, 1.2e-10]], $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[(N[Cos[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;eh \leq -2.3 \cdot 10^{-219} \lor \neg \left(eh \leq 1.2 \cdot 10^{-10}\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|\cos \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\sin t \cdot ew\right)\right|\\
\end{array}
\end{array}
if eh < -2.29999999999999988e-219 or 1.2e-10 < eh Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6448.3
Applied rewrites48.3%
Taylor expanded in t around 0
Applied rewrites48.5%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6477.5
Applied rewrites77.5%
if -2.29999999999999988e-219 < eh < 1.2e-10Initial program 99.8%
Taylor expanded in eh around 0
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6478.7
Applied rewrites78.7%
Final simplification77.9%
(FPCore (eh ew t)
:precision binary64
(let* ((t_1 (* ew (sin t))))
(if (<= ew -2.2e+140)
t_1
(if (<= ew 3.1e+163)
(fabs (* eh (* (cos t) (sin (atan (/ (* eh (cos t)) t_1))))))
(* ew (sin (fabs t)))))))
double code(double eh, double ew, double t) {
double t_1 = ew * sin(t);
double tmp;
if (ew <= -2.2e+140) {
tmp = t_1;
} else if (ew <= 3.1e+163) {
tmp = fabs((eh * (cos(t) * sin(atan(((eh * cos(t)) / t_1))))));
} else {
tmp = ew * sin(fabs(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 = ew * sin(t)
if (ew <= (-2.2d+140)) then
tmp = t_1
else if (ew <= 3.1d+163) then
tmp = abs((eh * (cos(t) * sin(atan(((eh * cos(t)) / t_1))))))
else
tmp = ew * sin(abs(t))
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double t_1 = ew * Math.sin(t);
double tmp;
if (ew <= -2.2e+140) {
tmp = t_1;
} else if (ew <= 3.1e+163) {
tmp = Math.abs((eh * (Math.cos(t) * Math.sin(Math.atan(((eh * Math.cos(t)) / t_1))))));
} else {
tmp = ew * Math.sin(Math.abs(t));
}
return tmp;
}
def code(eh, ew, t): t_1 = ew * math.sin(t) tmp = 0 if ew <= -2.2e+140: tmp = t_1 elif ew <= 3.1e+163: tmp = math.fabs((eh * (math.cos(t) * math.sin(math.atan(((eh * math.cos(t)) / t_1)))))) else: tmp = ew * math.sin(math.fabs(t)) return tmp
function code(eh, ew, t) t_1 = Float64(ew * sin(t)) tmp = 0.0 if (ew <= -2.2e+140) tmp = t_1; elseif (ew <= 3.1e+163) tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(Float64(eh * cos(t)) / t_1)))))); else tmp = Float64(ew * sin(abs(t))); end return tmp end
function tmp_2 = code(eh, ew, t) t_1 = ew * sin(t); tmp = 0.0; if (ew <= -2.2e+140) tmp = t_1; elseif (ew <= 3.1e+163) tmp = abs((eh * (cos(t) * sin(atan(((eh * cos(t)) / t_1)))))); else tmp = ew * sin(abs(t)); end tmp_2 = tmp; end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ew, -2.2e+140], t$95$1, If[LessEqual[ew, 3.1e+163], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(ew * N[Sin[N[Abs[t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
\mathbf{if}\;ew \leq -2.2 \cdot 10^{+140}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ew \leq 3.1 \cdot 10^{+163}:\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \cos t}{t\_1}\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;ew \cdot \sin \left(\left|t\right|\right)\\
\end{array}
\end{array}
if ew < -2.1999999999999998e140Initial program 99.9%
Applied rewrites55.3%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6453.2
Applied rewrites53.2%
if -2.1999999999999998e140 < ew < 3.10000000000000029e163Initial program 99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6444.3
Applied rewrites44.3%
Taylor expanded in t around 0
Applied rewrites44.5%
Taylor expanded in eh around inf
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6472.6
Applied rewrites72.6%
if 3.10000000000000029e163 < ew Initial program 99.8%
Applied rewrites41.3%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6436.4
Applied rewrites36.4%
Applied rewrites62.9%
Final simplification68.6%
(FPCore (eh ew t)
:precision binary64
(if (<= t -4.3e+229)
(* ew (sin (fabs t)))
(if (<= t -4.2e-25)
(* ew (sin t))
(if (<= t 1e-12)
(fabs
(*
(sin
(atan
(*
(fma
(* t t)
(-
(*
(* t t)
(fma
-0.001388888888888889
(/ (* t t) ew)
(/ 0.041666666666666664 ew)))
(/ 0.5 ew))
(pow ew -1.0))
(/ eh (sin t)))))
eh))
(* (- (sin t)) ew)))))
double code(double eh, double ew, double t) {
double tmp;
if (t <= -4.3e+229) {
tmp = ew * sin(fabs(t));
} else if (t <= -4.2e-25) {
tmp = ew * sin(t);
} else if (t <= 1e-12) {
tmp = fabs((sin(atan((fma((t * t), (((t * t) * fma(-0.001388888888888889, ((t * t) / ew), (0.041666666666666664 / ew))) - (0.5 / ew)), pow(ew, -1.0)) * (eh / sin(t))))) * eh));
} else {
tmp = -sin(t) * ew;
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (t <= -4.3e+229) tmp = Float64(ew * sin(abs(t))); elseif (t <= -4.2e-25) tmp = Float64(ew * sin(t)); elseif (t <= 1e-12) tmp = abs(Float64(sin(atan(Float64(fma(Float64(t * t), Float64(Float64(Float64(t * t) * fma(-0.001388888888888889, Float64(Float64(t * t) / ew), Float64(0.041666666666666664 / ew))) - Float64(0.5 / ew)), (ew ^ -1.0)) * Float64(eh / sin(t))))) * eh)); else tmp = Float64(Float64(-sin(t)) * ew); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[t, -4.3e+229], N[(ew * N[Sin[N[Abs[t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -4.2e-25], N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-12], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(t * t), $MachinePrecision] * N[(N[(N[(t * t), $MachinePrecision] * N[(-0.001388888888888889 * N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision] + N[(0.041666666666666664 / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / ew), $MachinePrecision]), $MachinePrecision] + N[Power[ew, -1.0], $MachinePrecision]), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], N[((-N[Sin[t], $MachinePrecision]) * ew), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{+229}:\\
\;\;\;\;ew \cdot \sin \left(\left|t\right|\right)\\
\mathbf{elif}\;t \leq -4.2 \cdot 10^{-25}:\\
\;\;\;\;ew \cdot \sin t\\
\mathbf{elif}\;t \leq 10^{-12}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\mathsf{fma}\left(t \cdot t, \left(t \cdot t\right) \cdot \mathsf{fma}\left(-0.001388888888888889, \frac{t \cdot t}{ew}, \frac{0.041666666666666664}{ew}\right) - \frac{0.5}{ew}, {ew}^{-1}\right) \cdot \frac{eh}{\sin t}\right) \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left(-\sin t\right) \cdot ew\\
\end{array}
\end{array}
if t < -4.29999999999999991e229Initial program 99.6%
Applied rewrites24.9%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f644.8
Applied rewrites4.8%
Applied rewrites42.9%
if -4.29999999999999991e229 < t < -4.20000000000000005e-25Initial program 99.6%
Applied rewrites57.3%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6440.3
Applied rewrites40.3%
if -4.20000000000000005e-25 < t < 9.9999999999999998e-13Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6470.6
Applied rewrites70.6%
Taylor expanded in t around 0
Applied rewrites70.6%
if 9.9999999999999998e-13 < t Initial program 99.7%
Applied rewrites29.3%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6423.2
Applied rewrites23.2%
Applied rewrites0.0%
Applied rewrites29.3%
Final simplification50.1%
(FPCore (eh ew t)
:precision binary64
(if (<= t -4.3e+229)
(* ew (sin (fabs t)))
(if (<= t -4.2e-25)
(* ew (sin t))
(if (<= t 1e-12)
(fabs
(*
(sin
(atan
(*
(fma
(* t t)
(- (* 0.041666666666666664 (/ (* t t) ew)) (/ 0.5 ew))
(pow ew -1.0))
(/
eh
(*
t
(+
1.0
(*
(* t t)
(- (* 0.008333333333333333 (* t t)) 0.16666666666666666))))))))
eh))
(* (- (sin t)) ew)))))
double code(double eh, double ew, double t) {
double tmp;
if (t <= -4.3e+229) {
tmp = ew * sin(fabs(t));
} else if (t <= -4.2e-25) {
tmp = ew * sin(t);
} else if (t <= 1e-12) {
tmp = fabs((sin(atan((fma((t * t), ((0.041666666666666664 * ((t * t) / ew)) - (0.5 / ew)), pow(ew, -1.0)) * (eh / (t * (1.0 + ((t * t) * ((0.008333333333333333 * (t * t)) - 0.16666666666666666)))))))) * eh));
} else {
tmp = -sin(t) * ew;
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (t <= -4.3e+229) tmp = Float64(ew * sin(abs(t))); elseif (t <= -4.2e-25) tmp = Float64(ew * sin(t)); elseif (t <= 1e-12) tmp = abs(Float64(sin(atan(Float64(fma(Float64(t * t), Float64(Float64(0.041666666666666664 * Float64(Float64(t * t) / ew)) - Float64(0.5 / ew)), (ew ^ -1.0)) * Float64(eh / Float64(t * Float64(1.0 + Float64(Float64(t * t) * Float64(Float64(0.008333333333333333 * Float64(t * t)) - 0.16666666666666666)))))))) * eh)); else tmp = Float64(Float64(-sin(t)) * ew); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[t, -4.3e+229], N[(ew * N[Sin[N[Abs[t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -4.2e-25], N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-12], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(t * t), $MachinePrecision] * N[(N[(0.041666666666666664 * N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] - N[(0.5 / ew), $MachinePrecision]), $MachinePrecision] + N[Power[ew, -1.0], $MachinePrecision]), $MachinePrecision] * N[(eh / N[(t * N[(1.0 + N[(N[(t * t), $MachinePrecision] * N[(N[(0.008333333333333333 * N[(t * t), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], N[((-N[Sin[t], $MachinePrecision]) * ew), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{+229}:\\
\;\;\;\;ew \cdot \sin \left(\left|t\right|\right)\\
\mathbf{elif}\;t \leq -4.2 \cdot 10^{-25}:\\
\;\;\;\;ew \cdot \sin t\\
\mathbf{elif}\;t \leq 10^{-12}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\mathsf{fma}\left(t \cdot t, 0.041666666666666664 \cdot \frac{t \cdot t}{ew} - \frac{0.5}{ew}, {ew}^{-1}\right) \cdot \frac{eh}{t \cdot \left(1 + \left(t \cdot t\right) \cdot \left(0.008333333333333333 \cdot \left(t \cdot t\right) - 0.16666666666666666\right)\right)}\right) \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left(-\sin t\right) \cdot ew\\
\end{array}
\end{array}
if t < -4.29999999999999991e229Initial program 99.6%
Applied rewrites24.9%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f644.8
Applied rewrites4.8%
Applied rewrites42.9%
if -4.29999999999999991e229 < t < -4.20000000000000005e-25Initial program 99.6%
Applied rewrites57.3%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6440.3
Applied rewrites40.3%
if -4.20000000000000005e-25 < t < 9.9999999999999998e-13Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6470.6
Applied rewrites70.6%
Taylor expanded in t around 0
Applied rewrites70.6%
Taylor expanded in t around 0
Applied rewrites70.6%
if 9.9999999999999998e-13 < t Initial program 99.7%
Applied rewrites29.3%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6423.2
Applied rewrites23.2%
Applied rewrites0.0%
Applied rewrites29.3%
Final simplification50.1%
(FPCore (eh ew t)
:precision binary64
(if (<= t -4.3e+229)
(* ew (sin (fabs t)))
(if (<= t -4.2e-25)
(* ew (sin t))
(if (<= t 1e-12)
(fabs
(*
(sin
(atan
(*
(fma
(* t t)
(- (* 0.041666666666666664 (/ (* t t) ew)) (/ 0.5 ew))
(pow ew -1.0))
(/ (+ eh (* 0.16666666666666666 (* eh (* t t)))) t))))
eh))
(* (- (sin t)) ew)))))
double code(double eh, double ew, double t) {
double tmp;
if (t <= -4.3e+229) {
tmp = ew * sin(fabs(t));
} else if (t <= -4.2e-25) {
tmp = ew * sin(t);
} else if (t <= 1e-12) {
tmp = fabs((sin(atan((fma((t * t), ((0.041666666666666664 * ((t * t) / ew)) - (0.5 / ew)), pow(ew, -1.0)) * ((eh + (0.16666666666666666 * (eh * (t * t)))) / t)))) * eh));
} else {
tmp = -sin(t) * ew;
}
return tmp;
}
function code(eh, ew, t) tmp = 0.0 if (t <= -4.3e+229) tmp = Float64(ew * sin(abs(t))); elseif (t <= -4.2e-25) tmp = Float64(ew * sin(t)); elseif (t <= 1e-12) tmp = abs(Float64(sin(atan(Float64(fma(Float64(t * t), Float64(Float64(0.041666666666666664 * Float64(Float64(t * t) / ew)) - Float64(0.5 / ew)), (ew ^ -1.0)) * Float64(Float64(eh + Float64(0.16666666666666666 * Float64(eh * Float64(t * t)))) / t)))) * eh)); else tmp = Float64(Float64(-sin(t)) * ew); end return tmp end
code[eh_, ew_, t_] := If[LessEqual[t, -4.3e+229], N[(ew * N[Sin[N[Abs[t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -4.2e-25], N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-12], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[(t * t), $MachinePrecision] * N[(N[(0.041666666666666664 * N[(N[(t * t), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] - N[(0.5 / ew), $MachinePrecision]), $MachinePrecision] + N[Power[ew, -1.0], $MachinePrecision]), $MachinePrecision] * N[(N[(eh + N[(0.16666666666666666 * N[(eh * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], N[((-N[Sin[t], $MachinePrecision]) * ew), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{+229}:\\
\;\;\;\;ew \cdot \sin \left(\left|t\right|\right)\\
\mathbf{elif}\;t \leq -4.2 \cdot 10^{-25}:\\
\;\;\;\;ew \cdot \sin t\\
\mathbf{elif}\;t \leq 10^{-12}:\\
\;\;\;\;\left|\sin \tan^{-1} \left(\mathsf{fma}\left(t \cdot t, 0.041666666666666664 \cdot \frac{t \cdot t}{ew} - \frac{0.5}{ew}, {ew}^{-1}\right) \cdot \frac{eh + 0.16666666666666666 \cdot \left(eh \cdot \left(t \cdot t\right)\right)}{t}\right) \cdot eh\right|\\
\mathbf{else}:\\
\;\;\;\;\left(-\sin t\right) \cdot ew\\
\end{array}
\end{array}
if t < -4.29999999999999991e229Initial program 99.6%
Applied rewrites24.9%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f644.8
Applied rewrites4.8%
Applied rewrites42.9%
if -4.29999999999999991e229 < t < -4.20000000000000005e-25Initial program 99.6%
Applied rewrites57.3%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6440.3
Applied rewrites40.3%
if -4.20000000000000005e-25 < t < 9.9999999999999998e-13Initial program 100.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lower-atan.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-sin.f6470.6
Applied rewrites70.6%
Taylor expanded in t around 0
Applied rewrites70.6%
Taylor expanded in t around 0
Applied rewrites70.6%
if 9.9999999999999998e-13 < t Initial program 99.7%
Applied rewrites29.3%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6423.2
Applied rewrites23.2%
Applied rewrites0.0%
Applied rewrites29.3%
Final simplification50.1%
(FPCore (eh ew t) :precision binary64 (if (<= t -1.1e-282) (* ew t) (* (fabs ew) t)))
double code(double eh, double ew, double t) {
double tmp;
if (t <= -1.1e-282) {
tmp = ew * t;
} 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) :: tmp
if (t <= (-1.1d-282)) then
tmp = ew * t
else
tmp = abs(ew) * t
end if
code = tmp
end function
public static double code(double eh, double ew, double t) {
double tmp;
if (t <= -1.1e-282) {
tmp = ew * t;
} else {
tmp = Math.abs(ew) * t;
}
return tmp;
}
def code(eh, ew, t): tmp = 0 if t <= -1.1e-282: tmp = ew * t else: tmp = math.fabs(ew) * t return tmp
function code(eh, ew, t) tmp = 0.0 if (t <= -1.1e-282) tmp = Float64(ew * t); else tmp = Float64(abs(ew) * t); end return tmp end
function tmp_2 = code(eh, ew, t) tmp = 0.0; if (t <= -1.1e-282) tmp = ew * t; else tmp = abs(ew) * t; end tmp_2 = tmp; end
code[eh_, ew_, t_] := If[LessEqual[t, -1.1e-282], N[(ew * t), $MachinePrecision], N[(N[Abs[ew], $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-282}:\\
\;\;\;\;ew \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left|ew\right| \cdot t\\
\end{array}
\end{array}
if t < -1.09999999999999991e-282Initial program 99.8%
Applied rewrites44.1%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6430.3
Applied rewrites30.3%
Taylor expanded in t around 0
Applied rewrites16.3%
if -1.09999999999999991e-282 < t Initial program 99.8%
Applied rewrites26.2%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6417.9
Applied rewrites17.9%
Taylor expanded in t around 0
Applied rewrites5.9%
Applied rewrites11.9%
(FPCore (eh ew t) :precision binary64 (* ew t))
double code(double eh, double ew, double t) {
return ew * t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(eh, ew, t)
use fmin_fmax_functions
real(8), intent (in) :: eh
real(8), intent (in) :: ew
real(8), intent (in) :: t
code = ew * t
end function
public static double code(double eh, double ew, double t) {
return ew * t;
}
def code(eh, ew, t): return ew * t
function code(eh, ew, t) return Float64(ew * t) end
function tmp = code(eh, ew, t) tmp = ew * t; end
code[eh_, ew_, t_] := N[(ew * t), $MachinePrecision]
\begin{array}{l}
\\
ew \cdot t
\end{array}
Initial program 99.8%
Applied rewrites34.8%
Taylor expanded in eh around 0
lower-*.f64N/A
lower-sin.f6423.8
Applied rewrites23.8%
Taylor expanded in t around 0
Applied rewrites10.9%
herbie shell --seed 2024351
(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))))))))