
(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}
Sampling outcomes in binary64 precision:
Herbie found 14 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 (+ x (* (- y z) t_1))))
(if (or (<= t_2 -5e-243) (not (<= t_2 5e-277)))
(fma t_1 (- y z) x)
(+ t (fma -1.0 (/ (* t (- y a)) z) (* x (/ (- y a) z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = x + ((y - z) * t_1);
double tmp;
if ((t_2 <= -5e-243) || !(t_2 <= 5e-277)) {
tmp = fma(t_1, (y - z), x);
} else {
tmp = t + fma(-1.0, ((t * (y - a)) / z), (x * ((y - a) / z)));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if ((t_2 <= -5e-243) || !(t_2 <= 5e-277)) tmp = fma(t_1, Float64(y - z), x); else tmp = Float64(t + fma(-1.0, Float64(Float64(t * Float64(y - a)) / z), Float64(x * Float64(Float64(y - a) / z)))); 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[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -5e-243], N[Not[LessEqual[t$95$2, 5e-277]], $MachinePrecision]], N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[(t + N[(-1.0 * N[(N[(t * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + N[(x * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-243} \lor \neg \left(t\_2 \leq 5 \cdot 10^{-277}\right):\\
\;\;\;\;\mathsf{fma}\left(t\_1, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t + \mathsf{fma}\left(-1, \frac{t \cdot \left(y - a\right)}{z}, x \cdot \frac{y - a}{z}\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5e-243 or 5e-277 < (+.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
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.0
Applied rewrites91.0%
if -5e-243 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 5e-277Initial program 3.6%
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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites86.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6495.3
Applied rewrites95.3%
Final simplification91.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z))) (t_2 (+ x (* (- y z) t_1))))
(if (or (<= t_2 -5e-243) (not (<= t_2 5e-277)))
(fma t_1 (- y z) x)
(fma (/ (* (- t x) (- y a)) z) -1.0 t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = x + ((y - z) * t_1);
double tmp;
if ((t_2 <= -5e-243) || !(t_2 <= 5e-277)) {
tmp = fma(t_1, (y - z), x);
} else {
tmp = fma((((t - x) * (y - a)) / z), -1.0, t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if ((t_2 <= -5e-243) || !(t_2 <= 5e-277)) tmp = fma(t_1, Float64(y - z), x); else tmp = fma(Float64(Float64(Float64(t - x) * Float64(y - a)) / z), -1.0, t); 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[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -5e-243], N[Not[LessEqual[t$95$2, 5e-277]], $MachinePrecision]], N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-243} \lor \neg \left(t\_2 \leq 5 \cdot 10^{-277}\right):\\
\;\;\;\;\mathsf{fma}\left(t\_1, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}, -1, t\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5e-243 or 5e-277 < (+.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
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.0
Applied rewrites91.0%
if -5e-243 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 5e-277Initial program 3.6%
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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites86.5%
Final simplification90.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z))) (t_2 (+ x (* (- y z) t_1))))
(if (or (<= t_2 -5e-243) (not (<= t_2 5e-277)))
(fma t_1 (- y z) x)
(fma (/ (* (- t x) y) z) -1.0 t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = x + ((y - z) * t_1);
double tmp;
if ((t_2 <= -5e-243) || !(t_2 <= 5e-277)) {
tmp = fma(t_1, (y - z), x);
} else {
tmp = fma((((t - x) * y) / z), -1.0, t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if ((t_2 <= -5e-243) || !(t_2 <= 5e-277)) tmp = fma(t_1, Float64(y - z), x); else tmp = fma(Float64(Float64(Float64(t - x) * y) / z), -1.0, t); 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[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -5e-243], N[Not[LessEqual[t$95$2, 5e-277]], $MachinePrecision]], N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-243} \lor \neg \left(t\_2 \leq 5 \cdot 10^{-277}\right):\\
\;\;\;\;\mathsf{fma}\left(t\_1, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(t - x\right) \cdot y}{z}, -1, t\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5e-243 or 5e-277 < (+.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
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.0
Applied rewrites91.0%
if -5e-243 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 5e-277Initial program 3.6%
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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites86.5%
Taylor expanded in y around inf
Applied rewrites68.2%
Final simplification87.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (* (- t x) y) z) -1.0 t)))
(if (<= z -2.4e+94)
t_1
(if (<= z 4.2e-19)
(fma (/ (- t x) (- a z)) y x)
(if (<= z 9.8e+107) (+ x (* (- y z) (/ t (- a z)))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((((t - x) * y) / z), -1.0, t);
double tmp;
if (z <= -2.4e+94) {
tmp = t_1;
} else if (z <= 4.2e-19) {
tmp = fma(((t - x) / (a - z)), y, x);
} else if (z <= 9.8e+107) {
tmp = x + ((y - z) * (t / (a - z)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(Float64(t - x) * y) / z), -1.0, t) tmp = 0.0 if (z <= -2.4e+94) tmp = t_1; elseif (z <= 4.2e-19) tmp = fma(Float64(Float64(t - x) / Float64(a - z)), y, x); elseif (z <= 9.8e+107) tmp = Float64(x + Float64(Float64(y - z) * Float64(t / Float64(a - z)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision]}, If[LessEqual[z, -2.4e+94], t$95$1, If[LessEqual[z, 4.2e-19], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 9.8e+107], N[(x + N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{\left(t - x\right) \cdot y}{z}, -1, t\right)\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y, x\right)\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{+107}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.39999999999999983e94 or 9.8000000000000003e107 < z Initial program 46.6%
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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites69.3%
Taylor expanded in y around inf
Applied rewrites68.8%
if -2.39999999999999983e94 < z < 4.1999999999999998e-19Initial program 90.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
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6490.0
Applied rewrites90.0%
Taylor expanded in y around inf
Applied rewrites80.7%
if 4.1999999999999998e-19 < z < 9.8000000000000003e107Initial program 86.7%
Taylor expanded in x around 0
Applied rewrites72.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.55e+28) (not (<= a 1.06e-39))) (fma (- t x) (/ (- y z) a) x) (fma (/ (* (- t x) y) z) -1.0 t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.55e+28) || !(a <= 1.06e-39)) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = fma((((t - x) * y) / z), -1.0, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.55e+28) || !(a <= 1.06e-39)) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = fma(Float64(Float64(Float64(t - x) * y) / z), -1.0, t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.55e+28], N[Not[LessEqual[a, 1.06e-39]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{+28} \lor \neg \left(a \leq 1.06 \cdot 10^{-39}\right):\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(t - x\right) \cdot y}{z}, -1, t\right)\\
\end{array}
\end{array}
if a < -1.55e28 or 1.06000000000000004e-39 < a Initial program 86.7%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6478.3
Applied rewrites78.3%
if -1.55e28 < a < 1.06000000000000004e-39Initial program 65.4%
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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites76.6%
Taylor expanded in y around inf
Applied rewrites71.0%
Final simplification74.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.4e+94) (not (<= z 5.5e+37))) (* t (/ (- y z) (- a z))) (fma (/ (- t x) (- a z)) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.4e+94) || !(z <= 5.5e+37)) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = fma(((t - x) / (a - z)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.4e+94) || !(z <= 5.5e+37)) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = fma(Float64(Float64(t - x) / Float64(a - z)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.4e+94], N[Not[LessEqual[z, 5.5e+37]], $MachinePrecision]], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+94} \lor \neg \left(z \leq 5.5 \cdot 10^{+37}\right):\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y, x\right)\\
\end{array}
\end{array}
if z < -2.39999999999999983e94 or 5.50000000000000016e37 < z Initial program 51.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--.f6451.5
Applied rewrites51.5%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6465.8
Applied rewrites65.8%
if -2.39999999999999983e94 < z < 5.50000000000000016e37Initial program 90.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
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6490.1
Applied rewrites90.1%
Taylor expanded in y around inf
Applied rewrites78.8%
Final simplification74.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.4e+94) (not (<= z 9.5e+34))) (* t (/ (- y z) (- a z))) (fma (- t x) (/ (- y z) a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.4e+94) || !(z <= 9.5e+34)) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = fma((t - x), ((y - z) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.4e+94) || !(z <= 9.5e+34)) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.4e+94], N[Not[LessEqual[z, 9.5e+34]], $MachinePrecision]], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+94} \lor \neg \left(z \leq 9.5 \cdot 10^{+34}\right):\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\end{array}
\end{array}
if z < -2.39999999999999983e94 or 9.4999999999999999e34 < z Initial program 52.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
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6452.1
Applied rewrites52.1%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6465.1
Applied rewrites65.1%
if -2.39999999999999983e94 < z < 9.4999999999999999e34Initial program 89.9%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6475.4
Applied rewrites75.4%
Final simplification71.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.1e-87) (not (<= z 1.5e-20))) (* 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 ((z <= -3.1e-87) || !(z <= 1.5e-20)) {
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 ((z <= -3.1e-87) || !(z <= 1.5e-20)) 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[Or[LessEqual[z, -3.1e-87], N[Not[LessEqual[z, 1.5e-20]], $MachinePrecision]], 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}\;z \leq -3.1 \cdot 10^{-87} \lor \neg \left(z \leq 1.5 \cdot 10^{-20}\right):\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\end{array}
\end{array}
if z < -3.09999999999999998e-87 or 1.50000000000000014e-20 < z Initial program 62.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--.f6463.0
Applied rewrites63.0%
Taylor expanded in t around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6460.2
Applied rewrites60.2%
if -3.09999999999999998e-87 < z < 1.50000000000000014e-20Initial program 92.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6479.2
Applied rewrites79.2%
Final simplification68.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.35e+94)
t
(if (<= z -1.45e-265)
x
(if (<= z 3.4e-294) (/ (* t y) a) (if (<= z 4.8e-12) x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.35e+94) {
tmp = t;
} else if (z <= -1.45e-265) {
tmp = x;
} else if (z <= 3.4e-294) {
tmp = (t * y) / a;
} else if (z <= 4.8e-12) {
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 <= (-2.35d+94)) then
tmp = t
else if (z <= (-1.45d-265)) then
tmp = x
else if (z <= 3.4d-294) then
tmp = (t * y) / a
else if (z <= 4.8d-12) 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 <= -2.35e+94) {
tmp = t;
} else if (z <= -1.45e-265) {
tmp = x;
} else if (z <= 3.4e-294) {
tmp = (t * y) / a;
} else if (z <= 4.8e-12) {
tmp = x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.35e+94: tmp = t elif z <= -1.45e-265: tmp = x elif z <= 3.4e-294: tmp = (t * y) / a elif z <= 4.8e-12: tmp = x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.35e+94) tmp = t; elseif (z <= -1.45e-265) tmp = x; elseif (z <= 3.4e-294) tmp = Float64(Float64(t * y) / a); elseif (z <= 4.8e-12) tmp = x; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.35e+94) tmp = t; elseif (z <= -1.45e-265) tmp = x; elseif (z <= 3.4e-294) tmp = (t * y) / a; elseif (z <= 4.8e-12) tmp = x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.35e+94], t, If[LessEqual[z, -1.45e-265], x, If[LessEqual[z, 3.4e-294], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 4.8e-12], x, t]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{+94}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{-265}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{-294}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.35000000000000008e94 or 4.79999999999999974e-12 < z Initial program 54.4%
Taylor expanded in z around inf
Applied rewrites49.7%
if -2.35000000000000008e94 < z < -1.44999999999999987e-265 or 3.39999999999999981e-294 < z < 4.79999999999999974e-12Initial program 89.6%
Taylor expanded in a around inf
Applied rewrites34.0%
if -1.44999999999999987e-265 < z < 3.39999999999999981e-294Initial program 94.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6494.2
Applied rewrites94.2%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6472.4
Applied rewrites72.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.4e+94) (+ t (/ (* a (- t x)) z)) (if (<= z 6.2e+35) (fma y (/ (- t x) a) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.4e+94) {
tmp = t + ((a * (t - x)) / z);
} else if (z <= 6.2e+35) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.4e+94) tmp = Float64(t + Float64(Float64(a * Float64(t - x)) / z)); elseif (z <= 6.2e+35) 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, -2.4e+94], N[(t + N[(N[(a * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.2e+35], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+94}:\\
\;\;\;\;t + \frac{a \cdot \left(t - x\right)}{z}\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.39999999999999983e94Initial program 48.4%
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
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites73.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6460.5
Applied rewrites60.5%
if -2.39999999999999983e94 < z < 6.19999999999999973e35Initial program 89.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6467.8
Applied rewrites67.8%
if 6.19999999999999973e35 < z Initial program 55.8%
Taylor expanded in z around inf
Applied rewrites40.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.4e+94) t (if (<= z 6.2e+35) (fma y (/ (- t x) a) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.4e+94) {
tmp = t;
} else if (z <= 6.2e+35) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.4e+94) tmp = t; elseif (z <= 6.2e+35) 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, -2.4e+94], t, If[LessEqual[z, 6.2e+35], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+94}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.39999999999999983e94 or 6.19999999999999973e35 < z Initial program 52.0%
Taylor expanded in z around inf
Applied rewrites51.1%
if -2.39999999999999983e94 < z < 6.19999999999999973e35Initial program 89.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6467.8
Applied rewrites67.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.4e+94) t (if (<= z 1.7e-7) (fma y (/ t a) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.4e+94) {
tmp = t;
} else if (z <= 1.7e-7) {
tmp = fma(y, (t / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.4e+94) tmp = t; elseif (z <= 1.7e-7) tmp = fma(y, Float64(t / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.4e+94], t, If[LessEqual[z, 1.7e-7], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+94}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.39999999999999983e94 or 1.69999999999999987e-7 < z Initial program 54.4%
Taylor expanded in z around inf
Applied rewrites49.7%
if -2.39999999999999983e94 < z < 1.69999999999999987e-7Initial program 90.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6469.4
Applied rewrites69.4%
Taylor expanded in x around 0
Applied rewrites54.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.35e+94) t (if (<= z 4.8e-12) x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.35e+94) {
tmp = t;
} else if (z <= 4.8e-12) {
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 <= (-2.35d+94)) then
tmp = t
else if (z <= 4.8d-12) 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 <= -2.35e+94) {
tmp = t;
} else if (z <= 4.8e-12) {
tmp = x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.35e+94: tmp = t elif z <= 4.8e-12: tmp = x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.35e+94) tmp = t; elseif (z <= 4.8e-12) tmp = x; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.35e+94) tmp = t; elseif (z <= 4.8e-12) tmp = x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.35e+94], t, If[LessEqual[z, 4.8e-12], x, t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{+94}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.35000000000000008e94 or 4.79999999999999974e-12 < z Initial program 54.4%
Taylor expanded in z around inf
Applied rewrites49.7%
if -2.35000000000000008e94 < z < 4.79999999999999974e-12Initial program 90.1%
Taylor expanded in a around inf
Applied rewrites31.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 76.3%
Taylor expanded in z around inf
Applied rewrites25.0%
herbie shell --seed 2025045
(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)))))