
(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(Float64(y - z) * 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[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
Herbie found 16 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(Float64(y - z) * 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[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ (- x t) (- z a)) x))
(t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e-266)
t_2
(if (<= t_2 0.0)
(fma 1.0 t (* (/ (- y a) z) x))
(if (<= t_2 1e+308) t_2 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), ((x - t) / (z - a)), x);
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -1e-266) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = fma(1.0, t, (((y - a) / z) * x));
} else if (t_2 <= 1e+308) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(Float64(x - t) / Float64(z - a)), x) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -1e-266) tmp = t_2; elseif (t_2 <= 0.0) tmp = fma(1.0, t, Float64(Float64(Float64(y - a) / z) * x)); elseif (t_2 <= 1e+308) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e-266], t$95$2, If[LessEqual[t$95$2, 0.0], N[(1.0 * t + N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+308], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{x - t}{z - a}, x\right)\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-266}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(1, t, \frac{y - a}{z} \cdot x\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+308}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0 or 1e308 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 38.6%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6482.2
Applied rewrites82.2%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -9.9999999999999998e-267 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1e308Initial program 96.5%
if -9.9999999999999998e-267 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 10.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.0%
Taylor expanded in z around -inf
lower-/.f64N/A
lower--.f6493.6
Applied rewrites93.6%
Taylor expanded in z around inf
Applied rewrites93.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) (- z a)) t (* (/ (- y a) z) x))))
(if (<= z -4e+164)
t_1
(if (<= z -7e-211)
(fma (- y z) (/ (- x t) (- z a)) x)
(if (<= z 3.6e+79) (+ x (/ (* (- y z) (- t x)) (- a z))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / (z - a)), t, (((y - a) / z) * x));
double tmp;
if (z <= -4e+164) {
tmp = t_1;
} else if (z <= -7e-211) {
tmp = fma((y - z), ((x - t) / (z - a)), x);
} else if (z <= 3.6e+79) {
tmp = x + (((y - z) * (t - x)) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / Float64(z - a)), t, Float64(Float64(Float64(y - a) / z) * x)) tmp = 0.0 if (z <= -4e+164) tmp = t_1; elseif (z <= -7e-211) tmp = fma(Float64(y - z), Float64(Float64(x - t) / Float64(z - a)), x); elseif (z <= 3.6e+79) tmp = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4e+164], t$95$1, If[LessEqual[z, -7e-211], N[(N[(y - z), $MachinePrecision] * N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 3.6e+79], N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{z - a}, t, \frac{y - a}{z} \cdot x\right)\\
\mathbf{if}\;z \leq -4 \cdot 10^{+164}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7 \cdot 10^{-211}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{x - t}{z - a}, x\right)\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+79}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4e164 or 3.5999999999999999e79 < z Initial program 35.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites81.4%
Taylor expanded in z around -inf
lower-/.f64N/A
lower--.f6487.9
Applied rewrites87.9%
if -4e164 < z < -7e-211Initial program 76.4%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6485.8
Applied rewrites85.8%
if -7e-211 < z < 3.5999999999999999e79Initial program 86.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z y) (- z a))))
(if (<= z -1.6e+194)
(fma t_1 t (* (/ (- y a) z) x))
(fma t_1 t (* (+ (/ (- y z) (- z a)) 1.0) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - y) / (z - a);
double tmp;
if (z <= -1.6e+194) {
tmp = fma(t_1, t, (((y - a) / z) * x));
} else {
tmp = fma(t_1, t, ((((y - z) / (z - a)) + 1.0) * x));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - y) / Float64(z - a)) tmp = 0.0 if (z <= -1.6e+194) tmp = fma(t_1, t, Float64(Float64(Float64(y - a) / z) * x)); else tmp = fma(t_1, t, Float64(Float64(Float64(Float64(y - z) / Float64(z - a)) + 1.0) * x)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.6e+194], N[(t$95$1 * t + N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t + N[(N[(N[(N[(y - z), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - y}{z - a}\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+194}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t, \frac{y - a}{z} \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t, \left(\frac{y - z}{z - a} + 1\right) \cdot x\right)\\
\end{array}
\end{array}
if z < -1.60000000000000011e194Initial program 26.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites79.1%
Taylor expanded in z around -inf
lower-/.f64N/A
lower--.f6492.3
Applied rewrites92.3%
if -1.60000000000000011e194 < z Initial program 72.6%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma 1.0 t (* (/ (- y a) z) x))))
(if (<= z -1.45e+168)
t_1
(if (<= z 2.5e+171) (fma (- y z) (/ (- x t) (- z a)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(1.0, t, (((y - a) / z) * x));
double tmp;
if (z <= -1.45e+168) {
tmp = t_1;
} else if (z <= 2.5e+171) {
tmp = fma((y - z), ((x - t) / (z - a)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(1.0, t, Float64(Float64(Float64(y - a) / z) * x)) tmp = 0.0 if (z <= -1.45e+168) tmp = t_1; elseif (z <= 2.5e+171) tmp = fma(Float64(y - z), Float64(Float64(x - t) / Float64(z - a)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(1.0 * t + N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.45e+168], t$95$1, If[LessEqual[z, 2.5e+171], N[(N[(y - z), $MachinePrecision] * N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1, t, \frac{y - a}{z} \cdot x\right)\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{+168}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+171}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{x - t}{z - a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.45e168 or 2.5000000000000002e171 < z Initial program 29.6%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.7%
Taylor expanded in z around -inf
lower-/.f64N/A
lower--.f6491.2
Applied rewrites91.2%
Taylor expanded in z around inf
Applied rewrites81.0%
if -1.45e168 < z < 2.5000000000000002e171Initial program 79.2%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6487.1
Applied rewrites87.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- t x) (- a z)))))
(if (<= y -1.55e+66)
t_1
(if (<= y 6.4e+105) (fma (/ (- z y) (- z a)) t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((t - x) / (a - z));
double tmp;
if (y <= -1.55e+66) {
tmp = t_1;
} else if (y <= 6.4e+105) {
tmp = fma(((z - y) / (z - a)), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(t - x) / Float64(a - z))) tmp = 0.0 if (y <= -1.55e+66) tmp = t_1; elseif (y <= 6.4e+105) tmp = fma(Float64(Float64(z - y) / Float64(z - a)), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.55e+66], t$95$1, If[LessEqual[y, 6.4e+105], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;y \leq -1.55 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+105}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.55000000000000009e66 or 6.4e105 < y Initial program 68.6%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-/l*N/A
flip--N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lift--.f6432.3
Applied rewrites32.3%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6475.2
Applied rewrites75.2%
if -1.55000000000000009e66 < y < 6.4e105Initial program 68.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.0%
Taylor expanded in z around -inf
lower-/.f64N/A
lower--.f6458.8
Applied rewrites58.8%
Taylor expanded in a around inf
Applied rewrites71.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- t x) (/ (- y z) a) x)))
(if (<= a -1.12e+18)
t_1
(if (<= a 1.78e+37) (* t (/ (- y z) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t - x), ((y - z) / a), x);
double tmp;
if (a <= -1.12e+18) {
tmp = t_1;
} else if (a <= 1.78e+37) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t - x), Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -1.12e+18) tmp = t_1; elseif (a <= 1.78e+37) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.12e+18], t$95$1, If[LessEqual[a, 1.78e+37], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -1.12 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.78 \cdot 10^{+37}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.12e18 or 1.78e37 < a Initial program 68.9%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6477.3
Applied rewrites77.3%
if -1.12e18 < a < 1.78e37Initial program 67.7%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites83.9%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6461.9
Applied rewrites61.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (/ (- y z) (- a z)))))
(if (<= z -2.05e-63)
t_1
(if (<= z 8.5e-59)
(fma y (/ (- t x) a) x)
(if (<= z 4.6e+79) (/ (* (- t x) y) (- a z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * ((y - z) / (a - z));
double tmp;
if (z <= -2.05e-63) {
tmp = t_1;
} else if (z <= 8.5e-59) {
tmp = fma(y, ((t - x) / a), x);
} else if (z <= 4.6e+79) {
tmp = ((t - x) * y) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t * Float64(Float64(y - z) / Float64(a - z))) tmp = 0.0 if (z <= -2.05e-63) tmp = t_1; elseif (z <= 8.5e-59) tmp = fma(y, Float64(Float64(t - x) / a), x); elseif (z <= 4.6e+79) tmp = Float64(Float64(Float64(t - x) * y) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.05e-63], t$95$1, If[LessEqual[z, 8.5e-59], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 4.6e+79], N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y - z}{a - z}\\
\mathbf{if}\;z \leq -2.05 \cdot 10^{-63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-59}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+79}:\\
\;\;\;\;\frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.0499999999999999e-63 or 4.6000000000000001e79 < z Initial program 46.8%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites84.1%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6460.0
Applied rewrites60.0%
if -2.0499999999999999e-63 < z < 8.49999999999999933e-59Initial program 90.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6477.0
Applied rewrites77.0%
if 8.49999999999999933e-59 < z < 4.6000000000000001e79Initial program 77.5%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6439.4
Applied rewrites39.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- t x) a) x)))
(if (<= a -1.3e+18)
t_1
(if (<= a 1.6e+109) (* t (/ (- y z) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -1.3e+18) {
tmp = t_1;
} else if (a <= 1.6e+109) {
tmp = t * ((y - z) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -1.3e+18) tmp = t_1; elseif (a <= 1.6e+109) tmp = Float64(t * Float64(Float64(y - z) / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.3e+18], t$95$1, If[LessEqual[a, 1.6e+109], N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -1.3 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.6 \cdot 10^{+109}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.3e18 or 1.6000000000000001e109 < a Initial program 68.6%
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%
if -1.3e18 < a < 1.6000000000000001e109Initial program 68.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites84.4%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6460.5
Applied rewrites60.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ t (* y (/ x z))))) (if (<= z -1.45e+30) t_1 (if (<= z 8.5e-59) (fma y (/ (- t x) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t + (y * (x / z));
double tmp;
if (z <= -1.45e+30) {
tmp = t_1;
} else if (z <= 8.5e-59) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t + Float64(y * Float64(x / z))) tmp = 0.0 if (z <= -1.45e+30) tmp = t_1; elseif (z <= 8.5e-59) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t + N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.45e+30], t$95$1, If[LessEqual[z, 8.5e-59], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + y \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-59}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.4499999999999999e30 or 8.49999999999999933e-59 < z Initial program 48.7%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites84.5%
Taylor expanded in a around 0
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lift--.f64N/A
lower-*.f6443.6
Applied rewrites43.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6463.6
Applied rewrites63.6%
Taylor expanded in x around inf
lift-/.f6455.5
Applied rewrites55.5%
if -1.4499999999999999e30 < z < 8.49999999999999933e-59Initial program 89.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.7
Applied rewrites73.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ t (* y (/ x z))))) (if (<= z -8.5e+16) t_1 (if (<= z 8.5e-59) (fma y (/ t a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t + (y * (x / z));
double tmp;
if (z <= -8.5e+16) {
tmp = t_1;
} else if (z <= 8.5e-59) {
tmp = fma(y, (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t + Float64(y * Float64(x / z))) tmp = 0.0 if (z <= -8.5e+16) tmp = t_1; elseif (z <= 8.5e-59) tmp = fma(y, Float64(t / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t + N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+16], t$95$1, If[LessEqual[z, 8.5e-59], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + y \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-59}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.5e16 or 8.49999999999999933e-59 < z Initial program 49.1%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites84.6%
Taylor expanded in a around 0
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lift--.f64N/A
lower-*.f6443.6
Applied rewrites43.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
Taylor expanded in x around inf
lift-/.f6455.2
Applied rewrites55.2%
if -8.5e16 < z < 8.49999999999999933e-59Initial program 89.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6474.1
Applied rewrites74.1%
Taylor expanded in x around 0
Applied rewrites60.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.6e+63) t (if (<= z 3.2e-51) (fma y (/ t a) x) (if (<= z 9e+72) (/ (* x y) z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.6e+63) {
tmp = t;
} else if (z <= 3.2e-51) {
tmp = fma(y, (t / a), x);
} else if (z <= 9e+72) {
tmp = (x * y) / z;
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.6e+63) tmp = t; elseif (z <= 3.2e-51) tmp = fma(y, Float64(t / a), x); elseif (z <= 9e+72) tmp = Float64(Float64(x * y) / z); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.6e+63], t, If[LessEqual[z, 3.2e-51], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 9e+72], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+63}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+72}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.6000000000000001e63 or 8.9999999999999997e72 < z Initial program 39.2%
Taylor expanded in z around inf
Applied rewrites47.7%
if -2.6000000000000001e63 < z < 3.2e-51Initial program 88.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6472.0
Applied rewrites72.0%
Taylor expanded in x around 0
Applied rewrites59.3%
if 3.2e-51 < z < 8.9999999999999997e72Initial program 77.4%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.8%
Taylor expanded in a around 0
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lift--.f64N/A
lower-*.f6445.9
Applied rewrites45.9%
Taylor expanded in x around inf
lift-*.f6419.0
Applied rewrites19.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ t a) x))) (if (<= a -6e-46) t_1 (if (<= a 3.1e-80) (/ (* t (- z y)) z) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (t / a), x);
double tmp;
if (a <= -6e-46) {
tmp = t_1;
} else if (a <= 3.1e-80) {
tmp = (t * (z - y)) / z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(t / a), x) tmp = 0.0 if (a <= -6e-46) tmp = t_1; elseif (a <= 3.1e-80) tmp = Float64(Float64(t * Float64(z - y)) / z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -6e-46], t$95$1, If[LessEqual[a, 3.1e-80], N[(N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{if}\;a \leq -6 \cdot 10^{-46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.1 \cdot 10^{-80}:\\
\;\;\;\;\frac{t \cdot \left(z - y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.99999999999999975e-46 or 3.10000000000000016e-80 < a Initial program 69.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6461.9
Applied rewrites61.9%
Taylor expanded in x around 0
Applied rewrites54.0%
if -5.99999999999999975e-46 < a < 3.10000000000000016e-80Initial program 67.1%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites83.0%
Taylor expanded in a around 0
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lift--.f64N/A
lower-*.f6465.3
Applied rewrites65.3%
Taylor expanded in x around 0
lower-*.f64N/A
lift--.f6443.8
Applied rewrites43.8%
(FPCore (x y z t a) :precision binary64 (if (<= y -4.5e+146) (/ (* t y) a) (if (<= y 3.3e+187) (+ x t) (/ (* x y) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -4.5e+146) {
tmp = (t * y) / a;
} else if (y <= 3.3e+187) {
tmp = x + t;
} else {
tmp = (x * y) / z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-4.5d+146)) then
tmp = (t * y) / a
else if (y <= 3.3d+187) then
tmp = x + t
else
tmp = (x * y) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -4.5e+146) {
tmp = (t * y) / a;
} else if (y <= 3.3e+187) {
tmp = x + t;
} else {
tmp = (x * y) / z;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -4.5e+146: tmp = (t * y) / a elif y <= 3.3e+187: tmp = x + t else: tmp = (x * y) / z return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -4.5e+146) tmp = Float64(Float64(t * y) / a); elseif (y <= 3.3e+187) tmp = Float64(x + t); else tmp = Float64(Float64(x * y) / z); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -4.5e+146) tmp = (t * y) / a; elseif (y <= 3.3e+187) tmp = x + t; else tmp = (x * y) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -4.5e+146], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 3.3e+187], N[(x + t), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+146}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+187}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\end{array}
\end{array}
if y < -4.50000000000000026e146Initial program 68.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6459.1
Applied rewrites59.1%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6429.9
Applied rewrites29.9%
if -4.50000000000000026e146 < y < 3.3000000000000001e187Initial program 68.1%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-/l*N/A
flip--N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lift--.f6449.8
Applied rewrites49.8%
Taylor expanded in z around inf
lift--.f6422.1
Applied rewrites22.1%
Taylor expanded in x around 0
Applied rewrites39.8%
if 3.3000000000000001e187 < y Initial program 68.6%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-fma.f64N/A
sub-divN/A
negate-sub2N/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites86.2%
Taylor expanded in a around 0
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lift--.f64N/A
lower-*.f6442.1
Applied rewrites42.1%
Taylor expanded in x around inf
lift-*.f6427.5
Applied rewrites27.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* t y) a))) (if (<= y -4.5e+146) t_1 (if (<= y 2.8e+102) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double tmp;
if (y <= -4.5e+146) {
tmp = t_1;
} else if (y <= 2.8e+102) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (t * y) / a
if (y <= (-4.5d+146)) then
tmp = t_1
else if (y <= 2.8d+102) then
tmp = x + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / a;
double tmp;
if (y <= -4.5e+146) {
tmp = t_1;
} else if (y <= 2.8e+102) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t * y) / a tmp = 0 if y <= -4.5e+146: tmp = t_1 elif y <= 2.8e+102: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t * y) / a) tmp = 0.0 if (y <= -4.5e+146) tmp = t_1; elseif (y <= 2.8e+102) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t * y) / a; tmp = 0.0; if (y <= -4.5e+146) tmp = t_1; elseif (y <= 2.8e+102) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[y, -4.5e+146], t$95$1, If[LessEqual[y, 2.8e+102], N[(x + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t \cdot y}{a}\\
\mathbf{if}\;y \leq -4.5 \cdot 10^{+146}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+102}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.50000000000000026e146 or 2.80000000000000018e102 < y Initial program 68.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6457.4
Applied rewrites57.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6428.0
Applied rewrites28.0%
if -4.50000000000000026e146 < y < 2.80000000000000018e102Initial program 68.1%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
associate-/l*N/A
flip--N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lift--.f6451.2
Applied rewrites51.2%
Taylor expanded in z around inf
lift--.f6422.8
Applied rewrites22.8%
Taylor expanded in x around 0
Applied rewrites41.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.3e+130) x (if (<= a 1.25e+93) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.3e+130) {
tmp = x;
} else if (a <= 1.25e+93) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-4.3d+130)) then
tmp = x
else if (a <= 1.25d+93) then
tmp = t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.3e+130) {
tmp = x;
} else if (a <= 1.25e+93) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.3e+130: tmp = x elif a <= 1.25e+93: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.3e+130) tmp = x; elseif (a <= 1.25e+93) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -4.3e+130) tmp = x; elseif (a <= 1.25e+93) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.3e+130], x, If[LessEqual[a, 1.25e+93], t, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.3 \cdot 10^{+130}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{+93}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -4.29999999999999984e130 or 1.25e93 < a Initial program 68.5%
Taylor expanded in a around inf
Applied rewrites53.2%
if -4.29999999999999984e130 < a < 1.25e93Initial program 68.1%
Taylor expanded in z around inf
Applied rewrites31.1%
(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 68.2%
Taylor expanded in z around inf
Applied rewrites24.6%
herbie shell --seed 2025110
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
(+ x (/ (* (- y z) (- t x)) (- a z))))