
(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]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
Herbie found 15 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]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* x y) (* z (- t a))))
(t_2 (/ t_1 (fma z b (fma (- y) z y))))
(t_3 (/ (- t a) (- b y)))
(t_4 (/ t_1 (+ y (* z (- b y)))))
(t_5 (fma (/ -1.0 (- z 1.0)) x t_3)))
(if (<= t_4 (- INFINITY))
t_5
(if (<= t_4 -1e-292)
t_2
(if (<= t_4 0.0) t_3 (if (<= t_4 1e+224) t_2 t_5))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * y) + (z * (t - a));
double t_2 = t_1 / fma(z, b, fma(-y, z, y));
double t_3 = (t - a) / (b - y);
double t_4 = t_1 / (y + (z * (b - y)));
double t_5 = fma((-1.0 / (z - 1.0)), x, t_3);
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = t_5;
} else if (t_4 <= -1e-292) {
tmp = t_2;
} else if (t_4 <= 0.0) {
tmp = t_3;
} else if (t_4 <= 1e+224) {
tmp = t_2;
} else {
tmp = t_5;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * y) + Float64(z * Float64(t - a))) t_2 = Float64(t_1 / fma(z, b, fma(Float64(-y), z, y))) t_3 = Float64(Float64(t - a) / Float64(b - y)) t_4 = Float64(t_1 / Float64(y + Float64(z * Float64(b - y)))) t_5 = fma(Float64(-1.0 / Float64(z - 1.0)), x, t_3) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = t_5; elseif (t_4 <= -1e-292) tmp = t_2; elseif (t_4 <= 0.0) tmp = t_3; elseif (t_4 <= 1e+224) tmp = t_2; else tmp = t_5; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(z * b + N[((-y) * z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(-1.0 / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * x + t$95$3), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$5, If[LessEqual[t$95$4, -1e-292], t$95$2, If[LessEqual[t$95$4, 0.0], t$95$3, If[LessEqual[t$95$4, 1e+224], t$95$2, t$95$5]]]]]]]]]
\begin{array}{l}
t_1 := x \cdot y + z \cdot \left(t - a\right)\\
t_2 := \frac{t\_1}{\mathsf{fma}\left(z, b, \mathsf{fma}\left(-y, z, y\right)\right)}\\
t_3 := \frac{t - a}{b - y}\\
t_4 := \frac{t\_1}{y + z \cdot \left(b - y\right)}\\
t_5 := \mathsf{fma}\left(\frac{-1}{z - 1}, x, t\_3\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq -1 \cdot 10^{-292}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 10^{+224}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or 9.9999999999999997e223 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.4%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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
*-commutativeN/A
Applied rewrites79.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.5%
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6465.9%
Applied rewrites65.9%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.0000000000000001e-292 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.9999999999999997e223Initial program 66.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
distribute-lft-inN/A
associate-+l+N/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6466.4%
Applied rewrites66.4%
if -1.0000000000000001e-292 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0Initial program 66.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6451.5%
Applied rewrites51.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (* z (- b y))))
(t_2 (/ (- t a) (- b y)))
(t_3 (/ (+ (* x y) (* z (- t a))) t_1))
(t_4 (fma (/ -1.0 (- z 1.0)) x t_2)))
(if (<= t_3 (- INFINITY))
t_4
(if (<= t_3 -1e-292)
(/ (fma (- t a) z (* y x)) (fma (- b y) z y))
(if (<= t_3 0.0)
t_2
(if (<= t_3 1e+224) (/ (fma y x (* (- t a) z)) t_1) t_4))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (z * (b - y));
double t_2 = (t - a) / (b - y);
double t_3 = ((x * y) + (z * (t - a))) / t_1;
double t_4 = fma((-1.0 / (z - 1.0)), x, t_2);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_3 <= -1e-292) {
tmp = fma((t - a), z, (y * x)) / fma((b - y), z, y);
} else if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_3 <= 1e+224) {
tmp = fma(y, x, ((t - a) * z)) / t_1;
} else {
tmp = t_4;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(z * Float64(b - y))) t_2 = Float64(Float64(t - a) / Float64(b - y)) t_3 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / t_1) t_4 = fma(Float64(-1.0 / Float64(z - 1.0)), x, t_2) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_4; elseif (t_3 <= -1e-292) tmp = Float64(fma(Float64(t - a), z, Float64(y * x)) / fma(Float64(b - y), z, y)); elseif (t_3 <= 0.0) tmp = t_2; elseif (t_3 <= 1e+224) tmp = Float64(fma(y, x, Float64(Float64(t - a) * z)) / t_1); else tmp = t_4; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $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] / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(-1.0 / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * x + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, -1e-292], N[(N[(N[(t - a), $MachinePrecision] * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], t$95$2, If[LessEqual[t$95$3, 1e+224], N[(N[(y * x + N[(N[(t - a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$4]]]]]]]]
\begin{array}{l}
t_1 := y + z \cdot \left(b - y\right)\\
t_2 := \frac{t - a}{b - y}\\
t_3 := \frac{x \cdot y + z \cdot \left(t - a\right)}{t\_1}\\
t_4 := \mathsf{fma}\left(\frac{-1}{z - 1}, x, t\_2\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-292}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t - a, z, y \cdot x\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 10^{+224}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or 9.9999999999999997e223 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.4%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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
*-commutativeN/A
Applied rewrites79.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.5%
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6465.9%
Applied rewrites65.9%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.0000000000000001e-292Initial program 66.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6466.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6466.4%
Applied rewrites66.4%
if -1.0000000000000001e-292 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0Initial program 66.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6451.5%
Applied rewrites51.5%
if 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.9999999999999997e223Initial program 66.4%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6466.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
Applied rewrites66.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (fma (- t a) z (* y x)) (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 (/ -1.0 (- z 1.0)) x t_2)))
(if (<= t_3 (- INFINITY))
t_4
(if (<= t_3 -1e-292)
t_1
(if (<= t_3 0.0) t_2 (if (<= t_3 1e+224) t_1 t_4))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((t - a), z, (y * x)) / 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((-1.0 / (z - 1.0)), x, t_2);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_3 <= -1e-292) {
tmp = t_1;
} else if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_3 <= 1e+224) {
tmp = t_1;
} else {
tmp = t_4;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(Float64(t - a), z, Float64(y * x)) / 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(Float64(-1.0 / Float64(z - 1.0)), x, t_2) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_4; elseif (t_3 <= -1e-292) tmp = t_1; elseif (t_3 <= 0.0) tmp = t_2; elseif (t_3 <= 1e+224) tmp = t_1; else tmp = t_4; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t - a), $MachinePrecision] * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $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[(N[(-1.0 / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * x + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, -1e-292], t$95$1, If[LessEqual[t$95$3, 0.0], t$95$2, If[LessEqual[t$95$3, 1e+224], t$95$1, t$95$4]]]]]]]]
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(t - a, z, y \cdot x\right)}{\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(\frac{-1}{z - 1}, x, t\_2\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-292}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 10^{+224}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or 9.9999999999999997e223 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 66.4%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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
*-commutativeN/A
Applied rewrites79.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.5%
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6465.9%
Applied rewrites65.9%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.0000000000000001e-292 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.9999999999999997e223Initial program 66.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6466.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6466.4%
Applied rewrites66.4%
if -1.0000000000000001e-292 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0Initial program 66.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6451.5%
Applied rewrites51.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- b y) z y))
(t_2 (/ y t_1))
(t_3 (fma t_2 x (/ (- t a) (- b y)))))
(if (<= z -4.2e+36)
t_3
(if (<= z 8.5e-11) (fma t_2 x (* (/ z t_1) (- t a))) t_3))))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 = y / t_1;
double t_3 = fma(t_2, x, ((t - a) / (b - y)));
double tmp;
if (z <= -4.2e+36) {
tmp = t_3;
} else if (z <= 8.5e-11) {
tmp = fma(t_2, x, ((z / t_1) * (t - a)));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(b - y), z, y) t_2 = Float64(y / t_1) t_3 = fma(t_2, x, Float64(Float64(t - a) / Float64(b - y))) tmp = 0.0 if (z <= -4.2e+36) tmp = t_3; elseif (z <= 8.5e-11) tmp = fma(t_2, x, Float64(Float64(z / t_1) * Float64(t - a))); else tmp = t_3; 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[(y / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * x + N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.2e+36], t$95$3, If[LessEqual[z, 8.5e-11], N[(t$95$2 * x + N[(N[(z / t$95$1), $MachinePrecision] * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(b - y, z, y\right)\\
t_2 := \frac{y}{t\_1}\\
t_3 := \mathsf{fma}\left(t\_2, x, \frac{t - a}{b - y}\right)\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{+36}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, x, \frac{z}{t\_1} \cdot \left(t - a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if z < -4.2000000000000001e36 or 8.5000000000000004e-11 < z Initial program 66.4%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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
*-commutativeN/A
Applied rewrites79.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.5%
Applied rewrites76.5%
if -4.2000000000000001e36 < z < 8.5000000000000004e-11Initial program 66.4%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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
*-commutativeN/A
Applied rewrites79.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -1.32e-8)
(fma (/ -1.0 (- z 1.0)) x t_1)
(if (<= z 4.8e-7) (/ (+ (* x y) (* z (- t a))) (+ y (* z b))) t_1))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -1.32e-8) {
tmp = fma((-1.0 / (z - 1.0)), x, t_1);
} else if (z <= 4.8e-7) {
tmp = ((x * y) + (z * (t - a))) / (y + (z * b));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -1.32e-8) tmp = fma(Float64(-1.0 / Float64(z - 1.0)), x, t_1); elseif (z <= 4.8e-7) tmp = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * b))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.32e-8], N[(N[(-1.0 / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * x + t$95$1), $MachinePrecision], If[LessEqual[z, 4.8e-7], N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -1.32 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{z - 1}, x, t\_1\right)\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-7}:\\
\;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1.3200000000000001e-8Initial program 66.4%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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
*-commutativeN/A
Applied rewrites79.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.5%
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6465.9%
Applied rewrites65.9%
if -1.3200000000000001e-8 < z < 4.7999999999999996e-7Initial program 66.4%
Taylor expanded in y around 0
Applied rewrites57.2%
if 4.7999999999999996e-7 < z Initial program 66.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6451.5%
Applied rewrites51.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -6.5e-42)
(fma (/ -1.0 (- z 1.0)) x t_1)
(if (<= z 1.15e-8) (/ (fma t z (* x y)) (fma (- b y) z y)) t_1))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -6.5e-42) {
tmp = fma((-1.0 / (z - 1.0)), x, t_1);
} else if (z <= 1.15e-8) {
tmp = fma(t, z, (x * y)) / fma((b - y), z, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -6.5e-42) tmp = fma(Float64(-1.0 / Float64(z - 1.0)), x, t_1); elseif (z <= 1.15e-8) tmp = Float64(fma(t, z, Float64(x * y)) / fma(Float64(b - y), z, y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.5e-42], N[(N[(-1.0 / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * x + t$95$1), $MachinePrecision], If[LessEqual[z, 1.15e-8], N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{-42}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{z - 1}, x, t\_1\right)\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-8}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, x \cdot y\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -6.4999999999999998e-42Initial program 66.4%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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
*-commutativeN/A
Applied rewrites79.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.5%
Applied rewrites76.5%
Taylor expanded in y around -inf
lower-/.f64N/A
lower--.f6465.9%
Applied rewrites65.9%
if -6.4999999999999998e-42 < z < 1.15e-8Initial program 66.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6466.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6466.4%
Applied rewrites66.4%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6447.7%
Applied rewrites47.7%
if 1.15e-8 < z Initial program 66.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6451.5%
Applied rewrites51.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -6.5e-42)
t_1
(if (<= z 1.15e-8) (/ (fma t z (* x y)) (fma (- b y) z y)) t_1))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -6.5e-42) {
tmp = t_1;
} else if (z <= 1.15e-8) {
tmp = fma(t, z, (x * y)) / fma((b - y), z, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -6.5e-42) tmp = t_1; elseif (z <= 1.15e-8) tmp = Float64(fma(t, z, Float64(x * y)) / fma(Float64(b - y), z, y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.5e-42], t$95$1, If[LessEqual[z, 1.15e-8], N[(N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-8}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, x \cdot y\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -6.4999999999999998e-42 or 1.15e-8 < z Initial program 66.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6451.5%
Applied rewrites51.5%
if -6.4999999999999998e-42 < z < 1.15e-8Initial program 66.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6466.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6466.4%
Applied rewrites66.4%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6447.7%
Applied rewrites47.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -6.5e-42)
t_1
(if (<= z 1.15e-8) (* (/ y (fma z (- b y) 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 <= -6.5e-42) {
tmp = t_1;
} else if (z <= 1.15e-8) {
tmp = (y / fma(z, (b - y), 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 <= -6.5e-42) tmp = t_1; elseif (z <= 1.15e-8) tmp = Float64(Float64(y / fma(z, Float64(b - y), 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, -6.5e-42], t$95$1, If[LessEqual[z, 1.15e-8], N[(N[(y / N[(z * N[(b - y), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-8}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(z, b - y, y\right)} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -6.4999999999999998e-42 or 1.15e-8 < z Initial program 66.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6451.5%
Applied rewrites51.5%
if -6.4999999999999998e-42 < z < 1.15e-8Initial program 66.4%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6428.6%
Applied rewrites28.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6436.4%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6436.4%
Applied rewrites36.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -8.2e-45) t_1 (if (<= z 1.05e-30) (fma (/ (- a) y) z x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -8.2e-45) {
tmp = t_1;
} else if (z <= 1.05e-30) {
tmp = fma((-a / y), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -8.2e-45) tmp = t_1; elseif (z <= 1.05e-30) tmp = fma(Float64(Float64(-a) / y), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.2e-45], t$95$1, If[LessEqual[z, 1.05e-30], N[(N[((-a) / y), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -8.2 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-a}{y}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -8.1999999999999998e-45 or 1.0500000000000001e-30 < z Initial program 66.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6451.5%
Applied rewrites51.5%
if -8.1999999999999998e-45 < z < 1.0500000000000001e-30Initial program 66.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6427.0%
Applied rewrites27.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6430.3%
Applied rewrites30.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6430.3%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift-neg.f64N/A
lower-/.f6430.3%
Applied rewrites30.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -3.8e-63) t_1 (if (<= z 1.05e-30) (+ x (* z (/ t y))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -3.8e-63) {
tmp = t_1;
} else if (z <= 1.05e-30) {
tmp = x + (z * (t / y));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (t - a) / (b - y)
if (z <= (-3.8d-63)) then
tmp = t_1
else if (z <= 1.05d-30) then
tmp = x + (z * (t / y))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -3.8e-63) {
tmp = t_1;
} else if (z <= 1.05e-30) {
tmp = x + (z * (t / y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -3.8e-63: tmp = t_1 elif z <= 1.05e-30: tmp = x + (z * (t / y)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -3.8e-63) tmp = t_1; elseif (z <= 1.05e-30) tmp = Float64(x + Float64(z * Float64(t / y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / (b - y); tmp = 0.0; if (z <= -3.8e-63) tmp = t_1; elseif (z <= 1.05e-30) tmp = x + (z * (t / y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.8e-63], t$95$1, If[LessEqual[z, 1.05e-30], N[(x + N[(z * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{-63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-30}:\\
\;\;\;\;x + z \cdot \frac{t}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -3.8000000000000002e-63 or 1.0500000000000001e-30 < z Initial program 66.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6451.5%
Applied rewrites51.5%
if -3.8000000000000002e-63 < z < 1.0500000000000001e-30Initial program 66.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6427.0%
Applied rewrites27.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6430.3%
Applied rewrites30.3%
Taylor expanded in t around inf
lower-/.f6430.5%
Applied rewrites30.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -5.4e-106) t_1 (if (<= z 1.05e-30) (+ x (* x z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -5.4e-106) {
tmp = t_1;
} else if (z <= 1.05e-30) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (t - a) / (b - y)
if (z <= (-5.4d-106)) then
tmp = t_1
else if (z <= 1.05d-30) then
tmp = x + (x * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -5.4e-106) {
tmp = t_1;
} else if (z <= 1.05e-30) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -5.4e-106: tmp = t_1 elif z <= 1.05e-30: tmp = x + (x * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -5.4e-106) tmp = t_1; elseif (z <= 1.05e-30) tmp = Float64(x + Float64(x * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / (b - y); tmp = 0.0; if (z <= -5.4e-106) tmp = t_1; elseif (z <= 1.05e-30) tmp = x + (x * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.4e-106], t$95$1, If[LessEqual[z, 1.05e-30], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{-106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-30}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -5.4000000000000004e-106 or 1.0500000000000001e-30 < z Initial program 66.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6451.5%
Applied rewrites51.5%
if -5.4000000000000004e-106 < z < 1.0500000000000001e-30Initial program 66.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6427.0%
Applied rewrites27.0%
Taylor expanded in y around inf
lower-*.f6425.4%
Applied rewrites25.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -5.4e-106)
t_1
(if (<= z 1.05e-30) (/ x (+ 1.0 (* -1.0 z))) t_1))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -5.4e-106) {
tmp = t_1;
} else if (z <= 1.05e-30) {
tmp = x / (1.0 + (-1.0 * z));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (t - a) / (b - y)
if (z <= (-5.4d-106)) then
tmp = t_1
else if (z <= 1.05d-30) then
tmp = x / (1.0d0 + ((-1.0d0) * z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -5.4e-106) {
tmp = t_1;
} else if (z <= 1.05e-30) {
tmp = x / (1.0 + (-1.0 * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -5.4e-106: tmp = t_1 elif z <= 1.05e-30: tmp = x / (1.0 + (-1.0 * z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -5.4e-106) tmp = t_1; elseif (z <= 1.05e-30) tmp = Float64(x / Float64(1.0 + Float64(-1.0 * z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / (b - y); tmp = 0.0; if (z <= -5.4e-106) tmp = t_1; elseif (z <= 1.05e-30) tmp = x / (1.0 + (-1.0 * z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.4e-106], t$95$1, If[LessEqual[z, 1.05e-30], N[(x / N[(1.0 + N[(-1.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{-106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-30}:\\
\;\;\;\;\frac{x}{1 + -1 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -5.4000000000000004e-106 or 1.0500000000000001e-30 < z Initial program 66.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6451.5%
Applied rewrites51.5%
if -5.4000000000000004e-106 < z < 1.0500000000000001e-30Initial program 66.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f6433.0%
Applied rewrites33.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) b))) (if (<= z -2.9e-53) t_1 (if (<= z 1.05e-30) (+ x (* x z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / b;
double tmp;
if (z <= -2.9e-53) {
tmp = t_1;
} else if (z <= 1.05e-30) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (t - a) / b
if (z <= (-2.9d-53)) then
tmp = t_1
else if (z <= 1.05d-30) then
tmp = x + (x * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / b;
double tmp;
if (z <= -2.9e-53) {
tmp = t_1;
} else if (z <= 1.05e-30) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / b tmp = 0 if z <= -2.9e-53: tmp = t_1 elif z <= 1.05e-30: tmp = x + (x * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / b) tmp = 0.0 if (z <= -2.9e-53) tmp = t_1; elseif (z <= 1.05e-30) tmp = Float64(x + Float64(x * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / b; tmp = 0.0; if (z <= -2.9e-53) tmp = t_1; elseif (z <= 1.05e-30) tmp = x + (x * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[z, -2.9e-53], t$95$1, If[LessEqual[z, 1.05e-30], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{t - a}{b}\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{-53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-30}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -2.8999999999999998e-53 or 1.0500000000000001e-30 < z Initial program 66.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6436.1%
Applied rewrites36.1%
if -2.8999999999999998e-53 < z < 1.0500000000000001e-30Initial program 66.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6427.0%
Applied rewrites27.0%
Taylor expanded in y around inf
lower-*.f6425.4%
Applied rewrites25.4%
(FPCore (x y z t a b) :precision binary64 (if (<= z -220.0) (/ t b) (if (<= z 1.85e-28) (+ x (* x z)) (/ t b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -220.0) {
tmp = t / b;
} else if (z <= 1.85e-28) {
tmp = x + (x * z);
} else {
tmp = t / b;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-220.0d0)) then
tmp = t / b
else if (z <= 1.85d-28) then
tmp = x + (x * z)
else
tmp = t / b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -220.0) {
tmp = t / b;
} else if (z <= 1.85e-28) {
tmp = x + (x * z);
} else {
tmp = t / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -220.0: tmp = t / b elif z <= 1.85e-28: tmp = x + (x * z) else: tmp = t / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -220.0) tmp = Float64(t / b); elseif (z <= 1.85e-28) tmp = Float64(x + Float64(x * z)); else tmp = Float64(t / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -220.0) tmp = t / b; elseif (z <= 1.85e-28) tmp = x + (x * z); else tmp = t / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -220.0], N[(t / b), $MachinePrecision], If[LessEqual[z, 1.85e-28], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], N[(t / b), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -220:\\
\;\;\;\;\frac{t}{b}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-28}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{b}\\
\end{array}
if z < -220 or 1.8500000000000001e-28 < z Initial program 66.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6436.1%
Applied rewrites36.1%
Taylor expanded in t around inf
lower-/.f6420.7%
Applied rewrites20.7%
if -220 < z < 1.8500000000000001e-28Initial program 66.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6427.0%
Applied rewrites27.0%
Taylor expanded in y around inf
lower-*.f6425.4%
Applied rewrites25.4%
(FPCore (x y z t a b) :precision binary64 (/ t b))
double code(double x, double y, double z, double t, double a, double b) {
return t / b;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = t / b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return t / b;
}
def code(x, y, z, t, a, b): return t / b
function code(x, y, z, t, a, b) return Float64(t / b) end
function tmp = code(x, y, z, t, a, b) tmp = t / b; end
code[x_, y_, z_, t_, a_, b_] := N[(t / b), $MachinePrecision]
\frac{t}{b}
Initial program 66.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6436.1%
Applied rewrites36.1%
Taylor expanded in t around inf
lower-/.f6420.7%
Applied rewrites20.7%
herbie shell --seed 2025202
(FPCore (x y z t a b)
:name "Development.Shake.Progress:decay from shake-0.15.5"
:precision binary64
(/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))