
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - 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)
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
code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - 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)
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
code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 -5e-266)
t_1
(if (<= t_1 2e-241)
(*
(fma -1.0 (/ (- (+ a (/ (* t y) x)) (+ y (/ (* a t) x))) z) (/ t x))
x)
(fma (/ (- x t) (- z a)) (- y z) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -5e-266) {
tmp = t_1;
} else if (t_1 <= 2e-241) {
tmp = fma(-1.0, (((a + ((t * y) / x)) - (y + ((a * t) / x))) / z), (t / x)) * x;
} else {
tmp = fma(((x - t) / (z - a)), (y - z), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= -5e-266) tmp = t_1; elseif (t_1 <= 2e-241) tmp = Float64(fma(-1.0, Float64(Float64(Float64(a + Float64(Float64(t * y) / x)) - Float64(y + Float64(Float64(a * t) / x))) / z), Float64(t / x)) * x); else tmp = fma(Float64(Float64(x - t) / Float64(z - a)), Float64(y - z), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-266], t$95$1, If[LessEqual[t$95$1, 2e-241], N[(N[(-1.0 * N[(N[(N[(a + N[(N[(t * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - N[(y + N[(N[(a * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + N[(t / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-266}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-241}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{\left(a + \frac{t \cdot y}{x}\right) - \left(y + \frac{a \cdot t}{x}\right)}{z}, \frac{t}{x}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999992e-266Initial program 90.4%
if -4.99999999999999992e-266 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.9999999999999999e-241Initial program 10.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites16.5%
Taylor expanded in z around -inf
lower-fma.f64N/A
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-/.f6485.4
Applied rewrites85.4%
if 1.9999999999999999e-241 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.5%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negate-revN/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lift--.f6491.5
Applied rewrites91.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 -5e-266)
t_1
(if (<= t_1 2e-241)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(fma (/ (- x t) (- z a)) (- y z) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -5e-266) {
tmp = t_1;
} else if (t_1 <= 2e-241) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else {
tmp = fma(((x - t) / (z - a)), (y - z), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= -5e-266) tmp = t_1; elseif (t_1 <= 2e-241) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); else tmp = fma(Float64(Float64(x - t) / Float64(z - a)), Float64(y - z), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-266], t$95$1, If[LessEqual[t$95$1, 2e-241], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-266}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-241}:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999992e-266Initial program 90.4%
if -4.99999999999999992e-266 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.9999999999999999e-241Initial program 10.5%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6476.4
Applied rewrites76.4%
if 1.9999999999999999e-241 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.5%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negate-revN/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lift--.f6491.5
Applied rewrites91.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x t) (- z a)) (- y z) x))
(t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -5e-266)
t_1
(if (<= t_2 2e-241) (+ (- (/ (* (- t x) (- y a)) z)) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - t) / (z - a)), (y - z), x);
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e-266) {
tmp = t_1;
} else if (t_2 <= 2e-241) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - t) / Float64(z - a)), Float64(y - z), x) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -5e-266) tmp = t_1; elseif (t_2 <= 2e-241) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-266], t$95$1, If[LessEqual[t$95$2, 2e-241], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-266}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-241}:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999992e-266 or 1.9999999999999999e-241 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negate-revN/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lift--.f6491.0
Applied rewrites91.0%
if -4.99999999999999992e-266 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.9999999999999999e-241Initial program 10.5%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6476.4
Applied rewrites76.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z)))))
(t_2 (+ x (* (- y z) (/ t (- a z))))))
(if (<= t_1 (- INFINITY))
(* (- t x) (/ y (- a z)))
(if (<= t_1 -5e-266)
t_2
(if (<= t_1 2e-241)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(if (<= t_1 2e+304) t_2 (/ (* (- t x) y) (- a z))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double t_2 = x + ((y - z) * (t / (a - z)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (t - x) * (y / (a - z));
} else if (t_1 <= -5e-266) {
tmp = t_2;
} else if (t_1 <= 2e-241) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else if (t_1 <= 2e+304) {
tmp = t_2;
} else {
tmp = ((t - x) * y) / (a - z);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double t_2 = x + ((y - z) * (t / (a - z)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (t - x) * (y / (a - z));
} else if (t_1 <= -5e-266) {
tmp = t_2;
} else if (t_1 <= 2e-241) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else if (t_1 <= 2e+304) {
tmp = t_2;
} else {
tmp = ((t - x) * y) / (a - z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * ((t - x) / (a - z))) t_2 = x + ((y - z) * (t / (a - z))) tmp = 0 if t_1 <= -math.inf: tmp = (t - x) * (y / (a - z)) elif t_1 <= -5e-266: tmp = t_2 elif t_1 <= 2e-241: tmp = -(((t - x) * (y - a)) / z) + t elif t_1 <= 2e+304: tmp = t_2 else: tmp = ((t - x) * y) / (a - z) return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) t_2 = Float64(x + Float64(Float64(y - z) * Float64(t / Float64(a - z)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); elseif (t_1 <= -5e-266) tmp = t_2; elseif (t_1 <= 2e-241) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); elseif (t_1 <= 2e+304) tmp = t_2; else tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - z) * ((t - x) / (a - z))); t_2 = x + ((y - z) * (t / (a - z))); tmp = 0.0; if (t_1 <= -Inf) tmp = (t - x) * (y / (a - z)); elseif (t_1 <= -5e-266) tmp = t_2; elseif (t_1 <= 2e-241) tmp = -(((t - x) * (y - a)) / z) + t; elseif (t_1 <= 2e+304) tmp = t_2; else tmp = ((t - x) * y) / (a - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-266], t$95$2, If[LessEqual[t$95$1, 2e-241], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], If[LessEqual[t$95$1, 2e+304], t$95$2, N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-266}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-241}:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+304}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0Initial program 85.2%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6491.0
Applied rewrites91.0%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6491.0
Applied rewrites91.0%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999992e-266 or 1.9999999999999999e-241 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.9999999999999999e304Initial program 92.2%
Taylor expanded in x around 0
Applied rewrites77.8%
if -4.99999999999999992e-266 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.9999999999999999e-241Initial program 10.5%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6476.4
Applied rewrites76.4%
if 1.9999999999999999e304 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 92.2%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6428.9
Applied rewrites28.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z)))))
(t_2 (+ x (* (- y z) (/ t (- a z))))))
(if (<= t_1 (- INFINITY))
(* (- t x) (/ y (- a z)))
(if (<= t_1 -5e-266)
t_2
(if (<= t_1 5e-187)
(/ (* (- y z) t) (- a z))
(if (<= t_1 2e+304) t_2 (/ (* (- t x) y) (- a z))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double t_2 = x + ((y - z) * (t / (a - z)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (t - x) * (y / (a - z));
} else if (t_1 <= -5e-266) {
tmp = t_2;
} else if (t_1 <= 5e-187) {
tmp = ((y - z) * t) / (a - z);
} else if (t_1 <= 2e+304) {
tmp = t_2;
} else {
tmp = ((t - x) * y) / (a - z);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double t_2 = x + ((y - z) * (t / (a - z)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (t - x) * (y / (a - z));
} else if (t_1 <= -5e-266) {
tmp = t_2;
} else if (t_1 <= 5e-187) {
tmp = ((y - z) * t) / (a - z);
} else if (t_1 <= 2e+304) {
tmp = t_2;
} else {
tmp = ((t - x) * y) / (a - z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * ((t - x) / (a - z))) t_2 = x + ((y - z) * (t / (a - z))) tmp = 0 if t_1 <= -math.inf: tmp = (t - x) * (y / (a - z)) elif t_1 <= -5e-266: tmp = t_2 elif t_1 <= 5e-187: tmp = ((y - z) * t) / (a - z) elif t_1 <= 2e+304: tmp = t_2 else: tmp = ((t - x) * y) / (a - z) return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) t_2 = Float64(x + Float64(Float64(y - z) * Float64(t / Float64(a - z)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); elseif (t_1 <= -5e-266) tmp = t_2; elseif (t_1 <= 5e-187) tmp = Float64(Float64(Float64(y - z) * t) / Float64(a - z)); elseif (t_1 <= 2e+304) tmp = t_2; else tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - z) * ((t - x) / (a - z))); t_2 = x + ((y - z) * (t / (a - z))); tmp = 0.0; if (t_1 <= -Inf) tmp = (t - x) * (y / (a - z)); elseif (t_1 <= -5e-266) tmp = t_2; elseif (t_1 <= 5e-187) tmp = ((y - z) * t) / (a - z); elseif (t_1 <= 2e+304) tmp = t_2; else tmp = ((t - x) * y) / (a - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-266], t$95$2, If[LessEqual[t$95$1, 5e-187], N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+304], t$95$2, N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-266}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-187}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+304}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0Initial program 85.2%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6491.0
Applied rewrites91.0%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6491.0
Applied rewrites91.0%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999992e-266 or 4.9999999999999996e-187 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.9999999999999999e304Initial program 92.6%
Taylor expanded in x around 0
Applied rewrites78.0%
if -4.99999999999999992e-266 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.9999999999999996e-187Initial program 16.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6437.0
Applied rewrites37.0%
if 1.9999999999999999e304 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 92.6%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6429.1
Applied rewrites29.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- t x) (/ (- y z) a) x)))
(if (<= a -1.3e-64)
t_1
(if (<= a 1.55e-34) (* t (/ (- y z) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t - x), ((y - z) / a), x);
double tmp;
if (a <= -1.3e-64) {
tmp = t_1;
} else if (a <= 1.55e-34) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t - x), Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -1.3e-64) tmp = t_1; elseif (a <= 1.55e-34) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.3e-64], t$95$1, If[LessEqual[a, 1.55e-34], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -1.3 \cdot 10^{-64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.55 \cdot 10^{-34}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.3e-64 or 1.5499999999999999e-34 < a Initial program 86.9%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6471.2
Applied rewrites71.2%
if -1.3e-64 < a < 1.5499999999999999e-34Initial program 72.2%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites70.5%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6463.4
Applied rewrites63.4%
(FPCore (x y z t a)
:precision binary64
(if (<= a -8200000000000.0)
(+ x (* (- y z) (/ t a)))
(if (<= a -3.1e-90)
(* (/ (- t x) (- a z)) y)
(if (<= a 1.65e+22) (* t (/ (- y z) (- a z))) (fma y (/ (- t x) a) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -8200000000000.0) {
tmp = x + ((y - z) * (t / a));
} else if (a <= -3.1e-90) {
tmp = ((t - x) / (a - z)) * y;
} else if (a <= 1.65e+22) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = fma(y, ((t - x) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -8200000000000.0) tmp = Float64(x + Float64(Float64(y - z) * Float64(t / a))); elseif (a <= -3.1e-90) tmp = Float64(Float64(Float64(t - x) / Float64(a - z)) * y); elseif (a <= 1.65e+22) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = fma(y, Float64(Float64(t - x) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -8200000000000.0], N[(x + N[(N[(y - z), $MachinePrecision] * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -3.1e-90], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[a, 1.65e+22], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8200000000000:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a}\\
\mathbf{elif}\;a \leq -3.1 \cdot 10^{-90}:\\
\;\;\;\;\frac{t - x}{a - z} \cdot y\\
\mathbf{elif}\;a \leq 1.65 \cdot 10^{+22}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\end{array}
\end{array}
if a < -8.2e12Initial program 88.3%
Taylor expanded in x around 0
Applied rewrites78.4%
Taylor expanded in z around 0
Applied rewrites67.6%
if -8.2e12 < a < -3.1000000000000001e-90Initial program 79.8%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6445.0
Applied rewrites45.0%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6447.7
Applied rewrites47.7%
if -3.1000000000000001e-90 < a < 1.6499999999999999e22Initial program 72.6%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites70.8%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6463.4
Applied rewrites63.4%
if 1.6499999999999999e22 < a Initial program 88.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6467.1
Applied rewrites67.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- t x) a) x)))
(if (<= x -1.02e+114)
t_1
(if (<= x 6.5e+182) (* t (/ (- y z) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (x <= -1.02e+114) {
tmp = t_1;
} else if (x <= 6.5e+182) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (x <= -1.02e+114) tmp = t_1; elseif (x <= 6.5e+182) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[x, -1.02e+114], t$95$1, If[LessEqual[x, 6.5e+182], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;x \leq -1.02 \cdot 10^{+114}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+182}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.01999999999999999e114 or 6.4999999999999998e182 < x Initial program 70.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6454.2
Applied rewrites54.2%
if -1.01999999999999999e114 < x < 6.4999999999999998e182Initial program 84.1%
Taylor expanded in t around 0
+-commutativeN/A
lower-+.f64N/A
Applied rewrites83.0%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6462.1
Applied rewrites62.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- t x) a) x)))
(if (<= a -3.8e-72)
t_1
(if (<= a -1.6e-196)
t
(if (<= a 3e-145)
(/ (* (- t x) y) (- z))
(if (<= a 1.5e-75) (* (/ t x) x) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -3.8e-72) {
tmp = t_1;
} else if (a <= -1.6e-196) {
tmp = t;
} else if (a <= 3e-145) {
tmp = ((t - x) * y) / -z;
} else if (a <= 1.5e-75) {
tmp = (t / x) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -3.8e-72) tmp = t_1; elseif (a <= -1.6e-196) tmp = t; elseif (a <= 3e-145) tmp = Float64(Float64(Float64(t - x) * y) / Float64(-z)); elseif (a <= 1.5e-75) tmp = Float64(Float64(t / x) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3.8e-72], t$95$1, If[LessEqual[a, -1.6e-196], t, If[LessEqual[a, 3e-145], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[a, 1.5e-75], N[(N[(t / x), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -3.8 \cdot 10^{-72}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -1.6 \cdot 10^{-196}:\\
\;\;\;\;t\\
\mathbf{elif}\;a \leq 3 \cdot 10^{-145}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{-z}\\
\mathbf{elif}\;a \leq 1.5 \cdot 10^{-75}:\\
\;\;\;\;\frac{t}{x} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.80000000000000002e-72 or 1.4999999999999999e-75 < a Initial program 86.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6461.4
Applied rewrites61.4%
if -3.80000000000000002e-72 < a < -1.6e-196Initial program 70.7%
Taylor expanded in z around inf
Applied rewrites36.3%
if -1.6e-196 < a < 2.99999999999999992e-145Initial program 70.8%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6456.1
Applied rewrites56.1%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6448.8
Applied rewrites48.8%
if 2.99999999999999992e-145 < a < 1.4999999999999999e-75Initial program 77.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites62.0%
Taylor expanded in z around inf
lower-/.f6427.0
Applied rewrites27.0%
(FPCore (x y z t a) :precision binary64 (if (<= y -8.6e+139) (* (/ (- t x) a) y) (if (<= y 2.9e-13) (+ x t) (* t (/ y (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -8.6e+139) {
tmp = ((t - x) / a) * y;
} else if (y <= 2.9e-13) {
tmp = x + t;
} else {
tmp = t * (y / (a - z));
}
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)
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) :: tmp
if (y <= (-8.6d+139)) then
tmp = ((t - x) / a) * y
else if (y <= 2.9d-13) then
tmp = x + t
else
tmp = t * (y / (a - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -8.6e+139) {
tmp = ((t - x) / a) * y;
} else if (y <= 2.9e-13) {
tmp = x + t;
} else {
tmp = t * (y / (a - z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -8.6e+139: tmp = ((t - x) / a) * y elif y <= 2.9e-13: tmp = x + t else: tmp = t * (y / (a - z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -8.6e+139) tmp = Float64(Float64(Float64(t - x) / a) * y); elseif (y <= 2.9e-13) tmp = Float64(x + t); else tmp = Float64(t * Float64(y / Float64(a - z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -8.6e+139) tmp = ((t - x) / a) * y; elseif (y <= 2.9e-13) tmp = x + t; else tmp = t * (y / (a - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -8.6e+139], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 2.9e-13], N[(x + t), $MachinePrecision], N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{+139}:\\
\;\;\;\;\frac{t - x}{a} \cdot y\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-13}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if y < -8.5999999999999996e139Initial program 90.0%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6464.7
Applied rewrites64.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6480.8
Applied rewrites80.8%
Taylor expanded in z around 0
lower-/.f64N/A
lift--.f6450.2
Applied rewrites50.2%
if -8.5999999999999996e139 < y < 2.8999999999999998e-13Initial program 75.8%
Taylor expanded in z around inf
lift--.f6424.4
Applied rewrites24.4%
Taylor expanded in x around 0
Applied rewrites43.7%
if 2.8999999999999998e-13 < y Initial program 87.3%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6456.7
Applied rewrites56.7%
Taylor expanded in x around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6437.9
Applied rewrites37.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* t (/ y (- a z))))) (if (<= y -335000000.0) t_1 (if (<= y 2.9e-13) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (y / (a - z));
double tmp;
if (y <= -335000000.0) {
tmp = t_1;
} else if (y <= 2.9e-13) {
tmp = x + t;
} 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)
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) :: t_1
real(8) :: tmp
t_1 = t * (y / (a - z))
if (y <= (-335000000.0d0)) then
tmp = t_1
else if (y <= 2.9d-13) then
tmp = x + t
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 t_1 = t * (y / (a - z));
double tmp;
if (y <= -335000000.0) {
tmp = t_1;
} else if (y <= 2.9e-13) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t * (y / (a - z)) tmp = 0 if y <= -335000000.0: tmp = t_1 elif y <= 2.9e-13: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(t * Float64(y / Float64(a - z))) tmp = 0.0 if (y <= -335000000.0) tmp = t_1; elseif (y <= 2.9e-13) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t * (y / (a - z)); tmp = 0.0; if (y <= -335000000.0) tmp = t_1; elseif (y <= 2.9e-13) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -335000000.0], t$95$1, If[LessEqual[y, 2.9e-13], N[(x + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y}{a - z}\\
\mathbf{if}\;y \leq -335000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-13}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.35e8 or 2.8999999999999998e-13 < y Initial program 87.5%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6457.4
Applied rewrites57.4%
Taylor expanded in x around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6439.2
Applied rewrites39.2%
if -3.35e8 < y < 2.8999999999999998e-13Initial program 73.7%
Taylor expanded in z around inf
lift--.f6426.0
Applied rewrites26.0%
Taylor expanded in x around 0
Applied rewrites46.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 (- INFINITY))
(/ (* t y) a)
(if (<= t_1 -0.005)
(+ x t)
(if (<= t_1 2e-241)
t
(if (<= t_1 2e+304) (+ x t) (/ (* (- x) y) a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (t * y) / a;
} else if (t_1 <= -0.005) {
tmp = x + t;
} else if (t_1 <= 2e-241) {
tmp = t;
} else if (t_1 <= 2e+304) {
tmp = x + t;
} else {
tmp = (-x * y) / a;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (t * y) / a;
} else if (t_1 <= -0.005) {
tmp = x + t;
} else if (t_1 <= 2e-241) {
tmp = t;
} else if (t_1 <= 2e+304) {
tmp = x + t;
} else {
tmp = (-x * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_1 <= -math.inf: tmp = (t * y) / a elif t_1 <= -0.005: tmp = x + t elif t_1 <= 2e-241: tmp = t elif t_1 <= 2e+304: tmp = x + t else: tmp = (-x * y) / a return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(t * y) / a); elseif (t_1 <= -0.005) tmp = Float64(x + t); elseif (t_1 <= 2e-241) tmp = t; elseif (t_1 <= 2e+304) tmp = Float64(x + t); else tmp = Float64(Float64(Float64(-x) * y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_1 <= -Inf) tmp = (t * y) / a; elseif (t_1 <= -0.005) tmp = x + t; elseif (t_1 <= 2e-241) tmp = t; elseif (t_1 <= 2e+304) tmp = x + t; else tmp = (-x * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t$95$1, -0.005], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, 2e-241], t, If[LessEqual[t$95$1, 2e+304], N[(x + t), $MachinePrecision], N[(N[((-x) * y), $MachinePrecision] / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{elif}\;t\_1 \leq -0.005:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-241}:\\
\;\;\;\;t\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+304}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-x\right) \cdot y}{a}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0Initial program 85.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6457.4
Applied rewrites57.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6446.6
Applied rewrites46.6%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -0.0050000000000000001 or 1.9999999999999999e-241 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.9999999999999999e304Initial program 94.5%
Taylor expanded in z around inf
lift--.f6425.1
Applied rewrites25.1%
Taylor expanded in x around 0
Applied rewrites46.0%
if -0.0050000000000000001 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.9999999999999999e-241Initial program 41.6%
Taylor expanded in z around inf
Applied rewrites33.1%
if 1.9999999999999999e304 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 94.5%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6429.0
Applied rewrites29.0%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6413.8
Applied rewrites13.8%
Taylor expanded in z around 0
Applied rewrites7.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* t y) a)) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -0.005)
(+ x t)
(if (<= t_2 2e-241) t (if (<= t_2 5e+307) (+ x t) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -0.005) {
tmp = x + t;
} else if (t_2 <= 2e-241) {
tmp = t;
} else if (t_2 <= 5e+307) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -0.005) {
tmp = x + t;
} else if (t_2 <= 2e-241) {
tmp = t;
} else if (t_2 <= 5e+307) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t * y) / a t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -0.005: tmp = x + t elif t_2 <= 2e-241: tmp = t elif t_2 <= 5e+307: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t * y) / a) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -0.005) tmp = Float64(x + t); elseif (t_2 <= 2e-241) tmp = t; elseif (t_2 <= 5e+307) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t * y) / a; t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -0.005) tmp = x + t; elseif (t_2 <= 2e-241) tmp = t; elseif (t_2 <= 5e+307) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -0.005], N[(x + t), $MachinePrecision], If[LessEqual[t$95$2, 2e-241], t, If[LessEqual[t$95$2, 5e+307], N[(x + t), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t \cdot y}{a}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -0.005:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-241}:\\
\;\;\;\;t\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0 or 5e307 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6457.7
Applied rewrites57.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6445.9
Applied rewrites45.9%
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -0.0050000000000000001 or 1.9999999999999999e-241 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 5e307Initial program 94.5%
Taylor expanded in z around inf
lift--.f6425.1
Applied rewrites25.1%
Taylor expanded in x around 0
Applied rewrites46.1%
if -0.0050000000000000001 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.9999999999999999e-241Initial program 41.6%
Taylor expanded in z around inf
Applied rewrites33.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.4e-12) t (if (<= z 1.2e-9) x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.4e-12) {
tmp = t;
} else if (z <= 1.2e-9) {
tmp = x;
} else {
tmp = t;
}
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)
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) :: tmp
if (z <= (-3.4d-12)) then
tmp = t
else if (z <= 1.2d-9) then
tmp = x
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.4e-12) {
tmp = t;
} else if (z <= 1.2e-9) {
tmp = x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.4e-12: tmp = t elif z <= 1.2e-9: tmp = x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.4e-12) tmp = t; elseif (z <= 1.2e-9) tmp = x; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.4e-12) tmp = t; elseif (z <= 1.2e-9) tmp = x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.4e-12], t, If[LessEqual[z, 1.2e-9], x, t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-12}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.4000000000000001e-12 or 1.2e-9 < z Initial program 70.4%
Taylor expanded in z around inf
Applied rewrites41.4%
if -3.4000000000000001e-12 < z < 1.2e-9Initial program 91.6%
Taylor expanded in a around inf
Applied rewrites35.2%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return t;
}
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)
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
code = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 80.7%
Taylor expanded in z around inf
Applied rewrites25.0%
herbie shell --seed 2025128
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:precision binary64
(+ x (* (- y z) (/ (- t x) (- a z)))))