
(FPCore (x y z t a b) :precision binary64 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
def code(x, y, z, t, a, b): return ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\end{array}
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
def code(x, y, z, t, a, b): return ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y)))
(t_2 (+ (/ (* (/ y (- b y)) (- x t_1)) z) t_1)))
(if (<= z -29000000.0)
t_2
(if (<= z 6.7e-19) (/ (fma y x (* (- t a) z)) (+ y (* z (- b y)))) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double t_2 = (((y / (b - y)) * (x - t_1)) / z) + t_1;
double tmp;
if (z <= -29000000.0) {
tmp = t_2;
} else if (z <= 6.7e-19) {
tmp = fma(y, x, ((t - a) * z)) / (y + (z * (b - y)));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) t_2 = Float64(Float64(Float64(Float64(y / Float64(b - y)) * Float64(x - t_1)) / z) + t_1) tmp = 0.0 if (z <= -29000000.0) tmp = t_2; elseif (z <= 6.7e-19) tmp = Float64(fma(y, x, Float64(Float64(t - a) * z)) / Float64(y + Float64(z * Float64(b - y)))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(y / N[(b - y), $MachinePrecision]), $MachinePrecision] * N[(x - t$95$1), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[z, -29000000.0], t$95$2, If[LessEqual[z, 6.7e-19], N[(N[(y * x + N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
t_2 := \frac{\frac{y}{b - y} \cdot \left(x - t\_1\right)}{z} + t\_1\\
\mathbf{if}\;z \leq -29000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 6.7 \cdot 10^{-19}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{y + z \cdot \left(b - y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -2.9e7 or 6.69999999999999998e-19 < z Initial program 46.5%
Taylor expanded in z around inf
Applied rewrites94.3%
if -2.9e7 < z < 6.69999999999999998e-19Initial program 87.2%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6487.2
Applied rewrites87.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -9.2e+45)
t_1
(if (<= z 1.32e+37)
(/ (fma y x (* (- t a) z)) (+ y (* z (- b y))))
(+ (/ (- x) z) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -9.2e+45) {
tmp = t_1;
} else if (z <= 1.32e+37) {
tmp = fma(y, x, ((t - a) * z)) / (y + (z * (b - y)));
} else {
tmp = (-x / z) + t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -9.2e+45) tmp = t_1; elseif (z <= 1.32e+37) tmp = Float64(fma(y, x, Float64(Float64(t - a) * z)) / Float64(y + Float64(z * Float64(b - y)))); else tmp = Float64(Float64(Float64(-x) / z) + t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.2e+45], t$95$1, If[LessEqual[z, 1.32e+37], N[(N[(y * x + N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / z), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.32 \cdot 10^{+37}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{y + z \cdot \left(b - y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z} + t\_1\\
\end{array}
\end{array}
if z < -9.20000000000000049e45Initial program 39.2%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6484.0
Applied rewrites84.0%
if -9.20000000000000049e45 < z < 1.3199999999999999e37Initial program 86.4%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6486.4
Applied rewrites86.4%
if 1.3199999999999999e37 < z Initial program 41.2%
Taylor expanded in z around inf
Applied rewrites98.0%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6487.1
Applied rewrites87.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- b y) z y)) (t_2 (/ (- t a) (- b y))))
(if (<= z -7e+45)
t_2
(if (<= z 2.6e-146)
(/ (- (* y x) (* a z)) t_1)
(if (<= z 2.8e+40) (* (/ z t_1) (- t a)) (+ (/ (- x) z) t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((b - y), z, y);
double t_2 = (t - a) / (b - y);
double tmp;
if (z <= -7e+45) {
tmp = t_2;
} else if (z <= 2.6e-146) {
tmp = ((y * x) - (a * z)) / t_1;
} else if (z <= 2.8e+40) {
tmp = (z / t_1) * (t - a);
} else {
tmp = (-x / z) + t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(b - y), z, y) t_2 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -7e+45) tmp = t_2; elseif (z <= 2.6e-146) tmp = Float64(Float64(Float64(y * x) - Float64(a * z)) / t_1); elseif (z <= 2.8e+40) tmp = Float64(Float64(z / t_1) * Float64(t - a)); else tmp = Float64(Float64(Float64(-x) / z) + t_2); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e+45], t$95$2, If[LessEqual[z, 2.6e-146], N[(N[(N[(y * x), $MachinePrecision] - N[(a * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[z, 2.8e+40], N[(N[(z / t$95$1), $MachinePrecision] * N[(t - a), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / z), $MachinePrecision] + t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b - y, z, y\right)\\
t_2 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -7 \cdot 10^{+45}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-146}:\\
\;\;\;\;\frac{y \cdot x - a \cdot z}{t\_1}\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+40}:\\
\;\;\;\;\frac{z}{t\_1} \cdot \left(t - a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z} + t\_2\\
\end{array}
\end{array}
if z < -7.00000000000000046e45Initial program 39.2%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6484.0
Applied rewrites84.0%
if -7.00000000000000046e45 < z < 2.59999999999999987e-146Initial program 86.0%
Taylor expanded in t around 0
lower-/.f64N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6465.5
Applied rewrites65.5%
if 2.59999999999999987e-146 < z < 2.8000000000000001e40Initial program 87.2%
Taylor expanded in x around 0
distribute-rgt-out--N/A
fp-cancel-sub-signN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
div-add-revN/A
associate-*r/N/A
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
associate-/l*N/A
distribute-rgt-outN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites56.5%
if 2.8000000000000001e40 < z Initial program 40.9%
Taylor expanded in z around inf
Applied rewrites97.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6487.3
Applied rewrites87.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -3e+26)
t_1
(if (<= z -4.1e-141)
(/ (fma (- t a) z (* y x)) (* b z))
(if (<= z 6.6e-142)
(/ (+ (* x y) (* z (- t a))) y)
(if (<= z 2.8e+40)
(* (/ z (fma (- b y) z y)) (- t a))
(+ (/ (- x) z) t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -3e+26) {
tmp = t_1;
} else if (z <= -4.1e-141) {
tmp = fma((t - a), z, (y * x)) / (b * z);
} else if (z <= 6.6e-142) {
tmp = ((x * y) + (z * (t - a))) / y;
} else if (z <= 2.8e+40) {
tmp = (z / fma((b - y), z, y)) * (t - a);
} else {
tmp = (-x / z) + t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -3e+26) tmp = t_1; elseif (z <= -4.1e-141) tmp = Float64(fma(Float64(t - a), z, Float64(y * x)) / Float64(b * z)); elseif (z <= 6.6e-142) tmp = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / y); elseif (z <= 2.8e+40) tmp = Float64(Float64(z / fma(Float64(b - y), z, y)) * Float64(t - a)); else tmp = Float64(Float64(Float64(-x) / z) + t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3e+26], t$95$1, If[LessEqual[z, -4.1e-141], N[(N[(N[(t - a), $MachinePrecision] * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(b * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.6e-142], N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[z, 2.8e+40], N[(N[(z / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] * N[(t - a), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / z), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -3 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{-141}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t - a, z, y \cdot x\right)}{b \cdot z}\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-142}:\\
\;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y}\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+40}:\\
\;\;\;\;\frac{z}{\mathsf{fma}\left(b - y, z, y\right)} \cdot \left(t - a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z} + t\_1\\
\end{array}
\end{array}
if z < -2.99999999999999997e26Initial program 41.1%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6482.6
Applied rewrites82.6%
if -2.99999999999999997e26 < z < -4.10000000000000002e-141Initial program 85.7%
Taylor expanded in b around inf
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
if -4.10000000000000002e-141 < z < 6.5999999999999994e-142Initial program 87.1%
Taylor expanded in z around 0
Applied rewrites68.2%
if 6.5999999999999994e-142 < z < 2.8000000000000001e40Initial program 87.2%
Taylor expanded in x around 0
distribute-rgt-out--N/A
fp-cancel-sub-signN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
div-add-revN/A
associate-*r/N/A
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
associate-/l*N/A
distribute-rgt-outN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites56.7%
if 2.8000000000000001e40 < z Initial program 40.9%
Taylor expanded in z around inf
Applied rewrites97.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6487.3
Applied rewrites87.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -3.3e+26)
t_1
(if (<= z -4.1e-141)
(/ (fma x (/ y z) (- t a)) b)
(if (<= z 6.6e-142)
(/ (+ (* x y) (* z (- t a))) y)
(if (<= z 2.8e+40)
(* (/ z (fma (- b y) z y)) (- t a))
(+ (/ (- x) z) t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -3.3e+26) {
tmp = t_1;
} else if (z <= -4.1e-141) {
tmp = fma(x, (y / z), (t - a)) / b;
} else if (z <= 6.6e-142) {
tmp = ((x * y) + (z * (t - a))) / y;
} else if (z <= 2.8e+40) {
tmp = (z / fma((b - y), z, y)) * (t - a);
} else {
tmp = (-x / z) + t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -3.3e+26) tmp = t_1; elseif (z <= -4.1e-141) tmp = Float64(fma(x, Float64(y / z), Float64(t - a)) / b); elseif (z <= 6.6e-142) tmp = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / y); elseif (z <= 2.8e+40) tmp = Float64(Float64(z / fma(Float64(b - y), z, y)) * Float64(t - a)); else tmp = Float64(Float64(Float64(-x) / z) + t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+26], t$95$1, If[LessEqual[z, -4.1e-141], N[(N[(x * N[(y / z), $MachinePrecision] + N[(t - a), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[z, 6.6e-142], N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[z, 2.8e+40], N[(N[(z / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] * N[(t - a), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / z), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{-141}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{y}{z}, t - a\right)}{b}\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-142}:\\
\;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y}\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+40}:\\
\;\;\;\;\frac{z}{\mathsf{fma}\left(b - y, z, y\right)} \cdot \left(t - a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z} + t\_1\\
\end{array}
\end{array}
if z < -3.29999999999999993e26Initial program 41.1%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6482.6
Applied rewrites82.6%
if -3.29999999999999993e26 < z < -4.10000000000000002e-141Initial program 85.7%
Taylor expanded in z around inf
Applied rewrites47.6%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f647.5
Applied rewrites7.5%
Taylor expanded in b around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6441.8
Applied rewrites41.8%
if -4.10000000000000002e-141 < z < 6.5999999999999994e-142Initial program 87.1%
Taylor expanded in z around 0
Applied rewrites68.2%
if 6.5999999999999994e-142 < z < 2.8000000000000001e40Initial program 87.2%
Taylor expanded in x around 0
distribute-rgt-out--N/A
fp-cancel-sub-signN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
div-add-revN/A
associate-*r/N/A
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
associate-/l*N/A
distribute-rgt-outN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites56.7%
if 2.8000000000000001e40 < z Initial program 40.9%
Taylor expanded in z around inf
Applied rewrites97.9%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6487.3
Applied rewrites87.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -3.3e+26)
t_1
(if (<= z -4.1e-141)
(/ (fma x (/ y z) (- t a)) b)
(if (<= z 6.6e-142)
(/ (+ (* x y) (* z (- t a))) y)
(if (<= z 1.15)
(* (/ z (fma b z y)) (- t a))
(+ (/ (- x) z) t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -3.3e+26) {
tmp = t_1;
} else if (z <= -4.1e-141) {
tmp = fma(x, (y / z), (t - a)) / b;
} else if (z <= 6.6e-142) {
tmp = ((x * y) + (z * (t - a))) / y;
} else if (z <= 1.15) {
tmp = (z / fma(b, z, y)) * (t - a);
} else {
tmp = (-x / z) + t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -3.3e+26) tmp = t_1; elseif (z <= -4.1e-141) tmp = Float64(fma(x, Float64(y / z), Float64(t - a)) / b); elseif (z <= 6.6e-142) tmp = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / y); elseif (z <= 1.15) tmp = Float64(Float64(z / fma(b, z, y)) * Float64(t - a)); else tmp = Float64(Float64(Float64(-x) / z) + t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+26], t$95$1, If[LessEqual[z, -4.1e-141], N[(N[(x * N[(y / z), $MachinePrecision] + N[(t - a), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[z, 6.6e-142], N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[z, 1.15], N[(N[(z / N[(b * z + y), $MachinePrecision]), $MachinePrecision] * N[(t - a), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / z), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{-141}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{y}{z}, t - a\right)}{b}\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-142}:\\
\;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y}\\
\mathbf{elif}\;z \leq 1.15:\\
\;\;\;\;\frac{z}{\mathsf{fma}\left(b, z, y\right)} \cdot \left(t - a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z} + t\_1\\
\end{array}
\end{array}
if z < -3.29999999999999993e26Initial program 41.1%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6482.6
Applied rewrites82.6%
if -3.29999999999999993e26 < z < -4.10000000000000002e-141Initial program 85.7%
Taylor expanded in z around inf
Applied rewrites47.6%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f647.5
Applied rewrites7.5%
Taylor expanded in b around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6441.8
Applied rewrites41.8%
if -4.10000000000000002e-141 < z < 6.5999999999999994e-142Initial program 87.1%
Taylor expanded in z around 0
Applied rewrites68.2%
if 6.5999999999999994e-142 < z < 1.1499999999999999Initial program 88.9%
Taylor expanded in x around 0
distribute-rgt-out--N/A
fp-cancel-sub-signN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
div-add-revN/A
associate-*r/N/A
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
associate-/l*N/A
distribute-rgt-outN/A
+-commutativeN/A
mul-1-negN/A
Applied rewrites54.4%
Taylor expanded in y around 0
Applied rewrites53.3%
if 1.1499999999999999 < z Initial program 46.4%
Taylor expanded in z around inf
Applied rewrites97.0%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6484.8
Applied rewrites84.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -3.3e+26)
t_1
(if (<= z -4.1e-141)
(/ (fma x (/ y z) (- t a)) b)
(if (<= z 4.4e-50) (/ (+ (* x y) (* z (- t a))) y) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -3.3e+26) {
tmp = t_1;
} else if (z <= -4.1e-141) {
tmp = fma(x, (y / z), (t - a)) / b;
} else if (z <= 4.4e-50) {
tmp = ((x * y) + (z * (t - a))) / y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -3.3e+26) tmp = t_1; elseif (z <= -4.1e-141) tmp = Float64(fma(x, Float64(y / z), Float64(t - a)) / b); elseif (z <= 4.4e-50) tmp = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+26], t$95$1, If[LessEqual[z, -4.1e-141], N[(N[(x * N[(y / z), $MachinePrecision] + N[(t - a), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[z, 4.4e-50], N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{-141}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{y}{z}, t - a\right)}{b}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{-50}:\\
\;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.29999999999999993e26 or 4.3999999999999998e-50 < z Initial program 47.3%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6477.6
Applied rewrites77.6%
if -3.29999999999999993e26 < z < -4.10000000000000002e-141Initial program 85.7%
Taylor expanded in z around inf
Applied rewrites47.6%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f647.5
Applied rewrites7.5%
Taylor expanded in b around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6441.8
Applied rewrites41.8%
if -4.10000000000000002e-141 < z < 4.3999999999999998e-50Initial program 87.2%
Taylor expanded in z around 0
Applied rewrites65.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -3.3e+26)
t_1
(if (<= z -4.1e-141)
(/ (fma x (/ y z) (- t a)) b)
(if (<= z 5.6e-50) (fma (/ t y) z x) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -3.3e+26) {
tmp = t_1;
} else if (z <= -4.1e-141) {
tmp = fma(x, (y / z), (t - a)) / b;
} else if (z <= 5.6e-50) {
tmp = fma((t / y), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -3.3e+26) tmp = t_1; elseif (z <= -4.1e-141) tmp = Float64(fma(x, Float64(y / z), Float64(t - a)) / b); elseif (z <= 5.6e-50) tmp = fma(Float64(t / y), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+26], t$95$1, If[LessEqual[z, -4.1e-141], N[(N[(x * N[(y / z), $MachinePrecision] + N[(t - a), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[z, 5.6e-50], N[(N[(t / y), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{-141}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{y}{z}, t - a\right)}{b}\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.29999999999999993e26 or 5.5999999999999996e-50 < z Initial program 47.3%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6477.6
Applied rewrites77.6%
if -3.29999999999999993e26 < z < -4.10000000000000002e-141Initial program 85.7%
Taylor expanded in z around inf
Applied rewrites47.6%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f647.5
Applied rewrites7.5%
Taylor expanded in b around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6441.8
Applied rewrites41.8%
if -4.10000000000000002e-141 < z < 5.5999999999999996e-50Initial program 87.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
div-add-revN/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6452.4
Applied rewrites52.4%
Taylor expanded in t around inf
Applied rewrites60.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -7.8e-35) t_1 (if (<= z 5.6e-50) (fma (/ t y) z x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -7.8e-35) {
tmp = t_1;
} else if (z <= 5.6e-50) {
tmp = fma((t / y), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -7.8e-35) tmp = t_1; elseif (z <= 5.6e-50) tmp = fma(Float64(t / y), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.8e-35], t$95$1, If[LessEqual[z, 5.6e-50], N[(N[(t / y), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.79999999999999961e-35 or 5.5999999999999996e-50 < z Initial program 50.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6475.1
Applied rewrites75.1%
if -7.79999999999999961e-35 < z < 5.5999999999999996e-50Initial program 87.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
div-add-revN/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6451.9
Applied rewrites51.9%
Taylor expanded in t around inf
Applied rewrites58.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ x (- 1.0 z))))
(if (<= y -6.5e+145)
t_1
(if (<= y 2.2e+84)
(/ (- t a) b)
(if (<= y 2.3e+127) (/ (- t a) (- y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 - z);
double tmp;
if (y <= -6.5e+145) {
tmp = t_1;
} else if (y <= 2.2e+84) {
tmp = (t - a) / b;
} else if (y <= 2.3e+127) {
tmp = (t - a) / -y;
} 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(x, y, z, t, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x / (1.0d0 - z)
if (y <= (-6.5d+145)) then
tmp = t_1
else if (y <= 2.2d+84) then
tmp = (t - a) / b
else if (y <= 2.3d+127) then
tmp = (t - a) / -y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 - z);
double tmp;
if (y <= -6.5e+145) {
tmp = t_1;
} else if (y <= 2.2e+84) {
tmp = (t - a) / b;
} else if (y <= 2.3e+127) {
tmp = (t - a) / -y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x / (1.0 - z) tmp = 0 if y <= -6.5e+145: tmp = t_1 elif y <= 2.2e+84: tmp = (t - a) / b elif y <= 2.3e+127: tmp = (t - a) / -y else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(1.0 - z)) tmp = 0.0 if (y <= -6.5e+145) tmp = t_1; elseif (y <= 2.2e+84) tmp = Float64(Float64(t - a) / b); elseif (y <= 2.3e+127) tmp = Float64(Float64(t - a) / Float64(-y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x / (1.0 - z); tmp = 0.0; if (y <= -6.5e+145) tmp = t_1; elseif (y <= 2.2e+84) tmp = (t - a) / b; elseif (y <= 2.3e+127) tmp = (t - a) / -y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+145], t$95$1, If[LessEqual[y, 2.2e+84], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[y, 2.3e+127], N[(N[(t - a), $MachinePrecision] / (-y)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{1 - z}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+145}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+84}:\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+127}:\\
\;\;\;\;\frac{t - a}{-y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.50000000000000034e145 or 2.3000000000000002e127 < y Initial program 43.0%
Taylor expanded in y around inf
lower-/.f64N/A
metadata-evalN/A
cancel-sign-sub-invN/A
*-lft-identityN/A
lower--.f6464.1
Applied rewrites64.1%
if -6.50000000000000034e145 < y < 2.1999999999999998e84Initial program 76.7%
Taylor expanded in y around 0
lower-/.f64N/A
lift--.f6447.6
Applied rewrites47.6%
if 2.1999999999999998e84 < y < 2.3000000000000002e127Initial program 59.5%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6440.5
Applied rewrites40.5%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6426.3
Applied rewrites26.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ x (- 1.0 z))))
(if (<= y -6.5e+145)
t_1
(if (<= y 4.1e+67)
(/ (- t a) b)
(if (<= y 1.6e+127) (/ t (- b y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 - z);
double tmp;
if (y <= -6.5e+145) {
tmp = t_1;
} else if (y <= 4.1e+67) {
tmp = (t - a) / b;
} else if (y <= 1.6e+127) {
tmp = t / (b - y);
} 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(x, y, z, t, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x / (1.0d0 - z)
if (y <= (-6.5d+145)) then
tmp = t_1
else if (y <= 4.1d+67) then
tmp = (t - a) / b
else if (y <= 1.6d+127) then
tmp = t / (b - y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 - z);
double tmp;
if (y <= -6.5e+145) {
tmp = t_1;
} else if (y <= 4.1e+67) {
tmp = (t - a) / b;
} else if (y <= 1.6e+127) {
tmp = t / (b - y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x / (1.0 - z) tmp = 0 if y <= -6.5e+145: tmp = t_1 elif y <= 4.1e+67: tmp = (t - a) / b elif y <= 1.6e+127: tmp = t / (b - y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(1.0 - z)) tmp = 0.0 if (y <= -6.5e+145) tmp = t_1; elseif (y <= 4.1e+67) tmp = Float64(Float64(t - a) / b); elseif (y <= 1.6e+127) tmp = Float64(t / Float64(b - y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x / (1.0 - z); tmp = 0.0; if (y <= -6.5e+145) tmp = t_1; elseif (y <= 4.1e+67) tmp = (t - a) / b; elseif (y <= 1.6e+127) tmp = t / (b - y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+145], t$95$1, If[LessEqual[y, 4.1e+67], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[y, 1.6e+127], N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{1 - z}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+145}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+67}:\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+127}:\\
\;\;\;\;\frac{t}{b - y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.50000000000000034e145 or 1.59999999999999988e127 < y Initial program 43.0%
Taylor expanded in y around inf
lower-/.f64N/A
metadata-evalN/A
cancel-sign-sub-invN/A
*-lft-identityN/A
lower--.f6464.1
Applied rewrites64.1%
if -6.50000000000000034e145 < y < 4.09999999999999979e67Initial program 77.1%
Taylor expanded in y around 0
lower-/.f64N/A
lift--.f6448.2
Applied rewrites48.2%
if 4.09999999999999979e67 < y < 1.59999999999999988e127Initial program 58.4%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6441.5
Applied rewrites41.5%
Taylor expanded in t around inf
Applied rewrites25.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ t (- b y)))) (if (<= z -7.5e+45) t_1 (if (<= z 5.6e-50) (/ x (- 1.0 z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t / (b - y);
double tmp;
if (z <= -7.5e+45) {
tmp = t_1;
} else if (z <= 5.6e-50) {
tmp = x / (1.0 - z);
} 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(x, y, z, t, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = t / (b - y)
if (z <= (-7.5d+45)) then
tmp = t_1
else if (z <= 5.6d-50) then
tmp = x / (1.0d0 - z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t / (b - y);
double tmp;
if (z <= -7.5e+45) {
tmp = t_1;
} else if (z <= 5.6e-50) {
tmp = x / (1.0 - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = t / (b - y) tmp = 0 if z <= -7.5e+45: tmp = t_1 elif z <= 5.6e-50: tmp = x / (1.0 - z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(t / Float64(b - y)) tmp = 0.0 if (z <= -7.5e+45) tmp = t_1; elseif (z <= 5.6e-50) tmp = Float64(x / Float64(1.0 - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = t / (b - y); tmp = 0.0; if (z <= -7.5e+45) tmp = t_1; elseif (z <= 5.6e-50) tmp = x / (1.0 - z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.5e+45], t$95$1, If[LessEqual[z, 5.6e-50], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{b - y}\\
\mathbf{if}\;z \leq -7.5 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-50}:\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.50000000000000058e45 or 5.5999999999999996e-50 < z Initial program 46.7%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6478.1
Applied rewrites78.1%
Taylor expanded in t around inf
Applied rewrites43.1%
if -7.50000000000000058e45 < z < 5.5999999999999996e-50Initial program 86.3%
Taylor expanded in y around inf
lower-/.f64N/A
metadata-evalN/A
cancel-sign-sub-invN/A
*-lft-identityN/A
lower--.f6447.2
Applied rewrites47.2%
(FPCore (x y z t a b) :precision binary64 (if (<= a 5.4e+52) (/ x (- 1.0 z)) (/ (- a) (- y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= 5.4e+52) {
tmp = x / (1.0 - z);
} else {
tmp = -a / -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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= 5.4d+52) then
tmp = x / (1.0d0 - z)
else
tmp = -a / -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= 5.4e+52) {
tmp = x / (1.0 - z);
} else {
tmp = -a / -y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= 5.4e+52: tmp = x / (1.0 - z) else: tmp = -a / -y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= 5.4e+52) tmp = Float64(x / Float64(1.0 - z)); else tmp = Float64(Float64(-a) / Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= 5.4e+52) tmp = x / (1.0 - z); else tmp = -a / -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, 5.4e+52], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[((-a) / (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 5.4 \cdot 10^{+52}:\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{-y}\\
\end{array}
\end{array}
if a < 5.4e52Initial program 67.4%
Taylor expanded in y around inf
lower-/.f64N/A
metadata-evalN/A
cancel-sign-sub-invN/A
*-lft-identityN/A
lower--.f6435.7
Applied rewrites35.7%
if 5.4e52 < a Initial program 63.6%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6457.3
Applied rewrites57.3%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6425.6
Applied rewrites25.6%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f6420.6
Applied rewrites20.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ t (- y)))) (if (<= z -2e-15) t_1 (if (<= z 45000.0) (fma x z x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t / -y;
double tmp;
if (z <= -2e-15) {
tmp = t_1;
} else if (z <= 45000.0) {
tmp = fma(x, z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(t / Float64(-y)) tmp = 0.0 if (z <= -2e-15) tmp = t_1; elseif (z <= 45000.0) tmp = fma(x, z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t / (-y)), $MachinePrecision]}, If[LessEqual[z, -2e-15], t$95$1, If[LessEqual[z, 45000.0], N[(x * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{-y}\\
\mathbf{if}\;z \leq -2 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 45000:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.0000000000000002e-15 or 45000 < z Initial program 46.2%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6479.2
Applied rewrites79.2%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6437.2
Applied rewrites37.2%
Taylor expanded in t around inf
Applied rewrites21.3%
if -2.0000000000000002e-15 < z < 45000Initial program 87.7%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
div-add-revN/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6450.3
Applied rewrites50.3%
Taylor expanded in y around inf
Applied rewrites47.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ t (- y)))) (if (<= z -2e-15) t_1 (if (<= z 45000.0) x t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t / -y;
double tmp;
if (z <= -2e-15) {
tmp = t_1;
} else if (z <= 45000.0) {
tmp = x;
} 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(x, y, z, t, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = t / -y
if (z <= (-2d-15)) then
tmp = t_1
else if (z <= 45000.0d0) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t / -y;
double tmp;
if (z <= -2e-15) {
tmp = t_1;
} else if (z <= 45000.0) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = t / -y tmp = 0 if z <= -2e-15: tmp = t_1 elif z <= 45000.0: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(t / Float64(-y)) tmp = 0.0 if (z <= -2e-15) tmp = t_1; elseif (z <= 45000.0) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = t / -y; tmp = 0.0; if (z <= -2e-15) tmp = t_1; elseif (z <= 45000.0) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t / (-y)), $MachinePrecision]}, If[LessEqual[z, -2e-15], t$95$1, If[LessEqual[z, 45000.0], x, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{-y}\\
\mathbf{if}\;z \leq -2 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 45000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.0000000000000002e-15 or 45000 < z Initial program 46.2%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6479.2
Applied rewrites79.2%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6437.2
Applied rewrites37.2%
Taylor expanded in t around inf
Applied rewrites21.3%
if -2.0000000000000002e-15 < z < 45000Initial program 87.7%
Taylor expanded in z around 0
Applied rewrites47.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (- (/ x z)))) (if (<= z -1.0) t_1 (if (<= z 1.18e-7) x t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -(x / z);
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= 1.18e-7) {
tmp = x;
} 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(x, y, z, t, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = -(x / z)
if (z <= (-1.0d0)) then
tmp = t_1
else if (z <= 1.18d-7) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -(x / z);
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= 1.18e-7) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -(x / z) tmp = 0 if z <= -1.0: tmp = t_1 elif z <= 1.18e-7: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(-Float64(x / z)) tmp = 0.0 if (z <= -1.0) tmp = t_1; elseif (z <= 1.18e-7) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -(x / z); tmp = 0.0; if (z <= -1.0) tmp = t_1; elseif (z <= 1.18e-7) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = (-N[(x / z), $MachinePrecision])}, If[LessEqual[z, -1.0], t$95$1, If[LessEqual[z, 1.18e-7], x, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\frac{x}{z}\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.18 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1 or 1.18e-7 < z Initial program 46.1%
Taylor expanded in z around inf
Applied rewrites94.6%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6418.8
Applied rewrites18.8%
if -1 < z < 1.18e-7Initial program 87.4%
Taylor expanded in z around 0
Applied rewrites47.4%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 66.6%
Taylor expanded in z around 0
Applied rewrites25.3%
herbie shell --seed 2025130
(FPCore (x y z t a b)
:name "Development.Shake.Progress:decay from shake-0.15.5"
:precision binary64
(/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))