
(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 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 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (or (<= t_1 -1e-288) (not (<= t_1 0.0)))
(fma (- t x) (/ (- y z) (- a z)) x)
(- t (* (/ (- t x) z) (- y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if ((t_1 <= -1e-288) || !(t_1 <= 0.0)) {
tmp = fma((t - x), ((y - z) / (a - z)), x);
} else {
tmp = t - (((t - x) / z) * (y - a));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if ((t_1 <= -1e-288) || !(t_1 <= 0.0)) tmp = fma(Float64(t - x), Float64(Float64(y - z) / Float64(a - z)), x); else tmp = Float64(t - Float64(Float64(Float64(t - x) / z) * Float64(y - a))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e-288], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-288} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t - \frac{t - x}{z} \cdot \left(y - a\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.00000000000000006e-288 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 88.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
if -1.00000000000000006e-288 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 3.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f646.8
Applied rewrites6.8%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Final simplification95.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (- t x))))
(if (<= z -7.2e+157)
t_1
(if (<= z -41000000.0)
(* (/ (- y a) z) x)
(if (<= z 6.2e-30)
(+ x (/ (* y t) a))
(if (<= z 1.12e+165) (* (/ (- x t) z) y) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t - x);
double tmp;
if (z <= -7.2e+157) {
tmp = t_1;
} else if (z <= -41000000.0) {
tmp = ((y - a) / z) * x;
} else if (z <= 6.2e-30) {
tmp = x + ((y * t) / a);
} else if (z <= 1.12e+165) {
tmp = ((x - t) / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (t - x)
if (z <= (-7.2d+157)) then
tmp = t_1
else if (z <= (-41000000.0d0)) then
tmp = ((y - a) / z) * x
else if (z <= 6.2d-30) then
tmp = x + ((y * t) / a)
else if (z <= 1.12d+165) then
tmp = ((x - t) / z) * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t - x);
double tmp;
if (z <= -7.2e+157) {
tmp = t_1;
} else if (z <= -41000000.0) {
tmp = ((y - a) / z) * x;
} else if (z <= 6.2e-30) {
tmp = x + ((y * t) / a);
} else if (z <= 1.12e+165) {
tmp = ((x - t) / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (t - x) tmp = 0 if z <= -7.2e+157: tmp = t_1 elif z <= -41000000.0: tmp = ((y - a) / z) * x elif z <= 6.2e-30: tmp = x + ((y * t) / a) elif z <= 1.12e+165: tmp = ((x - t) / z) * y else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t - x)) tmp = 0.0 if (z <= -7.2e+157) tmp = t_1; elseif (z <= -41000000.0) tmp = Float64(Float64(Float64(y - a) / z) * x); elseif (z <= 6.2e-30) tmp = Float64(x + Float64(Float64(y * t) / a)); elseif (z <= 1.12e+165) tmp = Float64(Float64(Float64(x - t) / z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (t - x); tmp = 0.0; if (z <= -7.2e+157) tmp = t_1; elseif (z <= -41000000.0) tmp = ((y - a) / z) * x; elseif (z <= 6.2e-30) tmp = x + ((y * t) / a); elseif (z <= 1.12e+165) tmp = ((x - t) / z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.2e+157], t$95$1, If[LessEqual[z, -41000000.0], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 6.2e-30], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e+165], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(t - x\right)\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -41000000:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-30}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+165}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.20000000000000049e157 or 1.1200000000000001e165 < z Initial program 55.0%
Taylor expanded in z around inf
lower--.f6458.1
Applied rewrites58.1%
if -7.20000000000000049e157 < z < -4.1e7Initial program 69.4%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6469.9
Applied rewrites69.9%
Taylor expanded in y around inf
Applied rewrites38.6%
Taylor expanded in x around inf
Applied rewrites47.8%
if -4.1e7 < z < 6.19999999999999982e-30Initial program 90.9%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6473.6
Applied rewrites73.6%
Taylor expanded in x around 0
Applied rewrites66.6%
if 6.19999999999999982e-30 < z < 1.1200000000000001e165Initial program 86.9%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6470.4
Applied rewrites70.4%
Taylor expanded in y around inf
Applied rewrites47.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (- t x))))
(if (<= z -7.2e+157)
t_1
(if (<= z -41000000.0)
(* (/ (- y a) z) x)
(if (<= z 6.2e-30)
(fma y (/ t a) x)
(if (<= z 1.12e+165) (* (/ (- x t) z) y) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t - x);
double tmp;
if (z <= -7.2e+157) {
tmp = t_1;
} else if (z <= -41000000.0) {
tmp = ((y - a) / z) * x;
} else if (z <= 6.2e-30) {
tmp = fma(y, (t / a), x);
} else if (z <= 1.12e+165) {
tmp = ((x - t) / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t - x)) tmp = 0.0 if (z <= -7.2e+157) tmp = t_1; elseif (z <= -41000000.0) tmp = Float64(Float64(Float64(y - a) / z) * x); elseif (z <= 6.2e-30) tmp = fma(y, Float64(t / a), x); elseif (z <= 1.12e+165) tmp = Float64(Float64(Float64(x - t) / z) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.2e+157], t$95$1, If[LessEqual[z, -41000000.0], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 6.2e-30], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.12e+165], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(t - x\right)\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -41000000:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+165}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.20000000000000049e157 or 1.1200000000000001e165 < z Initial program 55.0%
Taylor expanded in z around inf
lower--.f6458.1
Applied rewrites58.1%
if -7.20000000000000049e157 < z < -4.1e7Initial program 69.4%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6469.9
Applied rewrites69.9%
Taylor expanded in y around inf
Applied rewrites38.6%
Taylor expanded in x around inf
Applied rewrites47.8%
if -4.1e7 < z < 6.19999999999999982e-30Initial program 90.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6476.0
Applied rewrites76.0%
Taylor expanded in x around 0
Applied rewrites65.9%
if 6.19999999999999982e-30 < z < 1.1200000000000001e165Initial program 86.9%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6470.4
Applied rewrites70.4%
Taylor expanded in y around inf
Applied rewrites47.3%
Final simplification59.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- a y) z) t t)))
(if (<= z -2.6e+157)
t_1
(if (<= z -41000000.0)
(* (/ (- y a) z) x)
(if (<= z 4.6e-30) (+ x (/ (* y t) a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((a - y) / z), t, t);
double tmp;
if (z <= -2.6e+157) {
tmp = t_1;
} else if (z <= -41000000.0) {
tmp = ((y - a) / z) * x;
} else if (z <= 4.6e-30) {
tmp = x + ((y * t) / a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(a - y) / z), t, t) tmp = 0.0 if (z <= -2.6e+157) tmp = t_1; elseif (z <= -41000000.0) tmp = Float64(Float64(Float64(y - a) / z) * x); elseif (z <= 4.6e-30) tmp = Float64(x + Float64(Float64(y * t) / a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision] * t + t), $MachinePrecision]}, If[LessEqual[z, -2.6e+157], t$95$1, If[LessEqual[z, -41000000.0], N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 4.6e-30], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{a - y}{z}, t, t\right)\\
\mathbf{if}\;z \leq -2.6 \cdot 10^{+157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -41000000:\\
\;\;\;\;\frac{y - a}{z} \cdot x\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-30}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.60000000000000011e157 or 4.59999999999999968e-30 < z Initial program 67.1%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6484.9
Applied rewrites84.9%
Taylor expanded in y around inf
Applied rewrites27.6%
Taylor expanded in x around 0
Applied rewrites63.6%
if -2.60000000000000011e157 < z < -4.1e7Initial program 69.4%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6469.9
Applied rewrites69.9%
Taylor expanded in y around inf
Applied rewrites38.6%
Taylor expanded in x around inf
Applied rewrites47.8%
if -4.1e7 < z < 4.59999999999999968e-30Initial program 90.9%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6473.6
Applied rewrites73.6%
Taylor expanded in x around 0
Applied rewrites66.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -15200.0) (not (<= z 4.6e-30))) (fma (- (- 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 ((z <= -15200.0) || !(z <= 4.6e-30)) {
tmp = fma(-(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 ((z <= -15200.0) || !(z <= 4.6e-30)) tmp = fma(Float64(-Float64(t - x)), Float64(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[Or[LessEqual[z, -15200.0], N[Not[LessEqual[z, 4.6e-30]], $MachinePrecision]], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $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}\;z \leq -15200 \lor \neg \left(z \leq 4.6 \cdot 10^{-30}\right):\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\end{array}
\end{array}
if z < -15200 or 4.59999999999999968e-30 < z Initial program 67.6%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6481.2
Applied rewrites81.2%
if -15200 < z < 4.59999999999999968e-30Initial program 90.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6479.7
Applied rewrites79.7%
Final simplification80.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (- t x))))
(if (<= z -1.25e+165)
t_1
(if (<= z 6.2e-30)
(fma y (/ t a) x)
(if (<= z 1.12e+165) (* (/ (- x t) z) y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t - x);
double tmp;
if (z <= -1.25e+165) {
tmp = t_1;
} else if (z <= 6.2e-30) {
tmp = fma(y, (t / a), x);
} else if (z <= 1.12e+165) {
tmp = ((x - t) / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t - x)) tmp = 0.0 if (z <= -1.25e+165) tmp = t_1; elseif (z <= 6.2e-30) tmp = fma(y, Float64(t / a), x); elseif (z <= 1.12e+165) tmp = Float64(Float64(Float64(x - t) / z) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.25e+165], t$95$1, If[LessEqual[z, 6.2e-30], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.12e+165], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(t - x\right)\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+165}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+165}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.24999999999999993e165 or 1.1200000000000001e165 < z Initial program 54.6%
Taylor expanded in z around inf
lower--.f6459.4
Applied rewrites59.4%
if -1.24999999999999993e165 < z < 6.19999999999999982e-30Initial program 86.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6490.3
Applied rewrites90.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6467.5
Applied rewrites67.5%
Taylor expanded in x around 0
Applied rewrites58.6%
if 6.19999999999999982e-30 < z < 1.1200000000000001e165Initial program 86.9%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6470.4
Applied rewrites70.4%
Taylor expanded in y around inf
Applied rewrites47.3%
Final simplification57.1%
(FPCore (x y z t a)
:precision binary64
(if (<= z -15200.0)
(- t (* (/ (- t x) z) (- y a)))
(if (<= z 4.6e-30)
(fma (- t x) (/ (- y z) a) x)
(fma (- (- t x)) (/ (- y a) z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -15200.0) {
tmp = t - (((t - x) / z) * (y - a));
} else if (z <= 4.6e-30) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = fma(-(t - x), ((y - a) / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -15200.0) tmp = Float64(t - Float64(Float64(Float64(t - x) / z) * Float64(y - a))); elseif (z <= 4.6e-30) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -15200.0], N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e-30], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -15200:\\
\;\;\;\;t - \frac{t - x}{z} \cdot \left(y - a\right)\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if z < -15200Initial program 61.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6466.3
Applied rewrites66.3%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6482.7
Applied rewrites82.7%
if -15200 < z < 4.59999999999999968e-30Initial program 90.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6479.7
Applied rewrites79.7%
if 4.59999999999999968e-30 < z Initial program 74.9%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.9
Applied rewrites79.9%
Final simplification80.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.7e-40)
(fma (/ (- x t) z) y t)
(if (<= z 6.2e-30)
(fma (- t x) (/ (- y z) a) x)
(fma (- (- t x)) (/ y z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.7e-40) {
tmp = fma(((x - t) / z), y, t);
} else if (z <= 6.2e-30) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = fma(-(t - x), (y / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.7e-40) tmp = fma(Float64(Float64(x - t) / z), y, t); elseif (z <= 6.2e-30) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = fma(Float64(-Float64(t - x)), Float64(y / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.7e-40], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision], If[LessEqual[z, 6.2e-30], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * N[(y / z), $MachinePrecision] + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{-40}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y}{z}, t\right)\\
\end{array}
\end{array}
if z < -3.69999999999999998e-40Initial program 65.9%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.4
Applied rewrites79.4%
Taylor expanded in a around 0
Applied rewrites73.0%
if -3.69999999999999998e-40 < z < 6.19999999999999982e-30Initial program 90.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6495.6
Applied rewrites95.6%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6481.4
Applied rewrites81.4%
if 6.19999999999999982e-30 < z Initial program 74.9%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.9
Applied rewrites79.9%
Taylor expanded in y around inf
Applied rewrites74.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (- t x))))
(if (<= z -2.5e+157)
t_1
(if (<= z -2.3e-44)
(* (/ x z) y)
(if (<= z 910000.0) (/ (* t y) a) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t - x);
double tmp;
if (z <= -2.5e+157) {
tmp = t_1;
} else if (z <= -2.3e-44) {
tmp = (x / z) * y;
} else if (z <= 910000.0) {
tmp = (t * y) / a;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (t - x)
if (z <= (-2.5d+157)) then
tmp = t_1
else if (z <= (-2.3d-44)) then
tmp = (x / z) * y
else if (z <= 910000.0d0) then
tmp = (t * y) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t - x);
double tmp;
if (z <= -2.5e+157) {
tmp = t_1;
} else if (z <= -2.3e-44) {
tmp = (x / z) * y;
} else if (z <= 910000.0) {
tmp = (t * y) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (t - x) tmp = 0 if z <= -2.5e+157: tmp = t_1 elif z <= -2.3e-44: tmp = (x / z) * y elif z <= 910000.0: tmp = (t * y) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t - x)) tmp = 0.0 if (z <= -2.5e+157) tmp = t_1; elseif (z <= -2.3e-44) tmp = Float64(Float64(x / z) * y); elseif (z <= 910000.0) tmp = Float64(Float64(t * y) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (t - x); tmp = 0.0; if (z <= -2.5e+157) tmp = t_1; elseif (z <= -2.3e-44) tmp = (x / z) * y; elseif (z <= 910000.0) tmp = (t * y) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.5e+157], t$95$1, If[LessEqual[z, -2.3e-44], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 910000.0], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(t - x\right)\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{-44}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{elif}\;z \leq 910000:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.49999999999999988e157 or 9.1e5 < z Initial program 63.9%
Taylor expanded in z around inf
lower--.f6447.1
Applied rewrites47.1%
if -2.49999999999999988e157 < z < -2.29999999999999998e-44Initial program 77.2%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6466.2
Applied rewrites66.2%
Taylor expanded in y around inf
Applied rewrites41.1%
Taylor expanded in x around inf
Applied rewrites41.0%
if -2.29999999999999998e-44 < z < 9.1e5Initial program 90.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6495.1
Applied rewrites95.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6472.8
Applied rewrites72.8%
Taylor expanded in x around 0
Applied rewrites34.4%
Final simplification39.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -6600000.0) (fma (/ (- x t) z) y t) (if (<= z 6.2e-30) (fma (- t x) (/ y a) x) (fma (- (- t x)) (/ y z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6600000.0) {
tmp = fma(((x - t) / z), y, t);
} else if (z <= 6.2e-30) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = fma(-(t - x), (y / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6600000.0) tmp = fma(Float64(Float64(x - t) / z), y, t); elseif (z <= 6.2e-30) tmp = fma(Float64(t - x), Float64(y / a), x); else tmp = fma(Float64(-Float64(t - x)), Float64(y / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6600000.0], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision], If[LessEqual[z, 6.2e-30], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * N[(y / z), $MachinePrecision] + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6600000:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y}{z}, t\right)\\
\end{array}
\end{array}
if z < -6.6e6Initial program 61.6%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6482.3
Applied rewrites82.3%
Taylor expanded in a around 0
Applied rewrites74.9%
if -6.6e6 < z < 6.19999999999999982e-30Initial program 90.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Taylor expanded in z around 0
lower-/.f6477.5
Applied rewrites77.5%
if 6.19999999999999982e-30 < z Initial program 74.9%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.9
Applied rewrites79.9%
Taylor expanded in y around inf
Applied rewrites74.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6600000.0) (not (<= z 6.2e-30))) (fma (/ (- x t) z) y t) (fma (- t x) (/ y a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6600000.0) || !(z <= 6.2e-30)) {
tmp = fma(((x - t) / z), y, t);
} else {
tmp = fma((t - x), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6600000.0) || !(z <= 6.2e-30)) tmp = fma(Float64(Float64(x - t) / z), y, t); else tmp = fma(Float64(t - x), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6600000.0], N[Not[LessEqual[z, 6.2e-30]], $MachinePrecision]], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6600000 \lor \neg \left(z \leq 6.2 \cdot 10^{-30}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if z < -6.6e6 or 6.19999999999999982e-30 < z Initial program 67.6%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6481.2
Applied rewrites81.2%
Taylor expanded in a around 0
Applied rewrites74.1%
if -6.6e6 < z < 6.19999999999999982e-30Initial program 90.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Taylor expanded in z around 0
lower-/.f6477.5
Applied rewrites77.5%
Final simplification75.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1350.0) (not (<= z 6.2e-30))) (fma (/ (- x t) z) y t) (fma (/ (- t x) a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1350.0) || !(z <= 6.2e-30)) {
tmp = fma(((x - t) / z), y, t);
} else {
tmp = fma(((t - x) / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1350.0) || !(z <= 6.2e-30)) tmp = fma(Float64(Float64(x - t) / z), y, t); else tmp = fma(Float64(Float64(t - x) / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1350.0], N[Not[LessEqual[z, 6.2e-30]], $MachinePrecision]], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1350 \lor \neg \left(z \leq 6.2 \cdot 10^{-30}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\end{array}
\end{array}
if z < -1350 or 6.19999999999999982e-30 < z Initial program 67.6%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6481.2
Applied rewrites81.2%
Taylor expanded in a around 0
Applied rewrites74.1%
if -1350 < z < 6.19999999999999982e-30Initial program 90.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6476.0
Applied rewrites76.0%
Final simplification75.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -7e+14) (not (<= a 1.26e+150))) (fma y (/ t a) x) (fma (/ (- x t) z) y t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7e+14) || !(a <= 1.26e+150)) {
tmp = fma(y, (t / a), x);
} else {
tmp = fma(((x - t) / z), y, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -7e+14) || !(a <= 1.26e+150)) tmp = fma(y, Float64(t / a), x); else tmp = fma(Float64(Float64(x - t) / z), y, t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -7e+14], N[Not[LessEqual[a, 1.26e+150]], $MachinePrecision]], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{+14} \lor \neg \left(a \leq 1.26 \cdot 10^{+150}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\end{array}
\end{array}
if a < -7e14 or 1.26e150 < a Initial program 87.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6491.6
Applied rewrites91.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6479.4
Applied rewrites79.4%
Taylor expanded in x around 0
Applied rewrites78.3%
if -7e14 < a < 1.26e150Initial program 74.8%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6475.0
Applied rewrites75.0%
Taylor expanded in a around 0
Applied rewrites68.6%
Final simplification72.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.25e+165) (not (<= z 1.02e+165))) (+ x (- t x)) (fma y (/ t a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.25e+165) || !(z <= 1.02e+165)) {
tmp = x + (t - x);
} else {
tmp = fma(y, (t / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.25e+165) || !(z <= 1.02e+165)) tmp = Float64(x + Float64(t - x)); else tmp = fma(y, Float64(t / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.25e+165], N[Not[LessEqual[z, 1.02e+165]], $MachinePrecision]], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+165} \lor \neg \left(z \leq 1.02 \cdot 10^{+165}\right):\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\end{array}
\end{array}
if z < -1.24999999999999993e165 or 1.02000000000000003e165 < z Initial program 54.6%
Taylor expanded in z around inf
lower--.f6459.4
Applied rewrites59.4%
if -1.24999999999999993e165 < z < 1.02000000000000003e165Initial program 86.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6490.1
Applied rewrites90.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6460.8
Applied rewrites60.8%
Taylor expanded in x around 0
Applied rewrites53.2%
Final simplification54.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -8.5e-15) (not (<= x 2e-10))) (* (/ y z) x) (+ x (- t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -8.5e-15) || !(x <= 2e-10)) {
tmp = (y / z) * x;
} else {
tmp = x + (t - 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 ((x <= (-8.5d-15)) .or. (.not. (x <= 2d-10))) then
tmp = (y / z) * x
else
tmp = x + (t - x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -8.5e-15) || !(x <= 2e-10)) {
tmp = (y / z) * x;
} else {
tmp = x + (t - x);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -8.5e-15) or not (x <= 2e-10): tmp = (y / z) * x else: tmp = x + (t - x) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -8.5e-15) || !(x <= 2e-10)) tmp = Float64(Float64(y / z) * x); else tmp = Float64(x + Float64(t - x)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -8.5e-15) || ~((x <= 2e-10))) tmp = (y / z) * x; else tmp = x + (t - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -8.5e-15], N[Not[LessEqual[x, 2e-10]], $MachinePrecision]], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-15} \lor \neg \left(x \leq 2 \cdot 10^{-10}\right):\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;x + \left(t - x\right)\\
\end{array}
\end{array}
if x < -8.50000000000000007e-15 or 2.00000000000000007e-10 < x Initial program 75.2%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6458.2
Applied rewrites58.2%
Taylor expanded in y around inf
Applied rewrites34.6%
Taylor expanded in x around inf
Applied rewrites32.8%
if -8.50000000000000007e-15 < x < 2.00000000000000007e-10Initial program 82.6%
Taylor expanded in z around inf
lower--.f6434.4
Applied rewrites34.4%
Final simplification33.6%
(FPCore (x y z t a) :precision binary64 (if (<= x -8.5e-15) (* (/ x z) y) (if (<= x 2e-10) (+ x (- t x)) (* (/ y z) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8.5e-15) {
tmp = (x / z) * y;
} else if (x <= 2e-10) {
tmp = x + (t - x);
} else {
tmp = (y / z) * 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 (x <= (-8.5d-15)) then
tmp = (x / z) * y
else if (x <= 2d-10) then
tmp = x + (t - x)
else
tmp = (y / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8.5e-15) {
tmp = (x / z) * y;
} else if (x <= 2e-10) {
tmp = x + (t - x);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -8.5e-15: tmp = (x / z) * y elif x <= 2e-10: tmp = x + (t - x) else: tmp = (y / z) * x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -8.5e-15) tmp = Float64(Float64(x / z) * y); elseif (x <= 2e-10) tmp = Float64(x + Float64(t - x)); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -8.5e-15) tmp = (x / z) * y; elseif (x <= 2e-10) tmp = x + (t - x); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -8.5e-15], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[x, 2e-10], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-15}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-10}:\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if x < -8.50000000000000007e-15Initial program 78.9%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6454.2
Applied rewrites54.2%
Taylor expanded in y around inf
Applied rewrites32.3%
Taylor expanded in x around inf
Applied rewrites28.7%
if -8.50000000000000007e-15 < x < 2.00000000000000007e-10Initial program 82.6%
Taylor expanded in z around inf
lower--.f6434.4
Applied rewrites34.4%
if 2.00000000000000007e-10 < x Initial program 72.0%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6461.7
Applied rewrites61.7%
Taylor expanded in y around inf
Applied rewrites36.5%
Taylor expanded in x around inf
Applied rewrites36.5%
(FPCore (x y z t a) :precision binary64 (+ x (- t x)))
double code(double x, double y, double z, double t, double a) {
return x + (t - x);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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 + (t - x)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (t - x);
}
def code(x, y, z, t, a): return x + (t - x)
function code(x, y, z, t, a) return Float64(x + Float64(t - x)) end
function tmp = code(x, y, z, t, a) tmp = x + (t - x); end
code[x_, y_, z_, t_, a_] := N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right)
\end{array}
Initial program 79.1%
Taylor expanded in z around inf
lower--.f6422.3
Applied rewrites22.3%
(FPCore (x y z t a) :precision binary64 (+ x (- x)))
double code(double x, double y, double z, double t, double a) {
return x + -x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
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 + -x
end function
public static double code(double x, double y, double z, double t, double a) {
return x + -x;
}
def code(x, y, z, t, a): return x + -x
function code(x, y, z, t, a) return Float64(x + Float64(-x)) end
function tmp = code(x, y, z, t, a) tmp = x + -x; end
code[x_, y_, z_, t_, a_] := N[(x + (-x)), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-x\right)
\end{array}
Initial program 79.1%
Taylor expanded in z around inf
lower--.f6422.3
Applied rewrites22.3%
Taylor expanded in x around inf
Applied rewrites2.8%
herbie shell --seed 2024364
(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)))))