
(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 18 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 (/ (- t x) (- a z)))
(t_2 (fma t_1 (- y z) x))
(t_3 (+ x (* (- y z) t_1))))
(if (<= t_3 -2e-155)
t_2
(if (<= t_3 0.0)
(*
(fma -1.0 (/ (- (+ a (/ (* t y) x)) (+ y (/ (* a t) x))) z) (/ t x))
x)
t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = fma(t_1, (y - z), x);
double t_3 = x + ((y - z) * t_1);
double tmp;
if (t_3 <= -2e-155) {
tmp = t_2;
} else if (t_3 <= 0.0) {
tmp = fma(-1.0, (((a + ((t * y) / x)) - (y + ((a * t) / x))) / z), (t / x)) * x;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = fma(t_1, Float64(y - z), x) t_3 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if (t_3 <= -2e-155) tmp = t_2; elseif (t_3 <= 0.0) 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 = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-155], t$95$2, If[LessEqual[t$95$3, 0.0], 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], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := \mathsf{fma}\left(t\_1, y - z, x\right)\\
t_3 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-155}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\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}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000003e-155 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.8%
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
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.8
Applied rewrites91.8%
if -2.00000000000000003e-155 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 19.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites24.4%
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-/.f6478.7
Applied rewrites78.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z)))
(t_2 (fma t_1 (- y z) x))
(t_3 (+ x (* (- y z) t_1))))
(if (<= t_3 -2e-155)
t_2
(if (<= t_3 0.0) (+ (- (/ (* (- t x) (- y a)) z)) t) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = fma(t_1, (y - z), x);
double t_3 = x + ((y - z) * t_1);
double tmp;
if (t_3 <= -2e-155) {
tmp = t_2;
} else if (t_3 <= 0.0) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = fma(t_1, Float64(y - z), x) t_3 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if (t_3 <= -2e-155) tmp = t_2; elseif (t_3 <= 0.0) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-155], t$95$2, If[LessEqual[t$95$3, 0.0], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := \mathsf{fma}\left(t\_1, y - z, x\right)\\
t_3 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-155}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000003e-155 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.8%
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
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.8
Applied rewrites91.8%
if -2.00000000000000003e-155 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 19.2%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites72.9%
(FPCore (x y z t a)
:precision binary64
(if (<= a -5.8e-46)
(+ x (* (- y z) (/ t (- a z))))
(if (<= a 1.08e-88)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(fma (- t x) (/ (- y z) a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.8e-46) {
tmp = x + ((y - z) * (t / (a - z)));
} else if (a <= 1.08e-88) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else {
tmp = fma((t - x), ((y - z) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.8e-46) tmp = Float64(x + Float64(Float64(y - z) * Float64(t / Float64(a - z)))); elseif (a <= 1.08e-88) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); else tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.8e-46], N[(x + N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.08e-88], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{-46}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{elif}\;a \leq 1.08 \cdot 10^{-88}:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\end{array}
\end{array}
if a < -5.80000000000000009e-46Initial program 86.2%
Taylor expanded in x around 0
Applied rewrites73.6%
if -5.80000000000000009e-46 < a < 1.07999999999999995e-88Initial program 73.3%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites77.7%
if 1.07999999999999995e-88 < a Initial program 86.8%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6469.6
Applied rewrites69.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z))))
(if (<= y -4.2e-142)
(fma t_1 y x)
(if (<= y 9.6e+75) (+ x (* (- y z) (/ t (- a z)))) (+ x (* y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double tmp;
if (y <= -4.2e-142) {
tmp = fma(t_1, y, x);
} else if (y <= 9.6e+75) {
tmp = x + ((y - z) * (t / (a - z)));
} else {
tmp = x + (y * t_1);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) tmp = 0.0 if (y <= -4.2e-142) tmp = fma(t_1, y, x); elseif (y <= 9.6e+75) tmp = Float64(x + Float64(Float64(y - z) * Float64(t / Float64(a - z)))); else tmp = Float64(x + Float64(y * t_1)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.2e-142], N[(t$95$1 * y + x), $MachinePrecision], If[LessEqual[y, 9.6e+75], N[(x + N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
\mathbf{if}\;y \leq -4.2 \cdot 10^{-142}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, y, x\right)\\
\mathbf{elif}\;y \leq 9.6 \cdot 10^{+75}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\_1\\
\end{array}
\end{array}
if y < -4.1999999999999999e-142Initial program 83.2%
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
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6483.4
Applied rewrites83.4%
Taylor expanded in y around inf
Applied rewrites66.8%
if -4.1999999999999999e-142 < y < 9.5999999999999999e75Initial program 75.8%
Taylor expanded in x around 0
Applied rewrites70.6%
if 9.5999999999999999e75 < y Initial program 90.8%
Taylor expanded in y around inf
Applied rewrites81.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -6.8e+140) t (if (<= z 7.5e+68) (fma (/ (- t x) (- a z)) y x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.8e+140) {
tmp = t;
} else if (z <= 7.5e+68) {
tmp = fma(((t - x) / (a - z)), y, x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.8e+140) tmp = t; elseif (z <= 7.5e+68) tmp = fma(Float64(Float64(t - x) / Float64(a - z)), y, x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.8e+140], t, If[LessEqual[z, 7.5e+68], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+140}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+68}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -6.8e140 or 7.49999999999999959e68 < z Initial program 64.3%
Taylor expanded in z around inf
Applied rewrites51.9%
if -6.8e140 < z < 7.49999999999999959e68Initial program 89.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
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6489.5
Applied rewrites89.5%
Taylor expanded in y around inf
Applied rewrites76.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- t x) (/ (- y z) a) x)))
(if (<= a -1.45e-16)
t_1
(if (<= a -6.5e-76)
(/ (* (- y z) t) (- a z))
(if (<= a 1e-88) (/ (* (- t x) y) (- 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.45e-16) {
tmp = t_1;
} else if (a <= -6.5e-76) {
tmp = ((y - z) * t) / (a - z);
} else if (a <= 1e-88) {
tmp = ((t - x) * y) / (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.45e-16) tmp = t_1; elseif (a <= -6.5e-76) tmp = Float64(Float64(Float64(y - z) * t) / Float64(a - z)); elseif (a <= 1e-88) tmp = Float64(Float64(Float64(t - x) * y) / 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.45e-16], t$95$1, If[LessEqual[a, -6.5e-76], N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1e-88], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $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.45 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -6.5 \cdot 10^{-76}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{elif}\;a \leq 10^{-88}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.4499999999999999e-16 or 9.99999999999999934e-89 < 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--.f6470.9
Applied rewrites70.9%
if -1.4499999999999999e-16 < a < -6.5e-76Initial program 77.6%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6450.9
Applied rewrites50.9%
if -6.5e-76 < a < 9.99999999999999934e-89Initial program 72.9%
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--.f6453.9
Applied rewrites53.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma t (/ (- y z) a) x)))
(if (<= a -1.25e-12)
t_1
(if (<= a -6.5e-76)
(/ (* (- y z) t) (- a z))
(if (<= a 1.95e-67) (/ (* (- t x) y) (- a z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, ((y - z) / a), x);
double tmp;
if (a <= -1.25e-12) {
tmp = t_1;
} else if (a <= -6.5e-76) {
tmp = ((y - z) * t) / (a - z);
} else if (a <= 1.95e-67) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -1.25e-12) tmp = t_1; elseif (a <= -6.5e-76) tmp = Float64(Float64(Float64(y - z) * t) / Float64(a - z)); elseif (a <= 1.95e-67) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.25e-12], t$95$1, If[LessEqual[a, -6.5e-76], N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.95e-67], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -1.25 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -6.5 \cdot 10^{-76}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{elif}\;a \leq 1.95 \cdot 10^{-67}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.24999999999999992e-12 or 1.9499999999999999e-67 < a Initial program 87.4%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6471.9
Applied rewrites71.9%
Taylor expanded in x around 0
Applied rewrites63.3%
if -1.24999999999999992e-12 < a < -6.5e-76Initial program 77.3%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6449.4
Applied rewrites49.4%
if -6.5e-76 < a < 1.9499999999999999e-67Initial program 72.9%
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--.f6453.6
Applied rewrites53.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma t (/ (- y z) a) x)))
(if (<= a -4.2e-26)
t_1
(if (<= a 1.95e-67) (/ (* (- t x) y) (- a z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, ((y - z) / a), x);
double tmp;
if (a <= -4.2e-26) {
tmp = t_1;
} else if (a <= 1.95e-67) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -4.2e-26) tmp = t_1; elseif (a <= 1.95e-67) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -4.2e-26], t$95$1, If[LessEqual[a, 1.95e-67], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -4.2 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.95 \cdot 10^{-67}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.20000000000000016e-26 or 1.9499999999999999e-67 < a Initial program 87.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6471.5
Applied rewrites71.5%
Taylor expanded in x around 0
Applied rewrites62.8%
if -4.20000000000000016e-26 < a < 1.9499999999999999e-67Initial program 73.4%
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--.f6452.7
Applied rewrites52.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma t (/ (- y z) a) x))) (if (<= a -3.1e-24) t_1 (if (<= a 2.1e-67) (* (/ (- t x) (- a z)) y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, ((y - z) / a), x);
double tmp;
if (a <= -3.1e-24) {
tmp = t_1;
} else if (a <= 2.1e-67) {
tmp = ((t - x) / (a - z)) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -3.1e-24) tmp = t_1; elseif (a <= 2.1e-67) tmp = Float64(Float64(Float64(t - x) / Float64(a - z)) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3.1e-24], t$95$1, If[LessEqual[a, 2.1e-67], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -3.1 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{-67}:\\
\;\;\;\;\frac{t - x}{a - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.1e-24 or 2.1000000000000002e-67 < a Initial program 87.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6471.5
Applied rewrites71.5%
Taylor expanded in x around 0
Applied rewrites62.9%
if -3.1e-24 < a < 2.1000000000000002e-67Initial program 73.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--.f6452.8
Applied rewrites52.8%
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--.f6454.3
Applied rewrites54.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5e+106)
t
(if (<= z -1.25e-223)
(fma t (/ (- y z) a) x)
(if (<= z 3e+61) (fma y (/ (- t x) a) x) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e+106) {
tmp = t;
} else if (z <= -1.25e-223) {
tmp = fma(t, ((y - z) / a), x);
} else if (z <= 3e+61) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e+106) tmp = t; elseif (z <= -1.25e-223) tmp = fma(t, Float64(Float64(y - z) / a), x); elseif (z <= 3e+61) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e+106], t, If[LessEqual[z, -1.25e-223], N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 3e+61], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+106}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -1.25 \cdot 10^{-223}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -4.9999999999999998e106 or 3e61 < z Initial program 65.7%
Taylor expanded in z around inf
Applied rewrites49.7%
if -4.9999999999999998e106 < z < -1.25000000000000006e-223Initial program 89.1%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6465.2
Applied rewrites65.2%
Taylor expanded in x around 0
Applied rewrites54.4%
if -1.25000000000000006e-223 < z < 3e61Initial program 90.8%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6470.3
Applied rewrites70.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma t (/ (- y z) a) x))) (if (<= a -3.1e-24) t_1 (if (<= a 2.5e-67) (* (- t x) (/ y (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, ((y - z) / a), x);
double tmp;
if (a <= -3.1e-24) {
tmp = t_1;
} else if (a <= 2.5e-67) {
tmp = (t - x) * (y / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -3.1e-24) tmp = t_1; elseif (a <= 2.5e-67) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3.1e-24], t$95$1, If[LessEqual[a, 2.5e-67], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -3.1 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.5 \cdot 10^{-67}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.1e-24 or 2.4999999999999999e-67 < a Initial program 87.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6471.5
Applied rewrites71.5%
Taylor expanded in x around 0
Applied rewrites62.9%
if -3.1e-24 < a < 2.4999999999999999e-67Initial program 73.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--.f6452.8
Applied rewrites52.8%
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--.f6455.9
Applied rewrites55.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.2e+129) t (if (<= z 3e+61) (fma y (/ (- t x) a) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.2e+129) {
tmp = t;
} else if (z <= 3e+61) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.2e+129) tmp = t; elseif (z <= 3e+61) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.2e+129], t, If[LessEqual[z, 3e+61], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+129}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -5.20000000000000024e129 or 3e61 < z Initial program 65.1%
Taylor expanded in z around inf
Applied rewrites50.8%
if -5.20000000000000024e129 < z < 3e61Initial program 89.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6464.4
Applied rewrites64.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.2e-97)
t
(if (<= z 1.5e-89)
(* y (/ (- t x) a))
(if (<= z 1.06e+22) (/ (* (- t x) y) (- z)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.2e-97) {
tmp = t;
} else if (z <= 1.5e-89) {
tmp = y * ((t - x) / a);
} else if (z <= 1.06e+22) {
tmp = ((t - x) * y) / -z;
} 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.2d-97)) then
tmp = t
else if (z <= 1.5d-89) then
tmp = y * ((t - x) / a)
else if (z <= 1.06d+22) then
tmp = ((t - x) * y) / -z
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.2e-97) {
tmp = t;
} else if (z <= 1.5e-89) {
tmp = y * ((t - x) / a);
} else if (z <= 1.06e+22) {
tmp = ((t - x) * y) / -z;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.2e-97: tmp = t elif z <= 1.5e-89: tmp = y * ((t - x) / a) elif z <= 1.06e+22: tmp = ((t - x) * y) / -z else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.2e-97) tmp = t; elseif (z <= 1.5e-89) tmp = Float64(y * Float64(Float64(t - x) / a)); elseif (z <= 1.06e+22) tmp = Float64(Float64(Float64(t - x) * y) / Float64(-z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.2e-97) tmp = t; elseif (z <= 1.5e-89) tmp = y * ((t - x) / a); elseif (z <= 1.06e+22) tmp = ((t - x) * y) / -z; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.2e-97], t, If[LessEqual[z, 1.5e-89], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.06e+22], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / (-z)), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-97}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-89}:\\
\;\;\;\;y \cdot \frac{t - x}{a}\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{+22}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{-z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.1999999999999998e-97 or 1.06e22 < z Initial program 73.1%
Taylor expanded in z around inf
Applied rewrites39.9%
if -3.1999999999999998e-97 < z < 1.5e-89Initial program 92.0%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6483.9
Applied rewrites83.9%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6445.9
Applied rewrites45.9%
if 1.5e-89 < z < 1.06e22Initial program 89.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--.f6441.6
Applied rewrites41.6%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6427.9
Applied rewrites27.9%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.5e+27) (/ (* (- x) y) (- a z)) (if (<= y -1.15e-204) x (if (<= y 1.3e-21) t (* y (/ (- t x) a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.5e+27) {
tmp = (-x * y) / (a - z);
} else if (y <= -1.15e-204) {
tmp = x;
} else if (y <= 1.3e-21) {
tmp = t;
} else {
tmp = y * ((t - x) / a);
}
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 <= (-2.5d+27)) then
tmp = (-x * y) / (a - z)
else if (y <= (-1.15d-204)) then
tmp = x
else if (y <= 1.3d-21) then
tmp = t
else
tmp = y * ((t - x) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.5e+27) {
tmp = (-x * y) / (a - z);
} else if (y <= -1.15e-204) {
tmp = x;
} else if (y <= 1.3e-21) {
tmp = t;
} else {
tmp = y * ((t - x) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.5e+27: tmp = (-x * y) / (a - z) elif y <= -1.15e-204: tmp = x elif y <= 1.3e-21: tmp = t else: tmp = y * ((t - x) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.5e+27) tmp = Float64(Float64(Float64(-x) * y) / Float64(a - z)); elseif (y <= -1.15e-204) tmp = x; elseif (y <= 1.3e-21) tmp = t; else tmp = Float64(y * Float64(Float64(t - x) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.5e+27) tmp = (-x * y) / (a - z); elseif (y <= -1.15e-204) tmp = x; elseif (y <= 1.3e-21) tmp = t; else tmp = y * ((t - x) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.5e+27], N[(N[((-x) * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.15e-204], x, If[LessEqual[y, 1.3e-21], t, N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+27}:\\
\;\;\;\;\frac{\left(-x\right) \cdot y}{a - z}\\
\mathbf{elif}\;y \leq -1.15 \cdot 10^{-204}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-21}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t - x}{a}\\
\end{array}
\end{array}
if y < -2.4999999999999999e27Initial 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--.f6458.7
Applied rewrites58.7%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6433.5
Applied rewrites33.5%
if -2.4999999999999999e27 < y < -1.15e-204Initial program 75.9%
Taylor expanded in a around inf
Applied rewrites31.8%
if -1.15e-204 < y < 1.30000000000000009e-21Initial program 74.1%
Taylor expanded in z around inf
Applied rewrites37.4%
if 1.30000000000000009e-21 < y Initial program 88.6%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6456.6
Applied rewrites56.6%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6439.8
Applied rewrites39.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.2e-97) t (if (<= z 1.8e-84) (* y (/ (- t x) a)) (if (<= z 1.85e+58) x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.2e-97) {
tmp = t;
} else if (z <= 1.8e-84) {
tmp = y * ((t - x) / a);
} else if (z <= 1.85e+58) {
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.2d-97)) then
tmp = t
else if (z <= 1.8d-84) then
tmp = y * ((t - x) / a)
else if (z <= 1.85d+58) 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.2e-97) {
tmp = t;
} else if (z <= 1.8e-84) {
tmp = y * ((t - x) / a);
} else if (z <= 1.85e+58) {
tmp = x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.2e-97: tmp = t elif z <= 1.8e-84: tmp = y * ((t - x) / a) elif z <= 1.85e+58: tmp = x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.2e-97) tmp = t; elseif (z <= 1.8e-84) tmp = Float64(y * Float64(Float64(t - x) / a)); elseif (z <= 1.85e+58) tmp = x; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.2e-97) tmp = t; elseif (z <= 1.8e-84) tmp = y * ((t - x) / a); elseif (z <= 1.85e+58) tmp = x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.2e-97], t, If[LessEqual[z, 1.8e-84], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e+58], x, t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-97}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-84}:\\
\;\;\;\;y \cdot \frac{t - x}{a}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+58}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.1999999999999998e-97 or 1.8500000000000001e58 < z Initial program 72.5%
Taylor expanded in z around inf
Applied rewrites40.6%
if -3.1999999999999998e-97 < z < 1.80000000000000002e-84Initial program 92.0%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6483.7
Applied rewrites83.7%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6445.6
Applied rewrites45.6%
if 1.80000000000000002e-84 < z < 1.8500000000000001e58Initial program 87.5%
Taylor expanded in a around inf
Applied rewrites29.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -5e+71) t (if (<= z -2.8e-254) (* t (/ (- y z) a)) (if (<= z 1.85e+58) x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e+71) {
tmp = t;
} else if (z <= -2.8e-254) {
tmp = t * ((y - z) / a);
} else if (z <= 1.85e+58) {
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 <= (-5d+71)) then
tmp = t
else if (z <= (-2.8d-254)) then
tmp = t * ((y - z) / a)
else if (z <= 1.85d+58) 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 <= -5e+71) {
tmp = t;
} else if (z <= -2.8e-254) {
tmp = t * ((y - z) / a);
} else if (z <= 1.85e+58) {
tmp = x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5e+71: tmp = t elif z <= -2.8e-254: tmp = t * ((y - z) / a) elif z <= 1.85e+58: tmp = x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e+71) tmp = t; elseif (z <= -2.8e-254) tmp = Float64(t * Float64(Float64(y - z) / a)); elseif (z <= 1.85e+58) tmp = x; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5e+71) tmp = t; elseif (z <= -2.8e-254) tmp = t * ((y - z) / a); elseif (z <= 1.85e+58) tmp = x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e+71], t, If[LessEqual[z, -2.8e-254], N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e+58], x, t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+71}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-254}:\\
\;\;\;\;t \cdot \frac{y - z}{a}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+58}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -4.99999999999999972e71 or 1.8500000000000001e58 < z Initial program 66.8%
Taylor expanded in z around inf
Applied rewrites48.2%
if -4.99999999999999972e71 < z < -2.79999999999999983e-254Initial program 90.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6470.1
Applied rewrites70.1%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6428.4
Applied rewrites28.4%
if -2.79999999999999983e-254 < z < 1.8500000000000001e58Initial program 90.7%
Taylor expanded in a around inf
Applied rewrites34.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.2e+42) x (if (<= a 130.0) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.2e+42) {
tmp = x;
} else if (a <= 130.0) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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 (a <= (-3.2d+42)) then
tmp = x
else if (a <= 130.0d0) then
tmp = t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.2e+42) {
tmp = x;
} else if (a <= 130.0) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.2e+42: tmp = x elif a <= 130.0: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.2e+42) tmp = x; elseif (a <= 130.0) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.2e+42) tmp = x; elseif (a <= 130.0) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.2e+42], x, If[LessEqual[a, 130.0], t, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{+42}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 130:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.20000000000000002e42 or 130 < a Initial program 88.7%
Taylor expanded in a around inf
Applied rewrites44.7%
if -3.20000000000000002e42 < a < 130Initial program 75.0%
Taylor expanded in z around inf
Applied rewrites34.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 81.3%
Taylor expanded in z around inf
Applied rewrites25.5%
herbie shell --seed 2025114
(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)))))