
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
(FPCore (x y z t) :precision binary64 (* x (/ (- y z) (- t z))))
double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y - z) / (t - z))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
def code(x, y, z, t): return x * ((y - z) / (t - z))
function code(x, y, z, t) return Float64(x * Float64(Float64(y - z) / Float64(t - z))) end
function tmp = code(x, y, z, t) tmp = x * ((y - z) / (t - z)); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y - z}{t - z}
\end{array}
Initial program 84.0%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6496.8
Applied rewrites96.8%
(FPCore (x y z t) :precision binary64 (if (<= y -4.6e-14) (* x (/ y (- t z))) (if (<= y 1.28e+36) (* x (/ (- z) (- t z))) (* (/ x (- t z)) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.6e-14) {
tmp = x * (y / (t - z));
} else if (y <= 1.28e+36) {
tmp = x * (-z / (t - z));
} else {
tmp = (x / (t - z)) * y;
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-4.6d-14)) then
tmp = x * (y / (t - z))
else if (y <= 1.28d+36) then
tmp = x * (-z / (t - z))
else
tmp = (x / (t - z)) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.6e-14) {
tmp = x * (y / (t - z));
} else if (y <= 1.28e+36) {
tmp = x * (-z / (t - z));
} else {
tmp = (x / (t - z)) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.6e-14: tmp = x * (y / (t - z)) elif y <= 1.28e+36: tmp = x * (-z / (t - z)) else: tmp = (x / (t - z)) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.6e-14) tmp = Float64(x * Float64(y / Float64(t - z))); elseif (y <= 1.28e+36) tmp = Float64(x * Float64(Float64(-z) / Float64(t - z))); else tmp = Float64(Float64(x / Float64(t - z)) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.6e-14) tmp = x * (y / (t - z)); elseif (y <= 1.28e+36) tmp = x * (-z / (t - z)); else tmp = (x / (t - z)) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.6e-14], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.28e+36], N[(x * N[((-z) / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{elif}\;y \leq 1.28 \cdot 10^{+36}:\\
\;\;\;\;x \cdot \frac{-z}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\end{array}
\end{array}
if y < -4.59999999999999996e-14Initial program 83.8%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6471.6
Applied rewrites71.6%
if -4.59999999999999996e-14 < y < 1.27999999999999993e36Initial program 85.1%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6496.7
Applied rewrites96.7%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6477.2
Applied rewrites77.2%
if 1.27999999999999993e36 < y Initial program 81.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6487.0
Applied rewrites87.0%
Taylor expanded in y around inf
lift-/.f64N/A
lift--.f6468.8
Applied rewrites68.8%
(FPCore (x y z t) :precision binary64 (if (<= z -4e+101) x (if (<= z 4.3e+140) (* (/ x (- t z)) y) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+101) {
tmp = x;
} else if (z <= 4.3e+140) {
tmp = (x / (t - z)) * y;
} else {
tmp = x;
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-4d+101)) then
tmp = x
else if (z <= 4.3d+140) then
tmp = (x / (t - z)) * y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+101) {
tmp = x;
} else if (z <= 4.3e+140) {
tmp = (x / (t - z)) * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4e+101: tmp = x elif z <= 4.3e+140: tmp = (x / (t - z)) * y else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4e+101) tmp = x; elseif (z <= 4.3e+140) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4e+101) tmp = x; elseif (z <= 4.3e+140) tmp = (x / (t - z)) * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4e+101], x, If[LessEqual[z, 4.3e+140], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+101}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+140}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.9999999999999999e101 or 4.30000000000000002e140 < z Initial program 66.6%
Taylor expanded in z around inf
Applied rewrites71.1%
if -3.9999999999999999e101 < z < 4.30000000000000002e140Initial program 91.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6482.6
Applied rewrites82.6%
Taylor expanded in y around inf
lift-/.f64N/A
lift--.f6465.7
Applied rewrites65.7%
(FPCore (x y z t) :precision binary64 (if (<= z -4e+101) x (if (<= z 4.3e+140) (* x (/ y (- t z))) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+101) {
tmp = x;
} else if (z <= 4.3e+140) {
tmp = x * (y / (t - z));
} else {
tmp = x;
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-4d+101)) then
tmp = x
else if (z <= 4.3d+140) then
tmp = x * (y / (t - z))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+101) {
tmp = x;
} else if (z <= 4.3e+140) {
tmp = x * (y / (t - z));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4e+101: tmp = x elif z <= 4.3e+140: tmp = x * (y / (t - z)) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4e+101) tmp = x; elseif (z <= 4.3e+140) tmp = Float64(x * Float64(y / Float64(t - z))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4e+101) tmp = x; elseif (z <= 4.3e+140) tmp = x * (y / (t - z)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4e+101], x, If[LessEqual[z, 4.3e+140], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+101}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+140}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.9999999999999999e101 or 4.30000000000000002e140 < z Initial program 66.6%
Taylor expanded in z around inf
Applied rewrites71.1%
if -3.9999999999999999e101 < z < 4.30000000000000002e140Initial program 91.6%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6467.6
Applied rewrites67.6%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.8e+85)
x
(if (<= z -2.35e+29)
(* x (/ (- y) z))
(if (<= z 4.8e+25)
(* x (/ y t))
(if (<= z 2.15e+110) (/ (* x (- z)) t) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+85) {
tmp = x;
} else if (z <= -2.35e+29) {
tmp = x * (-y / z);
} else if (z <= 4.8e+25) {
tmp = x * (y / t);
} else if (z <= 2.15e+110) {
tmp = (x * -z) / t;
} else {
tmp = x;
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.8d+85)) then
tmp = x
else if (z <= (-2.35d+29)) then
tmp = x * (-y / z)
else if (z <= 4.8d+25) then
tmp = x * (y / t)
else if (z <= 2.15d+110) then
tmp = (x * -z) / t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+85) {
tmp = x;
} else if (z <= -2.35e+29) {
tmp = x * (-y / z);
} else if (z <= 4.8e+25) {
tmp = x * (y / t);
} else if (z <= 2.15e+110) {
tmp = (x * -z) / t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e+85: tmp = x elif z <= -2.35e+29: tmp = x * (-y / z) elif z <= 4.8e+25: tmp = x * (y / t) elif z <= 2.15e+110: tmp = (x * -z) / t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e+85) tmp = x; elseif (z <= -2.35e+29) tmp = Float64(x * Float64(Float64(-y) / z)); elseif (z <= 4.8e+25) tmp = Float64(x * Float64(y / t)); elseif (z <= 2.15e+110) tmp = Float64(Float64(x * Float64(-z)) / t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.8e+85) tmp = x; elseif (z <= -2.35e+29) tmp = x * (-y / z); elseif (z <= 4.8e+25) tmp = x * (y / t); elseif (z <= 2.15e+110) tmp = (x * -z) / t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e+85], x, If[LessEqual[z, -2.35e+29], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e+25], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.15e+110], N[(N[(x * (-z)), $MachinePrecision] / t), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+85}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -2.35 \cdot 10^{+29}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+25}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+110}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.7999999999999999e85 or 2.15000000000000003e110 < z Initial program 68.1%
Taylor expanded in z around inf
Applied rewrites68.0%
if -2.7999999999999999e85 < z < -2.3500000000000001e29Initial program 87.8%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6448.6
Applied rewrites48.6%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6430.8
Applied rewrites30.8%
if -2.3500000000000001e29 < z < 4.79999999999999992e25Initial program 93.5%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6494.1
Applied rewrites94.1%
Taylor expanded in z around 0
lower-/.f6462.1
Applied rewrites62.1%
if 4.79999999999999992e25 < z < 2.15000000000000003e110Initial program 86.5%
Taylor expanded in z around 0
Applied rewrites35.3%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6428.1
Applied rewrites28.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.8e+85)
x
(if (<= z -2.35e+29)
(* x (/ (- y) z))
(if (<= z 1.12e+27)
(* x (/ y t))
(if (<= z 2.15e+110) (* x (/ (- z) t)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+85) {
tmp = x;
} else if (z <= -2.35e+29) {
tmp = x * (-y / z);
} else if (z <= 1.12e+27) {
tmp = x * (y / t);
} else if (z <= 2.15e+110) {
tmp = x * (-z / t);
} else {
tmp = x;
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.8d+85)) then
tmp = x
else if (z <= (-2.35d+29)) then
tmp = x * (-y / z)
else if (z <= 1.12d+27) then
tmp = x * (y / t)
else if (z <= 2.15d+110) then
tmp = x * (-z / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+85) {
tmp = x;
} else if (z <= -2.35e+29) {
tmp = x * (-y / z);
} else if (z <= 1.12e+27) {
tmp = x * (y / t);
} else if (z <= 2.15e+110) {
tmp = x * (-z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e+85: tmp = x elif z <= -2.35e+29: tmp = x * (-y / z) elif z <= 1.12e+27: tmp = x * (y / t) elif z <= 2.15e+110: tmp = x * (-z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e+85) tmp = x; elseif (z <= -2.35e+29) tmp = Float64(x * Float64(Float64(-y) / z)); elseif (z <= 1.12e+27) tmp = Float64(x * Float64(y / t)); elseif (z <= 2.15e+110) tmp = Float64(x * Float64(Float64(-z) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.8e+85) tmp = x; elseif (z <= -2.35e+29) tmp = x * (-y / z); elseif (z <= 1.12e+27) tmp = x * (y / t); elseif (z <= 2.15e+110) tmp = x * (-z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e+85], x, If[LessEqual[z, -2.35e+29], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e+27], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.15e+110], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+85}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -2.35 \cdot 10^{+29}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+27}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+110}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.7999999999999999e85 or 2.15000000000000003e110 < z Initial program 68.1%
Taylor expanded in z around inf
Applied rewrites68.0%
if -2.7999999999999999e85 < z < -2.3500000000000001e29Initial program 87.8%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6448.6
Applied rewrites48.6%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6430.8
Applied rewrites30.8%
if -2.3500000000000001e29 < z < 1.12e27Initial program 93.5%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6494.1
Applied rewrites94.1%
Taylor expanded in z around 0
lower-/.f6462.0
Applied rewrites62.0%
if 1.12e27 < z < 2.15000000000000003e110Initial program 86.5%
Taylor expanded in z around 0
Applied rewrites35.5%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6428.0
Applied rewrites28.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6430.1
Applied rewrites30.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.8e+85)
x
(if (<= z -2.35e+29)
(* x (/ (- y) z))
(if (<= z 7.8e+99) (* x (/ y t)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+85) {
tmp = x;
} else if (z <= -2.35e+29) {
tmp = x * (-y / z);
} else if (z <= 7.8e+99) {
tmp = x * (y / t);
} else {
tmp = x;
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.8d+85)) then
tmp = x
else if (z <= (-2.35d+29)) then
tmp = x * (-y / z)
else if (z <= 7.8d+99) then
tmp = x * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e+85) {
tmp = x;
} else if (z <= -2.35e+29) {
tmp = x * (-y / z);
} else if (z <= 7.8e+99) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.8e+85: tmp = x elif z <= -2.35e+29: tmp = x * (-y / z) elif z <= 7.8e+99: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e+85) tmp = x; elseif (z <= -2.35e+29) tmp = Float64(x * Float64(Float64(-y) / z)); elseif (z <= 7.8e+99) tmp = Float64(x * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.8e+85) tmp = x; elseif (z <= -2.35e+29) tmp = x * (-y / z); elseif (z <= 7.8e+99) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.8e+85], x, If[LessEqual[z, -2.35e+29], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.8e+99], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+85}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -2.35 \cdot 10^{+29}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+99}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.7999999999999999e85 or 7.79999999999999989e99 < z Initial program 68.5%
Taylor expanded in z around inf
Applied rewrites67.5%
if -2.7999999999999999e85 < z < -2.3500000000000001e29Initial program 87.8%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6448.6
Applied rewrites48.6%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6430.8
Applied rewrites30.8%
if -2.3500000000000001e29 < z < 7.79999999999999989e99Initial program 92.8%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6494.7
Applied rewrites94.7%
Taylor expanded in z around 0
lower-/.f6457.8
Applied rewrites57.8%
(FPCore (x y z t) :precision binary64 (if (<= z -5e+47) x (if (<= z 7.8e+99) (* x (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5e+47) {
tmp = x;
} else if (z <= 7.8e+99) {
tmp = x * (y / t);
} else {
tmp = x;
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-5d+47)) then
tmp = x
else if (z <= 7.8d+99) then
tmp = x * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5e+47) {
tmp = x;
} else if (z <= 7.8e+99) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5e+47: tmp = x elif z <= 7.8e+99: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5e+47) tmp = x; elseif (z <= 7.8e+99) tmp = Float64(x * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5e+47) tmp = x; elseif (z <= 7.8e+99) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5e+47], x, If[LessEqual[z, 7.8e+99], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+47}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+99}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.00000000000000022e47 or 7.79999999999999989e99 < z Initial program 70.2%
Taylor expanded in z around inf
Applied rewrites64.9%
if -5.00000000000000022e47 < z < 7.79999999999999989e99Initial program 92.6%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6494.9
Applied rewrites94.9%
Taylor expanded in z around 0
lower-/.f6457.3
Applied rewrites57.3%
(FPCore (x y z t) :precision binary64 (if (<= z -5e+47) x (if (<= z 7.8e+99) (* (/ x t) y) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5e+47) {
tmp = x;
} else if (z <= 7.8e+99) {
tmp = (x / t) * y;
} else {
tmp = x;
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-5d+47)) then
tmp = x
else if (z <= 7.8d+99) then
tmp = (x / t) * y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5e+47) {
tmp = x;
} else if (z <= 7.8e+99) {
tmp = (x / t) * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5e+47: tmp = x elif z <= 7.8e+99: tmp = (x / t) * y else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5e+47) tmp = x; elseif (z <= 7.8e+99) tmp = Float64(Float64(x / t) * y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5e+47) tmp = x; elseif (z <= 7.8e+99) tmp = (x / t) * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5e+47], x, If[LessEqual[z, 7.8e+99], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+47}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+99}:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.00000000000000022e47 or 7.79999999999999989e99 < z Initial program 70.2%
Taylor expanded in z around inf
Applied rewrites64.9%
if -5.00000000000000022e47 < z < 7.79999999999999989e99Initial program 92.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6482.8
Applied rewrites82.8%
Taylor expanded in z around 0
lower-/.f6455.2
Applied rewrites55.2%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 84.0%
Taylor expanded in z around inf
Applied rewrites34.5%
herbie shell --seed 2025101
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
(/ (* x (- y z)) (- t z)))