
(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}
Sampling outcomes in binary64 precision:
Herbie found 14 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
(-
(fma (/ x z) (/ y (- b y)) (/ t (- b y)))
(fma (/ y z) (/ (- t a) (pow (- b y) 2.0)) (/ a (- b y)))))
(t_2 (fma (- b y) z y))
(t_3 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_4 (fma z (/ (- t a) t_2) (* x (/ y t_2)))))
(if (<= t_3 (- INFINITY))
t_4
(if (<= t_3 -2e-255)
t_3
(if (<= t_3 0.0)
t_1
(if (<= t_3 1e+253) t_3 (if (<= t_3 INFINITY) t_4 t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((x / z), (y / (b - y)), (t / (b - y))) - fma((y / z), ((t - a) / pow((b - y), 2.0)), (a / (b - y)));
double t_2 = fma((b - y), z, y);
double t_3 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_4 = fma(z, ((t - a) / t_2), (x * (y / t_2)));
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_3 <= -2e-255) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = t_1;
} else if (t_3 <= 1e+253) {
tmp = t_3;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_4;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(Float64(x / z), Float64(y / Float64(b - y)), Float64(t / Float64(b - y))) - fma(Float64(y / z), Float64(Float64(t - a) / (Float64(b - y) ^ 2.0)), Float64(a / Float64(b - y)))) t_2 = fma(Float64(b - y), z, y) t_3 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_4 = fma(z, Float64(Float64(t - a) / t_2), Float64(x * Float64(y / t_2))) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_4; elseif (t_3 <= -2e-255) tmp = t_3; elseif (t_3 <= 0.0) tmp = t_1; elseif (t_3 <= 1e+253) tmp = t_3; elseif (t_3 <= Inf) tmp = t_4; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x / z), $MachinePrecision] * N[(y / N[(b - y), $MachinePrecision]), $MachinePrecision] + N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y / z), $MachinePrecision] * N[(N[(t - a), $MachinePrecision] / N[Power[N[(b - y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(a / 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[(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$4 = N[(z * N[(N[(t - a), $MachinePrecision] / t$95$2), $MachinePrecision] + N[(x * N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, -2e-255], t$95$3, If[LessEqual[t$95$3, 0.0], t$95$1, If[LessEqual[t$95$3, 1e+253], t$95$3, If[LessEqual[t$95$3, Infinity], t$95$4, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x}{z}, \frac{y}{b - y}, \frac{t}{b - y}\right) - \mathsf{fma}\left(\frac{y}{z}, \frac{t - a}{{\left(b - y\right)}^{2}}, \frac{a}{b - y}\right)\\
t_2 := \mathsf{fma}\left(b - y, z, y\right)\\
t_3 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_4 := \mathsf{fma}\left(z, \frac{t - a}{t\_2}, x \cdot \frac{y}{t\_2}\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq -2 \cdot 10^{-255}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 10^{+253}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;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.0 or 9.9999999999999994e252 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 22.8%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -2e-255 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.9999999999999994e252Initial program 99.5%
if -2e-255 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0 or +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 15.1%
Taylor expanded in z around inf
lower--.f64N/A
+-commutativeN/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f64N/A
+-commutativeN/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites100.0%
Final simplification99.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- b y) z y))
(t_2 (/ (- t a) (- b y)))
(t_3 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_4 (fma z (/ (- t a) t_1) (* x (/ y t_1)))))
(if (<= t_3 (- INFINITY))
t_4
(if (<= t_3 -2e-255)
t_3
(if (<= t_3 0.0)
(fma
(/ (- (* x (/ y (- b y))) (/ (* (- t a) y) (pow (- b y) 2.0))) (- z))
-1.0
t_2)
(if (<= t_3 1e+253) t_3 (if (<= t_3 INFINITY) t_4 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 t_3 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_4 = fma(z, ((t - a) / t_1), (x * (y / t_1)));
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_3 <= -2e-255) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = fma((((x * (y / (b - y))) - (((t - a) * y) / pow((b - y), 2.0))) / -z), -1.0, t_2);
} else if (t_3 <= 1e+253) {
tmp = t_3;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_4;
} 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)) t_3 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_4 = fma(z, Float64(Float64(t - a) / t_1), Float64(x * Float64(y / t_1))) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_4; elseif (t_3 <= -2e-255) tmp = t_3; elseif (t_3 <= 0.0) tmp = fma(Float64(Float64(Float64(x * Float64(y / Float64(b - y))) - Float64(Float64(Float64(t - a) * y) / (Float64(b - y) ^ 2.0))) / Float64(-z)), -1.0, t_2); elseif (t_3 <= 1e+253) tmp = t_3; elseif (t_3 <= Inf) tmp = t_4; 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]}, Block[{t$95$3 = 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$4 = N[(z * N[(N[(t - a), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(x * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, -2e-255], t$95$3, If[LessEqual[t$95$3, 0.0], N[(N[(N[(N[(x * N[(y / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(t - a), $MachinePrecision] * y), $MachinePrecision] / N[Power[N[(b - y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-z)), $MachinePrecision] * -1.0 + t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 1e+253], t$95$3, If[LessEqual[t$95$3, Infinity], t$95$4, 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}\\
t_3 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_4 := \mathsf{fma}\left(z, \frac{t - a}{t\_1}, x \cdot \frac{y}{t\_1}\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq -2 \cdot 10^{-255}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{x \cdot \frac{y}{b - y} - \frac{\left(t - a\right) \cdot y}{{\left(b - y\right)}^{2}}}{-z}, -1, t\_2\right)\\
\mathbf{elif}\;t\_3 \leq 10^{+253}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or 9.9999999999999994e252 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 22.8%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -2e-255 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.9999999999999994e252Initial program 99.5%
if -2e-255 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0Initial program 37.0%
Taylor expanded in z around -inf
associate--l+N/A
*-commutativeN/A
div-subN/A
lower-fma.f64N/A
Applied rewrites99.9%
if +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 0.0%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6473.3
Applied rewrites73.3%
Final simplification96.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- b y) z y))
(t_2 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_3 (fma z (/ (- t a) t_1) (* x (/ y t_1)))))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 -4e-278)
t_2
(if (<= t_2 0.0)
(fma -1.0 (/ a (- b y)) (/ t (- b y)))
(if (<= t_2 1e+253)
t_2
(if (<= t_2 INFINITY) t_3 (/ (- t a) (- b y)))))))))
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 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_3 = fma(z, ((t - a) / t_1), (x * (y / t_1)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= -4e-278) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = fma(-1.0, (a / (b - y)), (t / (b - y)));
} else if (t_2 <= 1e+253) {
tmp = t_2;
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_3;
} else {
tmp = (t - a) / (b - y);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(b - y), z, y) t_2 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_3 = fma(z, Float64(Float64(t - a) / t_1), Float64(x * Float64(y / t_1))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= -4e-278) tmp = t_2; elseif (t_2 <= 0.0) tmp = fma(-1.0, Float64(a / Float64(b - y)), Float64(t / Float64(b - y))); elseif (t_2 <= 1e+253) tmp = t_2; elseif (t_2 <= 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[(b - y), $MachinePrecision] * z + y), $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[(z * N[(N[(t - a), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(x * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, -4e-278], t$95$2, If[LessEqual[t$95$2, 0.0], N[(-1.0 * N[(a / N[(b - y), $MachinePrecision]), $MachinePrecision] + N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+253], t$95$2, If[LessEqual[t$95$2, Infinity], t$95$3, N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b - y, z, y\right)\\
t_2 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_3 := \mathsf{fma}\left(z, \frac{t - a}{t\_1}, x \cdot \frac{y}{t\_1}\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -4 \cdot 10^{-278}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{a}{b - y}, \frac{t}{b - y}\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+253}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \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)))) < -inf.0 or 9.9999999999999994e252 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 22.8%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -3.99999999999999975e-278 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.9999999999999994e252Initial program 99.5%
if -3.99999999999999975e-278 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0Initial program 34.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
div-add-revN/A
lower-/.f64N/A
Applied rewrites34.4%
Taylor expanded in z around inf
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6479.4
Applied rewrites79.4%
if +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 0.0%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6473.3
Applied rewrites73.3%
Final simplification94.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_2 (fma z (/ (- t a) (fma (- b y) z y)) x)))
(if (<= t_1 (- INFINITY))
t_2
(if (<= t_1 -4e-278)
t_1
(if (<= t_1 0.0)
(fma -1.0 (/ a (- b y)) (/ t (- b y)))
(if (<= t_1 1e+253)
t_1
(if (<= t_1 INFINITY) t_2 (/ (- 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(z, ((t - a) / fma((b - y), z, y)), x);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= -4e-278) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = fma(-1.0, (a / (b - y)), (t / (b - y)));
} else if (t_1 <= 1e+253) {
tmp = t_1;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} 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(z, Float64(Float64(t - a) / fma(Float64(b - y), z, y)), x) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_2; elseif (t_1 <= -4e-278) tmp = t_1; elseif (t_1 <= 0.0) tmp = fma(-1.0, Float64(a / Float64(b - y)), Float64(t / Float64(b - y))); elseif (t_1 <= 1e+253) tmp = t_1; elseif (t_1 <= Inf) tmp = t_2; 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[(z * N[(N[(t - a), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, -4e-278], t$95$1, If[LessEqual[t$95$1, 0.0], N[(-1.0 * N[(a / N[(b - y), $MachinePrecision]), $MachinePrecision] + N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+253], t$95$1, If[LessEqual[t$95$1, Infinity], t$95$2, 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(z, \frac{t - a}{\mathsf{fma}\left(b - y, z, y\right)}, x\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-278}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{a}{b - y}, \frac{t}{b - y}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+253}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_2\\
\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)))) < -inf.0 or 9.9999999999999994e252 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 22.8%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in z around 0
Applied rewrites83.8%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -3.99999999999999975e-278 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.9999999999999994e252Initial program 99.5%
if -3.99999999999999975e-278 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0Initial program 34.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
div-add-revN/A
lower-/.f64N/A
Applied rewrites34.4%
Taylor expanded in z around inf
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6479.4
Applied rewrites79.4%
if +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 0.0%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6473.3
Applied rewrites73.3%
Final simplification90.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -1800000000000.0)
t_1
(if (<= z -1.05e-9)
(* x (/ y (fma (- b y) z y)))
(if (<= z 5.4e-11) (fma z (/ (- t a) (fma b z y)) 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 <= -1800000000000.0) {
tmp = t_1;
} else if (z <= -1.05e-9) {
tmp = x * (y / fma((b - y), z, y));
} else if (z <= 5.4e-11) {
tmp = fma(z, ((t - a) / fma(b, z, y)), 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 <= -1800000000000.0) tmp = t_1; elseif (z <= -1.05e-9) tmp = Float64(x * Float64(y / fma(Float64(b - y), z, y))); elseif (z <= 5.4e-11) tmp = fma(z, Float64(Float64(t - a) / fma(b, z, y)), 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, -1800000000000.0], t$95$1, If[LessEqual[z, -1.05e-9], N[(x * N[(y / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.4e-11], N[(z * N[(N[(t - a), $MachinePrecision] / N[(b * z + y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -1800000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-9}:\\
\;\;\;\;x \cdot \frac{y}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b, z, y\right)}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.8e12 or 5.40000000000000009e-11 < z Initial program 39.4%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.9
Applied rewrites80.9%
if -1.8e12 < z < -1.0500000000000001e-9Initial program 59.2%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6486.5
Applied rewrites86.5%
if -1.0500000000000001e-9 < z < 5.40000000000000009e-11Initial program 88.8%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites91.0%
Taylor expanded in z around 0
Applied rewrites77.2%
Taylor expanded in y around 0
Applied rewrites77.2%
Final simplification79.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1800000000000.0) (not (<= z 300000.0))) (/ (- t a) (- b y)) (fma z (/ (- t a) (fma (- b y) z y)) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1800000000000.0) || !(z <= 300000.0)) {
tmp = (t - a) / (b - y);
} else {
tmp = fma(z, ((t - a) / fma((b - y), z, y)), x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1800000000000.0) || !(z <= 300000.0)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = fma(z, Float64(Float64(t - a) / fma(Float64(b - y), z, y)), x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1800000000000.0], N[Not[LessEqual[z, 300000.0]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(t - a), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1800000000000 \lor \neg \left(z \leq 300000\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{\mathsf{fma}\left(b - y, z, y\right)}, x\right)\\
\end{array}
\end{array}
if z < -1.8e12 or 3e5 < z Initial program 37.9%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6481.8
Applied rewrites81.8%
if -1.8e12 < z < 3e5Initial program 87.4%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites91.7%
Taylor expanded in z around 0
Applied rewrites74.6%
Final simplification78.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -7.6e-59) (not (<= z 8.5e-28))) (/ (- t a) (- b y)) (fma z (/ (- t a) y) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -7.6e-59) || !(z <= 8.5e-28)) {
tmp = (t - a) / (b - y);
} else {
tmp = fma(z, ((t - a) / y), x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -7.6e-59) || !(z <= 8.5e-28)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = fma(z, Float64(Float64(t - a) / y), x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -7.6e-59], N[Not[LessEqual[z, 8.5e-28]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(t - a), $MachinePrecision] / y), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{-59} \lor \neg \left(z \leq 8.5 \cdot 10^{-28}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{y}, x\right)\\
\end{array}
\end{array}
if z < -7.59999999999999966e-59 or 8.49999999999999925e-28 < z Initial program 46.1%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6474.3
Applied rewrites74.3%
if -7.59999999999999966e-59 < z < 8.49999999999999925e-28Initial program 88.0%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
div-add-revN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites89.7%
Taylor expanded in z around 0
Applied rewrites80.1%
Taylor expanded in z around 0
Applied rewrites73.7%
Final simplification74.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.25e-89) (not (<= z 1.1e-17))) (/ (- t a) (- b y)) (+ x (/ (* t z) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.25e-89) || !(z <= 1.1e-17)) {
tmp = (t - a) / (b - y);
} else {
tmp = x + ((t * z) / y);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 <= (-2.25d-89)) .or. (.not. (z <= 1.1d-17))) then
tmp = (t - a) / (b - y)
else
tmp = x + ((t * z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.25e-89) || !(z <= 1.1e-17)) {
tmp = (t - a) / (b - y);
} else {
tmp = x + ((t * z) / y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -2.25e-89) or not (z <= 1.1e-17): tmp = (t - a) / (b - y) else: tmp = x + ((t * z) / y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.25e-89) || !(z <= 1.1e-17)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(x + Float64(Float64(t * z) / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -2.25e-89) || ~((z <= 1.1e-17))) tmp = (t - a) / (b - y); else tmp = x + ((t * z) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.25e-89], N[Not[LessEqual[z, 1.1e-17]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{-89} \lor \neg \left(z \leq 1.1 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot z}{y}\\
\end{array}
\end{array}
if z < -2.25e-89 or 1.1e-17 < z Initial program 47.1%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6473.6
Applied rewrites73.6%
if -2.25e-89 < z < 1.1e-17Initial program 87.7%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f6470.0
Applied rewrites70.0%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f6472.8
Applied rewrites72.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6466.5
Applied rewrites66.5%
Final simplification70.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -3.2e-91) (not (<= z 9.2e-18))) (/ (- t a) (- b y)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.2e-91) || !(z <= 9.2e-18)) {
tmp = (t - a) / (b - y);
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 <= (-3.2d-91)) .or. (.not. (z <= 9.2d-18))) then
tmp = (t - a) / (b - y)
else
tmp = x
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 <= -3.2e-91) || !(z <= 9.2e-18)) {
tmp = (t - a) / (b - y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -3.2e-91) or not (z <= 9.2e-18): tmp = (t - a) / (b - y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.2e-91) || !(z <= 9.2e-18)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -3.2e-91) || ~((z <= 9.2e-18))) tmp = (t - a) / (b - y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.2e-91], N[Not[LessEqual[z, 9.2e-18]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-91} \lor \neg \left(z \leq 9.2 \cdot 10^{-18}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.19999999999999996e-91 or 9.2000000000000004e-18 < z Initial program 47.5%
Taylor expanded in z around inf
lower-/.f64N/A
lift--.f64N/A
lift--.f6473.2
Applied rewrites73.2%
if -3.19999999999999996e-91 < z < 9.2000000000000004e-18Initial program 87.5%
Taylor expanded in z around 0
Applied rewrites58.0%
Final simplification67.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.6e-11) (not (<= y 1.25e+44))) (/ (- x) (- z 1.0)) (/ (- t a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.6e-11) || !(y <= 1.25e+44)) {
tmp = -x / (z - 1.0);
} else {
tmp = (t - a) / 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 ((y <= (-1.6d-11)) .or. (.not. (y <= 1.25d+44))) then
tmp = -x / (z - 1.0d0)
else
tmp = (t - a) / 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 ((y <= -1.6e-11) || !(y <= 1.25e+44)) {
tmp = -x / (z - 1.0);
} else {
tmp = (t - a) / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.6e-11) or not (y <= 1.25e+44): tmp = -x / (z - 1.0) else: tmp = (t - a) / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.6e-11) || !(y <= 1.25e+44)) tmp = Float64(Float64(-x) / Float64(z - 1.0)); else tmp = Float64(Float64(t - a) / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.6e-11) || ~((y <= 1.25e+44))) tmp = -x / (z - 1.0); else tmp = (t - a) / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.6e-11], N[Not[LessEqual[y, 1.25e+44]], $MachinePrecision]], N[((-x) / N[(z - 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{-11} \lor \neg \left(y \leq 1.25 \cdot 10^{+44}\right):\\
\;\;\;\;\frac{-x}{z - 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t - a}{b}\\
\end{array}
\end{array}
if y < -1.59999999999999997e-11 or 1.2499999999999999e44 < y Initial program 55.7%
Taylor expanded in y around -inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f6449.8
Applied rewrites49.8%
if -1.59999999999999997e-11 < y < 1.2499999999999999e44Initial program 71.9%
Taylor expanded in y around 0
lower-/.f64N/A
lift--.f6458.1
Applied rewrites58.1%
Final simplification53.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -3.2e-91) (not (<= z 9.2e-18))) (/ (- t a) b) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.2e-91) || !(z <= 9.2e-18)) {
tmp = (t - a) / b;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 <= (-3.2d-91)) .or. (.not. (z <= 9.2d-18))) then
tmp = (t - a) / b
else
tmp = x
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 <= -3.2e-91) || !(z <= 9.2e-18)) {
tmp = (t - a) / b;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -3.2e-91) or not (z <= 9.2e-18): tmp = (t - a) / b else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.2e-91) || !(z <= 9.2e-18)) tmp = Float64(Float64(t - a) / b); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -3.2e-91) || ~((z <= 9.2e-18))) tmp = (t - a) / b; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.2e-91], N[Not[LessEqual[z, 9.2e-18]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-91} \lor \neg \left(z \leq 9.2 \cdot 10^{-18}\right):\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.19999999999999996e-91 or 9.2000000000000004e-18 < z Initial program 47.5%
Taylor expanded in y around 0
lower-/.f64N/A
lift--.f6447.5
Applied rewrites47.5%
if -3.19999999999999996e-91 < z < 9.2000000000000004e-18Initial program 87.5%
Taylor expanded in z around 0
Applied rewrites58.0%
Final simplification51.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -8.8e-91) (not (<= z 1.1e-17))) (/ t (- b y)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -8.8e-91) || !(z <= 1.1e-17)) {
tmp = t / (b - y);
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 <= (-8.8d-91)) .or. (.not. (z <= 1.1d-17))) then
tmp = t / (b - y)
else
tmp = x
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 <= -8.8e-91) || !(z <= 1.1e-17)) {
tmp = t / (b - y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -8.8e-91) or not (z <= 1.1e-17): tmp = t / (b - y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -8.8e-91) || !(z <= 1.1e-17)) tmp = Float64(t / Float64(b - y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -8.8e-91) || ~((z <= 1.1e-17))) tmp = t / (b - y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -8.8e-91], N[Not[LessEqual[z, 1.1e-17]], $MachinePrecision]], N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{-91} \lor \neg \left(z \leq 1.1 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{t}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.8000000000000003e-91 or 1.1e-17 < z Initial program 47.5%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
div-add-revN/A
lower-/.f64N/A
Applied rewrites51.1%
Taylor expanded in z around inf
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6472.6
Applied rewrites72.6%
Taylor expanded in t around inf
lift-/.f64N/A
lift--.f6441.0
Applied rewrites41.0%
if -8.8000000000000003e-91 < z < 1.1e-17Initial program 87.5%
Taylor expanded in z around 0
Applied rewrites58.0%
Final simplification47.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -8.8e-91) (not (<= z 1.1e-17))) (/ t b) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -8.8e-91) || !(z <= 1.1e-17)) {
tmp = t / b;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 <= (-8.8d-91)) .or. (.not. (z <= 1.1d-17))) then
tmp = t / b
else
tmp = x
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 <= -8.8e-91) || !(z <= 1.1e-17)) {
tmp = t / b;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -8.8e-91) or not (z <= 1.1e-17): tmp = t / b else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -8.8e-91) || !(z <= 1.1e-17)) tmp = Float64(t / b); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -8.8e-91) || ~((z <= 1.1e-17))) tmp = t / b; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -8.8e-91], N[Not[LessEqual[z, 1.1e-17]], $MachinePrecision]], N[(t / b), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{-91} \lor \neg \left(z \leq 1.1 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{t}{b}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.8000000000000003e-91 or 1.1e-17 < z Initial program 47.5%
Taylor expanded in y around 0
lower-/.f64N/A
lift--.f6447.5
Applied rewrites47.5%
Taylor expanded in t around inf
Applied rewrites26.8%
if -8.8000000000000003e-91 < z < 1.1e-17Initial program 87.5%
Taylor expanded in z around 0
Applied rewrites58.0%
Final simplification39.1%
(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 63.3%
Taylor expanded in z around 0
Applied rewrites25.3%
Final simplification25.3%
herbie shell --seed 2025085
(FPCore (x y z t a b)
:name "Development.Shake.Progress:decay from shake-0.15.5"
:precision binary64
:alt
(! :herbie-platform default (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z)))))
(/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))