
(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 16 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 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_2 (fma (- b y) z y))
(t_3 (fma (/ z t_2) (- t a) (* (/ y t_2) x))))
(if (<= t_1 -1e-270)
t_3
(if (<= t_1 5e-200)
(-
(fma
-1.0
(/
(fma -1.0 (/ (* x y) (- b y)) (/ (* y (- t a)) (pow (- b y) 2.0)))
z)
(/ t (- b y)))
(/ a (- b y)))
(if (<= t_1 INFINITY) t_3 (/ (- t a) (- b y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_2 = fma((b - y), z, y);
double t_3 = fma((z / t_2), (t - a), ((y / t_2) * x));
double tmp;
if (t_1 <= -1e-270) {
tmp = t_3;
} else if (t_1 <= 5e-200) {
tmp = fma(-1.0, (fma(-1.0, ((x * y) / (b - y)), ((y * (t - a)) / pow((b - y), 2.0))) / z), (t / (b - y))) - (a / (b - y));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_3;
} else {
tmp = (t - a) / (b - y);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_2 = fma(Float64(b - y), z, y) t_3 = fma(Float64(z / t_2), Float64(t - a), Float64(Float64(y / t_2) * x)) tmp = 0.0 if (t_1 <= -1e-270) tmp = t_3; elseif (t_1 <= 5e-200) tmp = Float64(fma(-1.0, Float64(fma(-1.0, Float64(Float64(x * y) / Float64(b - y)), Float64(Float64(y * Float64(t - a)) / (Float64(b - y) ^ 2.0))) / z), Float64(t / Float64(b - y))) - Float64(a / Float64(b - y))); elseif (t_1 <= Inf) tmp = t_3; else tmp = Float64(Float64(t - a) / Float64(b - y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, Block[{t$95$2 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z / t$95$2), $MachinePrecision] * N[(t - a), $MachinePrecision] + N[(N[(y / t$95$2), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-270], t$95$3, If[LessEqual[t$95$1, 5e-200], N[(N[(-1.0 * N[(N[(-1.0 * N[(N[(x * y), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision] + N[(N[(y * N[(t - a), $MachinePrecision]), $MachinePrecision] / N[Power[N[(b - y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$3, N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_2 := \mathsf{fma}\left(b - y, z, y\right)\\
t_3 := \mathsf{fma}\left(\frac{z}{t\_2}, t - a, \frac{y}{t\_2} \cdot x\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-270}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-200}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{x \cdot y}{b - y}, \frac{y \cdot \left(t - a\right)}{{\left(b - y\right)}^{2}}\right)}{z}, \frac{t}{b - y}\right) - \frac{a}{b - y}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{t - a}{b - y}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1e-270 or 4.99999999999999991e-200 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 66.2%
Applied rewrites71.6%
Applied rewrites79.1%
if -1e-270 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 4.99999999999999991e-200Initial program 66.2%
Applied rewrites71.6%
Taylor expanded in z around -inf
Applied rewrites46.9%
if +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
(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 -3.9e+94)
t_2
(if (<= z 9.5e+67) (fma (/ y t_1) x (/ (* z (- t a)) t_1)) 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 <= -3.9e+94) {
tmp = t_2;
} else if (z <= 9.5e+67) {
tmp = fma((y / t_1), x, ((z * (t - a)) / t_1));
} else {
tmp = 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 <= -3.9e+94) tmp = t_2; elseif (z <= 9.5e+67) tmp = fma(Float64(y / t_1), x, Float64(Float64(z * Float64(t - a)) / t_1)); else tmp = 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, -3.9e+94], t$95$2, If[LessEqual[z, 9.5e+67], N[(N[(y / t$95$1), $MachinePrecision] * x + N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\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 -3.9 \cdot 10^{+94}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t\_1}, x, \frac{z \cdot \left(t - a\right)}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -3.89999999999999986e94 or 9.5000000000000002e67 < z Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
if -3.89999999999999986e94 < z < 9.5000000000000002e67Initial program 66.2%
Applied rewrites73.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y)))
(t_2 (+ (* x y) (* z (- t a))))
(t_3 (/ t_2 (+ y (* z (- b y)))))
(t_4 (fma (- b y) z y)))
(if (<= t_3 (- INFINITY))
(fma (/ z t_4) (- t a) (* 1.0 x))
(if (<= t_3 -2e-272)
(/ t_2 t_4)
(if (<= t_3 0.0)
t_1
(if (<= t_3 1e+278) (/ (fma (- t a) z (* x y)) t_4) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double t_2 = (x * y) + (z * (t - a));
double t_3 = t_2 / (y + (z * (b - y)));
double t_4 = fma((b - y), z, y);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = fma((z / t_4), (t - a), (1.0 * x));
} else if (t_3 <= -2e-272) {
tmp = t_2 / t_4;
} else if (t_3 <= 0.0) {
tmp = t_1;
} else if (t_3 <= 1e+278) {
tmp = fma((t - a), z, (x * y)) / t_4;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) t_2 = Float64(Float64(x * y) + Float64(z * Float64(t - a))) t_3 = Float64(t_2 / Float64(y + Float64(z * Float64(b - y)))) t_4 = fma(Float64(b - y), z, y) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = fma(Float64(z / t_4), Float64(t - a), Float64(1.0 * x)); elseif (t_3 <= -2e-272) tmp = Float64(t_2 / t_4); elseif (t_3 <= 0.0) tmp = t_1; elseif (t_3 <= 1e+278) tmp = Float64(fma(Float64(t - a), z, Float64(x * y)) / t_4); 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]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(z / t$95$4), $MachinePrecision] * N[(t - a), $MachinePrecision] + N[(1.0 * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -2e-272], N[(t$95$2 / t$95$4), $MachinePrecision], If[LessEqual[t$95$3, 0.0], t$95$1, If[LessEqual[t$95$3, 1e+278], N[(N[(N[(t - a), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
t_2 := x \cdot y + z \cdot \left(t - a\right)\\
t_3 := \frac{t\_2}{y + z \cdot \left(b - y\right)}\\
t_4 := \mathsf{fma}\left(b - y, z, y\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t\_4}, t - a, 1 \cdot x\right)\\
\mathbf{elif}\;t\_3 \leq -2 \cdot 10^{-272}:\\
\;\;\;\;\frac{t\_2}{t\_4}\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 10^{+278}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t - a, z, x \cdot y\right)}{t\_4}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0Initial program 66.2%
Applied rewrites71.6%
Applied rewrites79.1%
Taylor expanded in z around 0
Applied rewrites59.4%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.99999999999999986e-272Initial program 66.2%
Applied rewrites66.2%
if -1.99999999999999986e-272 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0 or 9.99999999999999964e277 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
if 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.99999999999999964e277Initial program 66.2%
Applied rewrites66.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y)))
(t_2 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_3 (fma (- b y) z y))
(t_4 (/ (fma (- t a) z (* x y)) t_3)))
(if (<= t_2 (- INFINITY))
(fma (/ z t_3) (- t a) (* 1.0 x))
(if (<= t_2 -2e-272)
t_4
(if (<= t_2 0.0) t_1 (if (<= t_2 1e+278) t_4 t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double t_2 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_3 = fma((b - y), z, y);
double t_4 = fma((t - a), z, (x * y)) / t_3;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma((z / t_3), (t - a), (1.0 * x));
} else if (t_2 <= -2e-272) {
tmp = t_4;
} else if (t_2 <= 0.0) {
tmp = t_1;
} else if (t_2 <= 1e+278) {
tmp = t_4;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) t_2 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_3 = fma(Float64(b - y), z, y) t_4 = Float64(fma(Float64(t - a), z, Float64(x * y)) / t_3) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(Float64(z / t_3), Float64(t - a), Float64(1.0 * x)); elseif (t_2 <= -2e-272) tmp = t_4; elseif (t_2 <= 0.0) tmp = t_1; elseif (t_2 <= 1e+278) tmp = t_4; 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]}, Block[{t$95$2 = 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]}, Block[{t$95$3 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(t - a), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(z / t$95$3), $MachinePrecision] * N[(t - a), $MachinePrecision] + N[(1.0 * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e-272], t$95$4, If[LessEqual[t$95$2, 0.0], t$95$1, If[LessEqual[t$95$2, 1e+278], t$95$4, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
t_2 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_3 := \mathsf{fma}\left(b - y, z, y\right)\\
t_4 := \frac{\mathsf{fma}\left(t - a, z, x \cdot y\right)}{t\_3}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t\_3}, t - a, 1 \cdot x\right)\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-272}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+278}:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0Initial program 66.2%
Applied rewrites71.6%
Applied rewrites79.1%
Taylor expanded in z around 0
Applied rewrites59.4%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.99999999999999986e-272 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.99999999999999964e277Initial program 66.2%
Applied rewrites66.2%
if -1.99999999999999986e-272 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0 or 9.99999999999999964e277 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -3.9e+94)
t_1
(if (<= z 9.5e+67) (/ (fma (- t a) z (* x y)) (fma (- b y) z 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.9e+94) {
tmp = t_1;
} else if (z <= 9.5e+67) {
tmp = fma((t - a), z, (x * y)) / fma((b - y), z, 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.9e+94) tmp = t_1; elseif (z <= 9.5e+67) tmp = Float64(fma(Float64(t - a), z, Float64(x * y)) / fma(Float64(b - y), z, 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.9e+94], t$95$1, If[LessEqual[z, 9.5e+67], N[(N[(N[(t - a), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -3.9 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+67}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t - a, z, x \cdot y\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.89999999999999986e94 or 9.5000000000000002e67 < z Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
if -3.89999999999999986e94 < z < 9.5000000000000002e67Initial program 66.2%
Applied rewrites66.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -5e+54)
t_1
(if (<= z 6.5e-6) (/ (fma y x (* z (- t a))) (+ y (* z b))) 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 <= -5e+54) {
tmp = t_1;
} else if (z <= 6.5e-6) {
tmp = fma(y, x, (z * (t - a))) / (y + (z * b));
} 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 <= -5e+54) tmp = t_1; elseif (z <= 6.5e-6) tmp = Float64(fma(y, x, Float64(z * Float64(t - a))) / Float64(y + Float64(z * b))); 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, -5e+54], t$95$1, If[LessEqual[z, 6.5e-6], N[(N[(y * x + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -5 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, z \cdot \left(t - a\right)\right)}{y + z \cdot b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.00000000000000005e54 or 6.4999999999999996e-6 < z Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
if -5.00000000000000005e54 < z < 6.4999999999999996e-6Initial program 66.2%
Taylor expanded in y around 0
Applied rewrites57.1%
Applied rewrites57.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -5.6e-14)
t_1
(if (<= z 7.2e-98)
(/ (- (* y x) (* a z)) (fma (- b y) z y))
(if (<= z 6.5e-6) (/ (fma t z (* x y)) (+ y (* z (- b 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 <= -5.6e-14) {
tmp = t_1;
} else if (z <= 7.2e-98) {
tmp = ((y * x) - (a * z)) / fma((b - y), z, y);
} else if (z <= 6.5e-6) {
tmp = fma(t, z, (x * y)) / (y + (z * (b - 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 <= -5.6e-14) tmp = t_1; elseif (z <= 7.2e-98) tmp = Float64(Float64(Float64(y * x) - Float64(a * z)) / fma(Float64(b - y), z, y)); elseif (z <= 6.5e-6) tmp = Float64(fma(t, z, Float64(x * y)) / Float64(y + Float64(z * Float64(b - 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, -5.6e-14], t$95$1, If[LessEqual[z, 7.2e-98], N[(N[(N[(y * x), $MachinePrecision] - N[(a * z), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e-6], N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -5.6 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-98}:\\
\;\;\;\;\frac{y \cdot x - a \cdot z}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, x \cdot y\right)}{y + z \cdot \left(b - y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.6000000000000001e-14 or 6.4999999999999996e-6 < z Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
if -5.6000000000000001e-14 < z < 7.2000000000000005e-98Initial program 66.2%
Taylor expanded in t around inf
Applied rewrites23.7%
Applied rewrites23.7%
Taylor expanded in t around 0
Applied rewrites47.4%
Applied rewrites47.4%
if 7.2000000000000005e-98 < z < 6.4999999999999996e-6Initial program 66.2%
Taylor expanded in a around 0
Applied rewrites47.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -5.6e-14)
t_1
(if (<= z 3.4e-66) (/ (- (* y x) (* a z)) (fma (- b y) z 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 <= -5.6e-14) {
tmp = t_1;
} else if (z <= 3.4e-66) {
tmp = ((y * x) - (a * z)) / fma((b - y), z, 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 <= -5.6e-14) tmp = t_1; elseif (z <= 3.4e-66) tmp = Float64(Float64(Float64(y * x) - Float64(a * z)) / fma(Float64(b - y), z, 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, -5.6e-14], t$95$1, If[LessEqual[z, 3.4e-66], N[(N[(N[(y * x), $MachinePrecision] - N[(a * z), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -5.6 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{-66}:\\
\;\;\;\;\frac{y \cdot x - a \cdot z}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.6000000000000001e-14 or 3.39999999999999997e-66 < z Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
if -5.6000000000000001e-14 < z < 3.39999999999999997e-66Initial program 66.2%
Taylor expanded in t around inf
Applied rewrites23.7%
Applied rewrites23.7%
Taylor expanded in t around 0
Applied rewrites47.4%
Applied rewrites47.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -5e+54)
t_1
(if (<= z -2.2e-199)
(/ (* z (- t a)) (fma (- b y) z y))
(if (<= z 1.75e-67) (+ x (* z (* -1.0 (/ 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 <= -5e+54) {
tmp = t_1;
} else if (z <= -2.2e-199) {
tmp = (z * (t - a)) / fma((b - y), z, y);
} else if (z <= 1.75e-67) {
tmp = x + (z * (-1.0 * (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 <= -5e+54) tmp = t_1; elseif (z <= -2.2e-199) tmp = Float64(Float64(z * Float64(t - a)) / fma(Float64(b - y), z, y)); elseif (z <= 1.75e-67) tmp = Float64(x + Float64(z * Float64(-1.0 * Float64(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, -5e+54], t$95$1, If[LessEqual[z, -2.2e-199], N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e-67], N[(x + N[(z * N[(-1.0 * N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -5 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{-199}:\\
\;\;\;\;\frac{z \cdot \left(t - a\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-67}:\\
\;\;\;\;x + z \cdot \left(-1 \cdot \frac{a}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.00000000000000005e54 or 1.75e-67 < z Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
if -5.00000000000000005e54 < z < -2.1999999999999998e-199Initial program 66.2%
Taylor expanded in t around inf
Applied rewrites23.7%
Applied rewrites23.7%
Taylor expanded in x around 0
Applied rewrites41.7%
if -2.1999999999999998e-199 < z < 1.75e-67Initial program 66.2%
Taylor expanded in z around 0
Applied rewrites28.2%
Taylor expanded in a around inf
Applied rewrites31.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -3.8e-28)
t_1
(if (<= z 1.75e-67) (* (fma (- t a) z (* x y)) (/ 1.0 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.8e-28) {
tmp = t_1;
} else if (z <= 1.75e-67) {
tmp = fma((t - a), z, (x * y)) * (1.0 / 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.8e-28) tmp = t_1; elseif (z <= 1.75e-67) tmp = Float64(fma(Float64(t - a), z, Float64(x * y)) * Float64(1.0 / 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.8e-28], t$95$1, If[LessEqual[z, 1.75e-67], N[(N[(N[(t - a), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-67}:\\
\;\;\;\;\mathsf{fma}\left(t - a, z, x \cdot y\right) \cdot \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.80000000000000009e-28 or 1.75e-67 < z Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
if -3.80000000000000009e-28 < z < 1.75e-67Initial program 66.2%
Applied rewrites66.1%
Taylor expanded in z around 0
Applied rewrites32.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -5000000.0)
t_1
(if (<= z -2.2e-199)
(/ (* z (- t a)) (+ y (* z b)))
(if (<= z 1.75e-67) (+ x (* z (* -1.0 (/ 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 <= -5000000.0) {
tmp = t_1;
} else if (z <= -2.2e-199) {
tmp = (z * (t - a)) / (y + (z * b));
} else if (z <= 1.75e-67) {
tmp = x + (z * (-1.0 * (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 = (t - a) / (b - y)
if (z <= (-5000000.0d0)) then
tmp = t_1
else if (z <= (-2.2d-199)) then
tmp = (z * (t - a)) / (y + (z * b))
else if (z <= 1.75d-67) then
tmp = x + (z * ((-1.0d0) * (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 = (t - a) / (b - y);
double tmp;
if (z <= -5000000.0) {
tmp = t_1;
} else if (z <= -2.2e-199) {
tmp = (z * (t - a)) / (y + (z * b));
} else if (z <= 1.75e-67) {
tmp = x + (z * (-1.0 * (a / y)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -5000000.0: tmp = t_1 elif z <= -2.2e-199: tmp = (z * (t - a)) / (y + (z * b)) elif z <= 1.75e-67: tmp = x + (z * (-1.0 * (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 <= -5000000.0) tmp = t_1; elseif (z <= -2.2e-199) tmp = Float64(Float64(z * Float64(t - a)) / Float64(y + Float64(z * b))); elseif (z <= 1.75e-67) tmp = Float64(x + Float64(z * Float64(-1.0 * Float64(a / y)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / (b - y); tmp = 0.0; if (z <= -5000000.0) tmp = t_1; elseif (z <= -2.2e-199) tmp = (z * (t - a)) / (y + (z * b)); elseif (z <= 1.75e-67) tmp = x + (z * (-1.0 * (a / y))); else tmp = t_1; end tmp_2 = 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, -5000000.0], t$95$1, If[LessEqual[z, -2.2e-199], N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e-67], N[(x + N[(z * N[(-1.0 * N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -5000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{-199}:\\
\;\;\;\;\frac{z \cdot \left(t - a\right)}{y + z \cdot b}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-67}:\\
\;\;\;\;x + z \cdot \left(-1 \cdot \frac{a}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5e6 or 1.75e-67 < z Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
if -5e6 < z < -2.1999999999999998e-199Initial program 66.2%
Taylor expanded in x around 0
Applied rewrites41.7%
Taylor expanded in y around 0
Applied rewrites35.1%
if -2.1999999999999998e-199 < z < 1.75e-67Initial program 66.2%
Taylor expanded in z around 0
Applied rewrites28.2%
Taylor expanded in a around inf
Applied rewrites31.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -5.8e-32)
t_1
(if (<= z 1.75e-67) (+ x (* z (* -1.0 (/ 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 <= -5.8e-32) {
tmp = t_1;
} else if (z <= 1.75e-67) {
tmp = x + (z * (-1.0 * (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 = (t - a) / (b - y)
if (z <= (-5.8d-32)) then
tmp = t_1
else if (z <= 1.75d-67) then
tmp = x + (z * ((-1.0d0) * (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 = (t - a) / (b - y);
double tmp;
if (z <= -5.8e-32) {
tmp = t_1;
} else if (z <= 1.75e-67) {
tmp = x + (z * (-1.0 * (a / y)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -5.8e-32: tmp = t_1 elif z <= 1.75e-67: tmp = x + (z * (-1.0 * (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 <= -5.8e-32) tmp = t_1; elseif (z <= 1.75e-67) tmp = Float64(x + Float64(z * Float64(-1.0 * Float64(a / y)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / (b - y); tmp = 0.0; if (z <= -5.8e-32) tmp = t_1; elseif (z <= 1.75e-67) tmp = x + (z * (-1.0 * (a / y))); else tmp = t_1; end tmp_2 = 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, -5.8e-32], t$95$1, If[LessEqual[z, 1.75e-67], N[(x + N[(z * N[(-1.0 * N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -5.8 \cdot 10^{-32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-67}:\\
\;\;\;\;x + z \cdot \left(-1 \cdot \frac{a}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.79999999999999991e-32 or 1.75e-67 < z Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
if -5.79999999999999991e-32 < z < 1.75e-67Initial program 66.2%
Taylor expanded in z around 0
Applied rewrites28.2%
Taylor expanded in a around inf
Applied rewrites31.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -1.85e-83) t_1 (if (<= z 6.1e-68) (+ x (* 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 <= -1.85e-83) {
tmp = t_1;
} else if (z <= 6.1e-68) {
tmp = x + (x * 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 - a) / (b - y)
if (z <= (-1.85d-83)) then
tmp = t_1
else if (z <= 6.1d-68) then
tmp = x + (x * 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 - a) / (b - y);
double tmp;
if (z <= -1.85e-83) {
tmp = t_1;
} else if (z <= 6.1e-68) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -1.85e-83: tmp = t_1 elif z <= 6.1e-68: tmp = x + (x * z) 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 <= -1.85e-83) tmp = t_1; elseif (z <= 6.1e-68) tmp = Float64(x + Float64(x * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / (b - y); tmp = 0.0; if (z <= -1.85e-83) tmp = t_1; elseif (z <= 6.1e-68) tmp = x + (x * z); else tmp = t_1; end tmp_2 = 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, -1.85e-83], t$95$1, If[LessEqual[z, 6.1e-68], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{-83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.1 \cdot 10^{-68}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.84999999999999997e-83 or 6.1e-68 < z Initial program 66.2%
Taylor expanded in z around inf
Applied rewrites51.6%
if -1.84999999999999997e-83 < z < 6.1e-68Initial program 66.2%
Taylor expanded in z around 0
Applied rewrites28.2%
Taylor expanded in y around inf
Applied rewrites25.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) b))) (if (<= z -2.35e-83) t_1 (if (<= z 6.1e-68) (+ x (* x z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / b;
double tmp;
if (z <= -2.35e-83) {
tmp = t_1;
} else if (z <= 6.1e-68) {
tmp = x + (x * 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 - a) / b
if (z <= (-2.35d-83)) then
tmp = t_1
else if (z <= 6.1d-68) then
tmp = x + (x * 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 - a) / b;
double tmp;
if (z <= -2.35e-83) {
tmp = t_1;
} else if (z <= 6.1e-68) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / b tmp = 0 if z <= -2.35e-83: tmp = t_1 elif z <= 6.1e-68: tmp = x + (x * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / b) tmp = 0.0 if (z <= -2.35e-83) tmp = t_1; elseif (z <= 6.1e-68) tmp = Float64(x + Float64(x * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / b; tmp = 0.0; if (z <= -2.35e-83) tmp = t_1; elseif (z <= 6.1e-68) tmp = x + (x * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[z, -2.35e-83], t$95$1, If[LessEqual[z, 6.1e-68], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b}\\
\mathbf{if}\;z \leq -2.35 \cdot 10^{-83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.1 \cdot 10^{-68}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.3500000000000002e-83 or 6.1e-68 < z Initial program 66.2%
Taylor expanded in y around 0
Applied rewrites35.6%
if -2.3500000000000002e-83 < z < 6.1e-68Initial program 66.2%
Taylor expanded in z around 0
Applied rewrites28.2%
Taylor expanded in y around inf
Applied rewrites25.8%
(FPCore (x y z t a b) :precision binary64 (if (<= z -6.5e-39) (/ t b) (if (<= z 1.75e-67) (+ x (* x z)) (/ t b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6.5e-39) {
tmp = t / b;
} else if (z <= 1.75e-67) {
tmp = x + (x * z);
} else {
tmp = t / b;
}
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 (z <= (-6.5d-39)) then
tmp = t / b
else if (z <= 1.75d-67) then
tmp = x + (x * z)
else
tmp = t / b
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 (z <= -6.5e-39) {
tmp = t / b;
} else if (z <= 1.75e-67) {
tmp = x + (x * z);
} else {
tmp = t / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -6.5e-39: tmp = t / b elif z <= 1.75e-67: tmp = x + (x * z) else: tmp = t / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -6.5e-39) tmp = Float64(t / b); elseif (z <= 1.75e-67) tmp = Float64(x + Float64(x * z)); else tmp = Float64(t / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -6.5e-39) tmp = t / b; elseif (z <= 1.75e-67) tmp = x + (x * z); else tmp = t / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -6.5e-39], N[(t / b), $MachinePrecision], If[LessEqual[z, 1.75e-67], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], N[(t / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{-39}:\\
\;\;\;\;\frac{t}{b}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-67}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{b}\\
\end{array}
\end{array}
if z < -6.50000000000000027e-39 or 1.75e-67 < z Initial program 66.2%
Taylor expanded in y around 0
Applied rewrites35.6%
Taylor expanded in t around inf
Applied rewrites20.0%
if -6.50000000000000027e-39 < z < 1.75e-67Initial program 66.2%
Taylor expanded in z around 0
Applied rewrites28.2%
Taylor expanded in y around inf
Applied rewrites25.8%
(FPCore (x y z t a b) :precision binary64 (/ t b))
double code(double x, double y, double z, double t, double a, double b) {
return t / b;
}
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 = t / b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return t / b;
}
def code(x, y, z, t, a, b): return t / b
function code(x, y, z, t, a, b) return Float64(t / b) end
function tmp = code(x, y, z, t, a, b) tmp = t / b; end
code[x_, y_, z_, t_, a_, b_] := N[(t / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{t}{b}
\end{array}
Initial program 66.2%
Taylor expanded in y around 0
Applied rewrites35.6%
Taylor expanded in t around inf
Applied rewrites20.0%
herbie shell --seed 2025153
(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)))))