
(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 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
(-
(/ (fma (/ x z) y (- t a)) (- b y))
(* (/ y (pow (- b y) 2.0)) (/ (- t a) z))))
(t_2 (fma (- b y) z y))
(t_3 (* z (- t a)))
(t_4 (/ (fma x y t_3) t_2))
(t_5 (/ (+ (* x y) t_3) (+ y (* z (- b y)))))
(t_6 (fma (- t a) (/ z t_2) (* y (/ x t_2)))))
(if (<= t_5 (- INFINITY))
t_6
(if (<= t_5 -5e-207)
t_4
(if (<= t_5 1e-302)
t_1
(if (<= t_5 2e+303) t_4 (if (<= t_5 INFINITY) t_6 t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (fma((x / z), y, (t - a)) / (b - y)) - ((y / pow((b - y), 2.0)) * ((t - a) / z));
double t_2 = fma((b - y), z, y);
double t_3 = z * (t - a);
double t_4 = fma(x, y, t_3) / t_2;
double t_5 = ((x * y) + t_3) / (y + (z * (b - y)));
double t_6 = fma((t - a), (z / t_2), (y * (x / t_2)));
double tmp;
if (t_5 <= -((double) INFINITY)) {
tmp = t_6;
} else if (t_5 <= -5e-207) {
tmp = t_4;
} else if (t_5 <= 1e-302) {
tmp = t_1;
} else if (t_5 <= 2e+303) {
tmp = t_4;
} else if (t_5 <= ((double) INFINITY)) {
tmp = t_6;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(fma(Float64(x / z), y, Float64(t - a)) / Float64(b - y)) - Float64(Float64(y / (Float64(b - y) ^ 2.0)) * Float64(Float64(t - a) / z))) t_2 = fma(Float64(b - y), z, y) t_3 = Float64(z * Float64(t - a)) t_4 = Float64(fma(x, y, t_3) / t_2) t_5 = Float64(Float64(Float64(x * y) + t_3) / Float64(y + Float64(z * Float64(b - y)))) t_6 = fma(Float64(t - a), Float64(z / t_2), Float64(y * Float64(x / t_2))) tmp = 0.0 if (t_5 <= Float64(-Inf)) tmp = t_6; elseif (t_5 <= -5e-207) tmp = t_4; elseif (t_5 <= 1e-302) tmp = t_1; elseif (t_5 <= 2e+303) tmp = t_4; elseif (t_5 <= Inf) tmp = t_6; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(x / z), $MachinePrecision] * y + N[(t - a), $MachinePrecision]), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision] - N[(N[(y / N[Power[N[(b - y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(t - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$3 = N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(x * y + t$95$3), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(x * y), $MachinePrecision] + t$95$3), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(t - a), $MachinePrecision] * N[(z / t$95$2), $MachinePrecision] + N[(y * N[(x / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, (-Infinity)], t$95$6, If[LessEqual[t$95$5, -5e-207], t$95$4, If[LessEqual[t$95$5, 1e-302], t$95$1, If[LessEqual[t$95$5, 2e+303], t$95$4, If[LessEqual[t$95$5, Infinity], t$95$6, t$95$1]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(\frac{x}{z}, y, t - a\right)}{b - y} - \frac{y}{{\left(b - y\right)}^{2}} \cdot \frac{t - a}{z}\\
t_2 := \mathsf{fma}\left(b - y, z, y\right)\\
t_3 := z \cdot \left(t - a\right)\\
t_4 := \frac{\mathsf{fma}\left(x, y, t\_3\right)}{t\_2}\\
t_5 := \frac{x \cdot y + t\_3}{y + z \cdot \left(b - y\right)}\\
t_6 := \mathsf{fma}\left(t - a, \frac{z}{t\_2}, y \cdot \frac{x}{t\_2}\right)\\
\mathbf{if}\;t\_5 \leq -\infty:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq -5 \cdot 10^{-207}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_5 \leq 10^{-302}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_5 \leq 2 \cdot 10^{+303}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;t\_6\\
\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 2e303 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 22.3%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6497.7
Applied rewrites97.7%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -5.00000000000000014e-207 or 9.9999999999999996e-303 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2e303Initial program 99.4%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6486.5
Applied rewrites86.5%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
Applied rewrites99.5%
if -5.00000000000000014e-207 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.9999999999999996e-303 or +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 12.3%
Taylor expanded in z around inf
associate--r+N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
times-fracN/A
associate-*r/N/A
div-subN/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
Applied rewrites95.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y)))
(t_2 (fma (- b y) z y))
(t_3 (* z (- t a)))
(t_4 (/ (fma x y t_3) t_2))
(t_5 (/ (+ (* x y) t_3) (+ y (* z (- b y)))))
(t_6 (fma (- t a) (/ z t_2) (* y (/ x t_2)))))
(if (<= t_5 (- INFINITY))
t_6
(if (<= t_5 -5e-207)
t_4
(if (<= t_5 1e-302)
t_1
(if (<= t_5 2e+303) t_4 (if (<= t_5 INFINITY) t_6 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 = fma((b - y), z, y);
double t_3 = z * (t - a);
double t_4 = fma(x, y, t_3) / t_2;
double t_5 = ((x * y) + t_3) / (y + (z * (b - y)));
double t_6 = fma((t - a), (z / t_2), (y * (x / t_2)));
double tmp;
if (t_5 <= -((double) INFINITY)) {
tmp = t_6;
} else if (t_5 <= -5e-207) {
tmp = t_4;
} else if (t_5 <= 1e-302) {
tmp = t_1;
} else if (t_5 <= 2e+303) {
tmp = t_4;
} else if (t_5 <= ((double) INFINITY)) {
tmp = t_6;
} 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 = fma(Float64(b - y), z, y) t_3 = Float64(z * Float64(t - a)) t_4 = Float64(fma(x, y, t_3) / t_2) t_5 = Float64(Float64(Float64(x * y) + t_3) / Float64(y + Float64(z * Float64(b - y)))) t_6 = fma(Float64(t - a), Float64(z / t_2), Float64(y * Float64(x / t_2))) tmp = 0.0 if (t_5 <= Float64(-Inf)) tmp = t_6; elseif (t_5 <= -5e-207) tmp = t_4; elseif (t_5 <= 1e-302) tmp = t_1; elseif (t_5 <= 2e+303) tmp = t_4; elseif (t_5 <= Inf) tmp = t_6; 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[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$3 = N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(x * y + t$95$3), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(x * y), $MachinePrecision] + t$95$3), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(t - a), $MachinePrecision] * N[(z / t$95$2), $MachinePrecision] + N[(y * N[(x / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, (-Infinity)], t$95$6, If[LessEqual[t$95$5, -5e-207], t$95$4, If[LessEqual[t$95$5, 1e-302], t$95$1, If[LessEqual[t$95$5, 2e+303], t$95$4, If[LessEqual[t$95$5, Infinity], t$95$6, t$95$1]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
t_2 := \mathsf{fma}\left(b - y, z, y\right)\\
t_3 := z \cdot \left(t - a\right)\\
t_4 := \frac{\mathsf{fma}\left(x, y, t\_3\right)}{t\_2}\\
t_5 := \frac{x \cdot y + t\_3}{y + z \cdot \left(b - y\right)}\\
t_6 := \mathsf{fma}\left(t - a, \frac{z}{t\_2}, y \cdot \frac{x}{t\_2}\right)\\
\mathbf{if}\;t\_5 \leq -\infty:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq -5 \cdot 10^{-207}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_5 \leq 10^{-302}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_5 \leq 2 \cdot 10^{+303}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;t\_6\\
\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 2e303 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 22.3%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6497.7
Applied rewrites97.7%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -5.00000000000000014e-207 or 9.9999999999999996e-303 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2e303Initial program 99.4%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6486.5
Applied rewrites86.5%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
Applied rewrites99.5%
if -5.00000000000000014e-207 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.9999999999999996e-303 or +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 12.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6477.8
Applied rewrites77.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -6.6e+74) (not (<= z 3.3e+65))) (/ (- t a) (- b y)) (/ (fma x y (* z (- t a))) (fma (- b y) z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -6.6e+74) || !(z <= 3.3e+65)) {
tmp = (t - a) / (b - y);
} else {
tmp = fma(x, y, (z * (t - a))) / fma((b - y), z, y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -6.6e+74) || !(z <= 3.3e+65)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(fma(x, y, Float64(z * Float64(t - a))) / fma(Float64(b - y), z, y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -6.6e+74], N[Not[LessEqual[z, 3.3e+65]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+74} \lor \neg \left(z \leq 3.3 \cdot 10^{+65}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\end{array}
\end{array}
if z < -6.6000000000000004e74 or 3.30000000000000023e65 < z Initial program 31.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6484.4
Applied rewrites84.4%
if -6.6000000000000004e74 < z < 3.30000000000000023e65Initial program 85.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6485.1
Applied rewrites85.1%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
Applied rewrites85.2%
Final simplification84.9%
(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 -2.7e+14)
t_2
(if (<= z 1.7e-155)
(* (/ y t_1) x)
(if (<= z 3200000000.0) (/ (* 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 <= -2.7e+14) {
tmp = t_2;
} else if (z <= 1.7e-155) {
tmp = (y / t_1) * x;
} else if (z <= 3200000000.0) {
tmp = (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 <= -2.7e+14) tmp = t_2; elseif (z <= 1.7e-155) tmp = Float64(Float64(y / t_1) * x); elseif (z <= 3200000000.0) tmp = 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, -2.7e+14], t$95$2, If[LessEqual[z, 1.7e-155], N[(N[(y / t$95$1), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 3200000000.0], N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / t$95$1), $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 -2.7 \cdot 10^{+14}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-155}:\\
\;\;\;\;\frac{y}{t\_1} \cdot x\\
\mathbf{elif}\;z \leq 3200000000:\\
\;\;\;\;\frac{z \cdot \left(t - a\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -2.7e14 or 3.2e9 < z Initial program 37.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6480.3
Applied rewrites80.3%
if -2.7e14 < z < 1.7e-155Initial program 87.1%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6461.9
Applied rewrites61.9%
if 1.7e-155 < z < 3.2e9Initial program 92.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.3
Applied rewrites65.3%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f64N/A
Applied rewrites65.3%
(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 -2.7e+14)
t_2
(if (<= z 1.7e-155)
(* (/ y t_1) x)
(if (<= z 55000000000.0) (* (- t a) (/ z 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 <= -2.7e+14) {
tmp = t_2;
} else if (z <= 1.7e-155) {
tmp = (y / t_1) * x;
} else if (z <= 55000000000.0) {
tmp = (t - a) * (z / 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 <= -2.7e+14) tmp = t_2; elseif (z <= 1.7e-155) tmp = Float64(Float64(y / t_1) * x); elseif (z <= 55000000000.0) tmp = Float64(Float64(t - a) * Float64(z / 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, -2.7e+14], t$95$2, If[LessEqual[z, 1.7e-155], N[(N[(y / t$95$1), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 55000000000.0], N[(N[(t - a), $MachinePrecision] * N[(z / 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 -2.7 \cdot 10^{+14}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-155}:\\
\;\;\;\;\frac{y}{t\_1} \cdot x\\
\mathbf{elif}\;z \leq 55000000000:\\
\;\;\;\;\left(t - a\right) \cdot \frac{z}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -2.7e14 or 5.5e10 < z Initial program 37.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6480.3
Applied rewrites80.3%
if -2.7e14 < z < 1.7e-155Initial program 87.1%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6461.9
Applied rewrites61.9%
if 1.7e-155 < z < 5.5e10Initial program 92.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6465.0
Applied rewrites65.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.75e+14) (not (<= z 450000000000.0))) (/ (- t a) (- b y)) (/ (fma t z (* y x)) (fma (- b y) z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.75e+14) || !(z <= 450000000000.0)) {
tmp = (t - a) / (b - y);
} else {
tmp = fma(t, z, (y * x)) / fma((b - y), z, y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.75e+14) || !(z <= 450000000000.0)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(fma(t, z, Float64(y * x)) / fma(Float64(b - y), z, y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.75e+14], N[Not[LessEqual[z, 450000000000.0]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{+14} \lor \neg \left(z \leq 450000000000\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\end{array}
\end{array}
if z < -2.75e14 or 4.5e11 < z Initial program 37.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6480.3
Applied rewrites80.3%
if -2.75e14 < z < 4.5e11Initial program 88.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6473.7
Applied rewrites73.7%
Final simplification77.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a) b)))
(if (<= z -1.35e-42)
t_1
(if (<= z 2.8e-141)
(* 1.0 x)
(if (<= z 5.6e+25) (/ t b) (if (<= z 7.8e+189) (/ x (- z)) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -a / b;
double tmp;
if (z <= -1.35e-42) {
tmp = t_1;
} else if (z <= 2.8e-141) {
tmp = 1.0 * x;
} else if (z <= 5.6e+25) {
tmp = t / b;
} else if (z <= 7.8e+189) {
tmp = 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 = -a / b
if (z <= (-1.35d-42)) then
tmp = t_1
else if (z <= 2.8d-141) then
tmp = 1.0d0 * x
else if (z <= 5.6d+25) then
tmp = t / b
else if (z <= 7.8d+189) then
tmp = 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 = -a / b;
double tmp;
if (z <= -1.35e-42) {
tmp = t_1;
} else if (z <= 2.8e-141) {
tmp = 1.0 * x;
} else if (z <= 5.6e+25) {
tmp = t / b;
} else if (z <= 7.8e+189) {
tmp = x / -z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -a / b tmp = 0 if z <= -1.35e-42: tmp = t_1 elif z <= 2.8e-141: tmp = 1.0 * x elif z <= 5.6e+25: tmp = t / b elif z <= 7.8e+189: tmp = x / -z else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-a) / b) tmp = 0.0 if (z <= -1.35e-42) tmp = t_1; elseif (z <= 2.8e-141) tmp = Float64(1.0 * x); elseif (z <= 5.6e+25) tmp = Float64(t / b); elseif (z <= 7.8e+189) tmp = Float64(x / Float64(-z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -a / b; tmp = 0.0; if (z <= -1.35e-42) tmp = t_1; elseif (z <= 2.8e-141) tmp = 1.0 * x; elseif (z <= 5.6e+25) tmp = t / b; elseif (z <= 7.8e+189) tmp = x / -z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-a) / b), $MachinePrecision]}, If[LessEqual[z, -1.35e-42], t$95$1, If[LessEqual[z, 2.8e-141], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 5.6e+25], N[(t / b), $MachinePrecision], If[LessEqual[z, 7.8e+189], N[(x / (-z)), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-a}{b}\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-141}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+25}:\\
\;\;\;\;\frac{t}{b}\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+189}:\\
\;\;\;\;\frac{x}{-z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.35e-42 or 7.7999999999999999e189 < z Initial program 40.1%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6451.2
Applied rewrites51.2%
Taylor expanded in t around 0
Applied rewrites35.4%
if -1.35e-42 < z < 2.80000000000000012e-141Initial program 87.4%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6461.0
Applied rewrites61.0%
Taylor expanded in z around 0
Applied rewrites50.8%
if 2.80000000000000012e-141 < z < 5.6000000000000003e25Initial program 91.8%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6447.3
Applied rewrites47.3%
Taylor expanded in y around 0
Applied rewrites40.2%
if 5.6000000000000003e25 < z < 7.7999999999999999e189Initial program 38.6%
Taylor expanded in y around inf
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6438.4
Applied rewrites38.4%
Taylor expanded in z around inf
Applied rewrites38.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -4.4e-42)
(/ t b)
(if (<= z 2.8e-141)
(* 1.0 x)
(if (<= z 5.6e+25) (/ t b) (if (<= z 3e+175) (/ x (- z)) (/ t (- y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.4e-42) {
tmp = t / b;
} else if (z <= 2.8e-141) {
tmp = 1.0 * x;
} else if (z <= 5.6e+25) {
tmp = t / b;
} else if (z <= 3e+175) {
tmp = x / -z;
} else {
tmp = t / -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 <= (-4.4d-42)) then
tmp = t / b
else if (z <= 2.8d-141) then
tmp = 1.0d0 * x
else if (z <= 5.6d+25) then
tmp = t / b
else if (z <= 3d+175) then
tmp = x / -z
else
tmp = t / -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 <= -4.4e-42) {
tmp = t / b;
} else if (z <= 2.8e-141) {
tmp = 1.0 * x;
} else if (z <= 5.6e+25) {
tmp = t / b;
} else if (z <= 3e+175) {
tmp = x / -z;
} else {
tmp = t / -y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -4.4e-42: tmp = t / b elif z <= 2.8e-141: tmp = 1.0 * x elif z <= 5.6e+25: tmp = t / b elif z <= 3e+175: tmp = x / -z else: tmp = t / -y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -4.4e-42) tmp = Float64(t / b); elseif (z <= 2.8e-141) tmp = Float64(1.0 * x); elseif (z <= 5.6e+25) tmp = Float64(t / b); elseif (z <= 3e+175) tmp = Float64(x / Float64(-z)); else tmp = Float64(t / Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -4.4e-42) tmp = t / b; elseif (z <= 2.8e-141) tmp = 1.0 * x; elseif (z <= 5.6e+25) tmp = t / b; elseif (z <= 3e+175) tmp = x / -z; else tmp = t / -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.4e-42], N[(t / b), $MachinePrecision], If[LessEqual[z, 2.8e-141], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 5.6e+25], N[(t / b), $MachinePrecision], If[LessEqual[z, 3e+175], N[(x / (-z)), $MachinePrecision], N[(t / (-y)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{-42}:\\
\;\;\;\;\frac{t}{b}\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-141}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+25}:\\
\;\;\;\;\frac{t}{b}\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+175}:\\
\;\;\;\;\frac{x}{-z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{-y}\\
\end{array}
\end{array}
if z < -4.4000000000000001e-42 or 2.80000000000000012e-141 < z < 5.6000000000000003e25Initial program 58.9%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6433.3
Applied rewrites33.3%
Taylor expanded in y around 0
Applied rewrites29.7%
if -4.4000000000000001e-42 < z < 2.80000000000000012e-141Initial program 87.4%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6461.0
Applied rewrites61.0%
Taylor expanded in z around 0
Applied rewrites50.8%
if 5.6000000000000003e25 < z < 3.0000000000000002e175Initial program 36.2%
Taylor expanded in y around inf
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6438.7
Applied rewrites38.7%
Taylor expanded in z around inf
Applied rewrites38.7%
if 3.0000000000000002e175 < z Initial program 24.1%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6413.6
Applied rewrites13.6%
Taylor expanded in z around inf
Applied rewrites42.7%
Taylor expanded in y around inf
Applied rewrites29.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.7e+14) (not (<= z 9e-102))) (/ (- t a) (- b y)) (* (/ y (fma (- b y) z y)) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.7e+14) || !(z <= 9e-102)) {
tmp = (t - a) / (b - y);
} else {
tmp = (y / fma((b - y), z, y)) * x;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.7e+14) || !(z <= 9e-102)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(Float64(y / fma(Float64(b - y), z, y)) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.7e+14], N[Not[LessEqual[z, 9e-102]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+14} \lor \neg \left(z \leq 9 \cdot 10^{-102}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(b - y, z, y\right)} \cdot x\\
\end{array}
\end{array}
if z < -2.7e14 or 8.99999999999999999e-102 < z Initial program 43.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6477.2
Applied rewrites77.2%
if -2.7e14 < z < 8.99999999999999999e-102Initial program 87.3%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6459.7
Applied rewrites59.7%
Final simplification69.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -8.5e-43) (not (<= z 3.6e-160))) (/ (- t a) (- b y)) (* 1.0 x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -8.5e-43) || !(z <= 3.6e-160)) {
tmp = (t - a) / (b - y);
} else {
tmp = 1.0 * 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.5d-43)) .or. (.not. (z <= 3.6d-160))) then
tmp = (t - a) / (b - y)
else
tmp = 1.0d0 * 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.5e-43) || !(z <= 3.6e-160)) {
tmp = (t - a) / (b - y);
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -8.5e-43) or not (z <= 3.6e-160): tmp = (t - a) / (b - y) else: tmp = 1.0 * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -8.5e-43) || !(z <= 3.6e-160)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -8.5e-43) || ~((z <= 3.6e-160))) tmp = (t - a) / (b - y); else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -8.5e-43], N[Not[LessEqual[z, 3.6e-160]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-43} \lor \neg \left(z \leq 3.6 \cdot 10^{-160}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -8.50000000000000056e-43 or 3.5999999999999997e-160 < z Initial program 48.7%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6473.2
Applied rewrites73.2%
if -8.50000000000000056e-43 < z < 3.5999999999999997e-160Initial program 86.9%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites51.7%
Final simplification65.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.05e-17) (not (<= y 4.8e+52))) (/ x (- 1.0 z)) (/ (- t a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.05e-17) || !(y <= 4.8e+52)) {
tmp = x / (1.0 - z);
} 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 <= (-2.05d-17)) .or. (.not. (y <= 4.8d+52))) then
tmp = x / (1.0d0 - z)
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 <= -2.05e-17) || !(y <= 4.8e+52)) {
tmp = x / (1.0 - z);
} else {
tmp = (t - a) / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.05e-17) or not (y <= 4.8e+52): tmp = x / (1.0 - z) else: tmp = (t - a) / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.05e-17) || !(y <= 4.8e+52)) tmp = Float64(x / Float64(1.0 - z)); 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 <= -2.05e-17) || ~((y <= 4.8e+52))) tmp = x / (1.0 - z); else tmp = (t - a) / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.05e-17], N[Not[LessEqual[y, 4.8e+52]], $MachinePrecision]], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{-17} \lor \neg \left(y \leq 4.8 \cdot 10^{+52}\right):\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t - a}{b}\\
\end{array}
\end{array}
if y < -2.05e-17 or 4.8e52 < y Initial program 51.7%
Taylor expanded in y around inf
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6453.0
Applied rewrites53.0%
if -2.05e-17 < y < 4.8e52Initial program 73.1%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6461.2
Applied rewrites61.2%
Final simplification57.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -5.8e-18) (not (<= y 1.65e+49))) (/ x (- 1.0 z)) (/ t (- b y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -5.8e-18) || !(y <= 1.65e+49)) {
tmp = x / (1.0 - z);
} else {
tmp = t / (b - 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 ((y <= (-5.8d-18)) .or. (.not. (y <= 1.65d+49))) then
tmp = x / (1.0d0 - z)
else
tmp = t / (b - 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 ((y <= -5.8e-18) || !(y <= 1.65e+49)) {
tmp = x / (1.0 - z);
} else {
tmp = t / (b - y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -5.8e-18) or not (y <= 1.65e+49): tmp = x / (1.0 - z) else: tmp = t / (b - y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -5.8e-18) || !(y <= 1.65e+49)) tmp = Float64(x / Float64(1.0 - z)); else tmp = Float64(t / Float64(b - y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -5.8e-18) || ~((y <= 1.65e+49))) tmp = x / (1.0 - z); else tmp = t / (b - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -5.8e-18], N[Not[LessEqual[y, 1.65e+49]], $MachinePrecision]], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{-18} \lor \neg \left(y \leq 1.65 \cdot 10^{+49}\right):\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{b - y}\\
\end{array}
\end{array}
if y < -5.8e-18 or 1.6499999999999999e49 < y Initial program 52.0%
Taylor expanded in y around inf
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6452.6
Applied rewrites52.6%
if -5.8e-18 < y < 1.6499999999999999e49Initial program 72.9%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6439.6
Applied rewrites39.6%
Taylor expanded in z around inf
Applied rewrites38.8%
Final simplification45.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.1e-42) (not (<= z 2.8e-141))) (/ t (- b y)) (* 1.0 x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.1e-42) || !(z <= 2.8e-141)) {
tmp = t / (b - y);
} else {
tmp = 1.0 * 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 <= (-1.1d-42)) .or. (.not. (z <= 2.8d-141))) then
tmp = t / (b - y)
else
tmp = 1.0d0 * 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 <= -1.1e-42) || !(z <= 2.8e-141)) {
tmp = t / (b - y);
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.1e-42) or not (z <= 2.8e-141): tmp = t / (b - y) else: tmp = 1.0 * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.1e-42) || !(z <= 2.8e-141)) tmp = Float64(t / Float64(b - y)); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -1.1e-42) || ~((z <= 2.8e-141))) tmp = t / (b - y); else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.1e-42], N[Not[LessEqual[z, 2.8e-141]], $MachinePrecision]], N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{-42} \lor \neg \left(z \leq 2.8 \cdot 10^{-141}\right):\\
\;\;\;\;\frac{t}{b - y}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -1.10000000000000003e-42 or 2.80000000000000012e-141 < z Initial program 47.5%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6426.2
Applied rewrites26.2%
Taylor expanded in z around inf
Applied rewrites36.9%
if -1.10000000000000003e-42 < z < 2.80000000000000012e-141Initial program 87.4%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6461.0
Applied rewrites61.0%
Taylor expanded in z around 0
Applied rewrites50.8%
Final simplification42.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.08e-17) (not (<= y 1.65e+49))) (* 1.0 x) (/ t b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.08e-17) || !(y <= 1.65e+49)) {
tmp = 1.0 * x;
} 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 ((y <= (-1.08d-17)) .or. (.not. (y <= 1.65d+49))) then
tmp = 1.0d0 * x
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 ((y <= -1.08e-17) || !(y <= 1.65e+49)) {
tmp = 1.0 * x;
} else {
tmp = t / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.08e-17) or not (y <= 1.65e+49): tmp = 1.0 * x else: tmp = t / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.08e-17) || !(y <= 1.65e+49)) tmp = Float64(1.0 * x); else tmp = Float64(t / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.08e-17) || ~((y <= 1.65e+49))) tmp = 1.0 * x; else tmp = t / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.08e-17], N[Not[LessEqual[y, 1.65e+49]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(t / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.08 \cdot 10^{-17} \lor \neg \left(y \leq 1.65 \cdot 10^{+49}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{b}\\
\end{array}
\end{array}
if y < -1.07999999999999995e-17 or 1.6499999999999999e49 < y Initial program 52.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6445.4
Applied rewrites45.4%
Taylor expanded in z around 0
Applied rewrites34.7%
if -1.07999999999999995e-17 < y < 1.6499999999999999e49Initial program 72.9%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6439.6
Applied rewrites39.6%
Taylor expanded in y around 0
Applied rewrites34.7%
Final simplification34.7%
(FPCore (x y z t a b) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t, double a, double b) {
return 1.0 * 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 = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return 1.0 * x;
}
def code(x, y, z, t, a, b): return 1.0 * x
function code(x, y, z, t, a, b) return Float64(1.0 * x) end
function tmp = code(x, y, z, t, a, b) tmp = 1.0 * x; end
code[x_, y_, z_, t_, a_, b_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 62.3%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6435.0
Applied rewrites35.0%
Taylor expanded in z around 0
Applied rewrites22.7%
(FPCore (x y z t a b) :precision binary64 (* z x))
double code(double x, double y, double z, double t, double a, double b) {
return z * 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 = z * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return z * x;
}
def code(x, y, z, t, a, b): return z * x
function code(x, y, z, t, a, b) return Float64(z * x) end
function tmp = code(x, y, z, t, a, b) tmp = z * x; end
code[x_, y_, z_, t_, a_, b_] := N[(z * x), $MachinePrecision]
\begin{array}{l}
\\
z \cdot x
\end{array}
Initial program 62.3%
Taylor expanded in y around inf
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f6432.8
Applied rewrites32.8%
Taylor expanded in z around 0
Applied rewrites22.3%
Taylor expanded in z around inf
Applied rewrites3.5%
(FPCore (x y z t a b) :precision binary64 (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z)))))
double code(double x, double y, double z, double t, double a, double b) {
return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 = (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)));
}
def code(x, y, z, t, a, b): return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(z * t) + Float64(y * x)) / Float64(y + Float64(z * Float64(b - y)))) - Float64(a / Float64(Float64(b - y) + Float64(y / z)))) end
function tmp = code(x, y, z, t, a, b) tmp = (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(z * t), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(N[(b - y), $MachinePrecision] + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{z \cdot t + y \cdot x}{y + z \cdot \left(b - y\right)} - \frac{a}{\left(b - y\right) + \frac{y}{z}}
\end{array}
herbie shell --seed 2024359
(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)))))