
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
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) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
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) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 (- INFINITY))
(/ (* t y) (- a z))
(if (<= t_1 50.0)
(+ x (* y t_1))
(+ x (* (fma y (/ z (* (- z a) t)) (- (/ y (- z a)))) t))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (t * y) / (a - z);
} else if (t_1 <= 50.0) {
tmp = x + (y * t_1);
} else {
tmp = x + (fma(y, (z / ((z - a) * t)), -(y / (z - a))) * t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(t * y) / Float64(a - z)); elseif (t_1 <= 50.0) tmp = Float64(x + Float64(y * t_1)); else tmp = Float64(x + Float64(fma(y, Float64(z / Float64(Float64(z - a) * t)), Float64(-Float64(y / Float64(z - a)))) * t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 50.0], N[(x + N[(y * t$95$1), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(z / N[(N[(z - a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + (-N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision])), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{t \cdot y}{a - z}\\
\mathbf{elif}\;t\_1 \leq 50:\\
\;\;\;\;x + y \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(y, \frac{z}{\left(z - a\right) \cdot t}, -\frac{y}{z - a}\right) \cdot t\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -inf.0Initial program 65.7%
Taylor expanded in t around inf
associate-*r/N/A
mul-1-negN/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6490.6
Applied rewrites90.6%
if -inf.0 < (/.f64 (-.f64 z t) (-.f64 z a)) < 50Initial program 99.6%
if 50 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 95.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lift--.f6494.9
Applied rewrites94.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- z a))) (t_2 (/ (* t y) (- a z)))) (if (<= t_1 (- INFINITY)) t_2 (if (<= t_1 5e+286) (+ x (* y t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (t * y) / (a - z);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= 5e+286) {
tmp = x + (y * t_1);
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (t * y) / (a - z);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_1 <= 5e+286) {
tmp = x + (y * t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = (t * y) / (a - z) tmp = 0 if t_1 <= -math.inf: tmp = t_2 elif t_1 <= 5e+286: tmp = x + (y * t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(Float64(t * y) / Float64(a - z)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_2; elseif (t_1 <= 5e+286) tmp = Float64(x + Float64(y * t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = (t * y) / (a - z); tmp = 0.0; if (t_1 <= -Inf) tmp = t_2; elseif (t_1 <= 5e+286) tmp = x + (y * t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, 5e+286], N[(x + N[(y * t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \frac{t \cdot y}{a - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;x + y \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -inf.0 or 5.0000000000000004e286 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 69.5%
Taylor expanded in t around inf
associate-*r/N/A
mul-1-negN/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6490.8
Applied rewrites90.8%
if -inf.0 < (/.f64 (-.f64 z t) (-.f64 z a)) < 5.0000000000000004e286Initial program 99.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (/ (* t y) (- a z))))
(if (<= t_1 -5e+44)
t_2
(if (<= t_1 -2e-31)
(fma (/ t a) y x)
(if (<= t_1 10000000000000.0) (fma y (/ z (- z a)) x) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (t * y) / (a - z);
double tmp;
if (t_1 <= -5e+44) {
tmp = t_2;
} else if (t_1 <= -2e-31) {
tmp = fma((t / a), y, x);
} else if (t_1 <= 10000000000000.0) {
tmp = fma(y, (z / (z - a)), x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(Float64(t * y) / Float64(a - z)) tmp = 0.0 if (t_1 <= -5e+44) tmp = t_2; elseif (t_1 <= -2e-31) tmp = fma(Float64(t / a), y, x); elseif (t_1 <= 10000000000000.0) tmp = fma(y, Float64(z / Float64(z - a)), x); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+44], t$95$2, If[LessEqual[t$95$1, -2e-31], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 10000000000000.0], N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \frac{t \cdot y}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+44}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 10000000000000:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{z - a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.9999999999999996e44 or 1e13 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 94.7%
Taylor expanded in t around inf
associate-*r/N/A
mul-1-negN/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6466.1
Applied rewrites66.1%
if -4.9999999999999996e44 < (/.f64 (-.f64 z t) (-.f64 z a)) < -2e-31Initial program 99.8%
Taylor expanded in z around 0
lower-/.f6470.0
Applied rewrites70.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6470.0
Applied rewrites70.0%
if -2e-31 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e13Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6491.4
Applied rewrites91.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (/ (* t y) (- a z))))
(if (<= t_1 -5e+44)
t_2
(if (<= t_1 -2e-31)
(fma (/ t a) y x)
(if (<= t_1 2e-87)
(+ (- (/ (* z y) a)) x)
(if (<= t_1 10000000000000.0) (+ x y) t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (t * y) / (a - z);
double tmp;
if (t_1 <= -5e+44) {
tmp = t_2;
} else if (t_1 <= -2e-31) {
tmp = fma((t / a), y, x);
} else if (t_1 <= 2e-87) {
tmp = -((z * y) / a) + x;
} else if (t_1 <= 10000000000000.0) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(Float64(t * y) / Float64(a - z)) tmp = 0.0 if (t_1 <= -5e+44) tmp = t_2; elseif (t_1 <= -2e-31) tmp = fma(Float64(t / a), y, x); elseif (t_1 <= 2e-87) tmp = Float64(Float64(-Float64(Float64(z * y) / a)) + x); elseif (t_1 <= 10000000000000.0) tmp = Float64(x + y); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+44], t$95$2, If[LessEqual[t$95$1, -2e-31], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 2e-87], N[((-N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]) + x), $MachinePrecision], If[LessEqual[t$95$1, 10000000000000.0], N[(x + y), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \frac{t \cdot y}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+44}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-87}:\\
\;\;\;\;\left(-\frac{z \cdot y}{a}\right) + x\\
\mathbf{elif}\;t\_1 \leq 10000000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.9999999999999996e44 or 1e13 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 94.7%
Taylor expanded in t around inf
associate-*r/N/A
mul-1-negN/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6466.1
Applied rewrites66.1%
if -4.9999999999999996e44 < (/.f64 (-.f64 z t) (-.f64 z a)) < -2e-31Initial program 99.8%
Taylor expanded in z around 0
lower-/.f6470.0
Applied rewrites70.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6470.0
Applied rewrites70.0%
if -2e-31 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000004e-87Initial program 98.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6486.3
Applied rewrites86.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6484.1
Applied rewrites84.1%
if 2.00000000000000004e-87 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e13Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites90.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (/ (* t y) (- a z))))
(if (<= t_1 -5e+44)
t_2
(if (<= t_1 2e-87)
(fma (/ t a) y x)
(if (<= t_1 10000000000000.0) (+ x y) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (t * y) / (a - z);
double tmp;
if (t_1 <= -5e+44) {
tmp = t_2;
} else if (t_1 <= 2e-87) {
tmp = fma((t / a), y, x);
} else if (t_1 <= 10000000000000.0) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(Float64(t * y) / Float64(a - z)) tmp = 0.0 if (t_1 <= -5e+44) tmp = t_2; elseif (t_1 <= 2e-87) tmp = fma(Float64(t / a), y, x); elseif (t_1 <= 10000000000000.0) tmp = Float64(x + y); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+44], t$95$2, If[LessEqual[t$95$1, 2e-87], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 10000000000000.0], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \frac{t \cdot y}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+44}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-87}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 10000000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.9999999999999996e44 or 1e13 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 94.7%
Taylor expanded in t around inf
associate-*r/N/A
mul-1-negN/A
negate-sub2N/A
frac-2neg-revN/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6466.1
Applied rewrites66.1%
if -4.9999999999999996e44 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000004e-87Initial program 99.0%
Taylor expanded in z around 0
lower-/.f6483.5
Applied rewrites83.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6483.5
Applied rewrites83.5%
if 2.00000000000000004e-87 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e13Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites90.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (- (* t (/ y z)))))
(if (<= t_1 -4e+252)
t_2
(if (<= t_1 2e-87) (fma (/ t a) y x) (if (<= t_1 4e+40) (+ x y) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = -(t * (y / z));
double tmp;
if (t_1 <= -4e+252) {
tmp = t_2;
} else if (t_1 <= 2e-87) {
tmp = fma((t / a), y, x);
} else if (t_1 <= 4e+40) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(-Float64(t * Float64(y / z))) tmp = 0.0 if (t_1 <= -4e+252) tmp = t_2; elseif (t_1 <= 2e-87) tmp = fma(Float64(t / a), y, x); elseif (t_1 <= 4e+40) tmp = Float64(x + y); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t$95$1, -4e+252], t$95$2, If[LessEqual[t$95$1, 2e-87], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 4e+40], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := -t \cdot \frac{y}{z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+252}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-87}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+40}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.0000000000000004e252 or 4.00000000000000012e40 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 91.2%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6457.3
Applied rewrites57.3%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f6444.6
Applied rewrites44.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6446.1
Applied rewrites46.1%
if -4.0000000000000004e252 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000004e-87Initial program 99.2%
Taylor expanded in z around 0
lower-/.f6478.8
Applied rewrites78.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6478.8
Applied rewrites78.8%
if 2.00000000000000004e-87 < (/.f64 (-.f64 z t) (-.f64 z a)) < 4.00000000000000012e40Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites88.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 2e-87)
(fma t (/ y a) x)
(if (<= t_1 4e+40) (+ x y) (- (* t (/ y z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= 2e-87) {
tmp = fma(t, (y / a), x);
} else if (t_1 <= 4e+40) {
tmp = x + y;
} else {
tmp = -(t * (y / z));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= 2e-87) tmp = fma(t, Float64(y / a), x); elseif (t_1 <= 4e+40) tmp = Float64(x + y); else tmp = Float64(-Float64(t * Float64(y / z))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-87], N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 4e+40], N[(x + y), $MachinePrecision], (-N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision])]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-87}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+40}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-t \cdot \frac{y}{z}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000004e-87Initial program 97.5%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6477.2
Applied rewrites77.2%
if 2.00000000000000004e-87 < (/.f64 (-.f64 z t) (-.f64 z a)) < 4.00000000000000012e40Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites88.6%
if 4.00000000000000012e40 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 94.6%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6459.1
Applied rewrites59.1%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f6442.0
Applied rewrites42.0%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6443.9
Applied rewrites43.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (- (* t (/ y z)))))
(if (<= t_1 -5e+36)
t_2
(if (<= t_1 2e-87) x (if (<= t_1 4e+40) (+ x y) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = -(t * (y / z));
double tmp;
if (t_1 <= -5e+36) {
tmp = t_2;
} else if (t_1 <= 2e-87) {
tmp = x;
} else if (t_1 <= 4e+40) {
tmp = x + y;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (z - t) / (z - a)
t_2 = -(t * (y / z))
if (t_1 <= (-5d+36)) then
tmp = t_2
else if (t_1 <= 2d-87) then
tmp = x
else if (t_1 <= 4d+40) then
tmp = x + y
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = -(t * (y / z));
double tmp;
if (t_1 <= -5e+36) {
tmp = t_2;
} else if (t_1 <= 2e-87) {
tmp = x;
} else if (t_1 <= 4e+40) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = -(t * (y / z)) tmp = 0 if t_1 <= -5e+36: tmp = t_2 elif t_1 <= 2e-87: tmp = x elif t_1 <= 4e+40: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(-Float64(t * Float64(y / z))) tmp = 0.0 if (t_1 <= -5e+36) tmp = t_2; elseif (t_1 <= 2e-87) tmp = x; elseif (t_1 <= 4e+40) tmp = Float64(x + y); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = -(t * (y / z)); tmp = 0.0; if (t_1 <= -5e+36) tmp = t_2; elseif (t_1 <= 2e-87) tmp = x; elseif (t_1 <= 4e+40) tmp = x + y; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t$95$1, -5e+36], t$95$2, If[LessEqual[t$95$1, 2e-87], x, If[LessEqual[t$95$1, 4e+40], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := -t \cdot \frac{y}{z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+36}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-87}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+40}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999977e36 or 4.00000000000000012e40 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 94.5%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6458.9
Applied rewrites58.9%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f6440.9
Applied rewrites40.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6442.4
Applied rewrites42.4%
if -4.99999999999999977e36 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000004e-87Initial program 99.0%
Taylor expanded in x around inf
Applied rewrites70.9%
if 2.00000000000000004e-87 < (/.f64 (-.f64 z t) (-.f64 z a)) < 4.00000000000000012e40Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites88.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (* (/ y a) t)))
(if (<= t_1 -5e+49)
t_2
(if (<= t_1 2e-87) x (if (<= t_1 5e+130) (+ x y) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (y / a) * t;
double tmp;
if (t_1 <= -5e+49) {
tmp = t_2;
} else if (t_1 <= 2e-87) {
tmp = x;
} else if (t_1 <= 5e+130) {
tmp = x + y;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (z - t) / (z - a)
t_2 = (y / a) * t
if (t_1 <= (-5d+49)) then
tmp = t_2
else if (t_1 <= 2d-87) then
tmp = x
else if (t_1 <= 5d+130) then
tmp = x + y
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (y / a) * t;
double tmp;
if (t_1 <= -5e+49) {
tmp = t_2;
} else if (t_1 <= 2e-87) {
tmp = x;
} else if (t_1 <= 5e+130) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = (y / a) * t tmp = 0 if t_1 <= -5e+49: tmp = t_2 elif t_1 <= 2e-87: tmp = x elif t_1 <= 5e+130: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(Float64(y / a) * t) tmp = 0.0 if (t_1 <= -5e+49) tmp = t_2; elseif (t_1 <= 2e-87) tmp = x; elseif (t_1 <= 5e+130) tmp = Float64(x + y); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = (y / a) * t; tmp = 0.0; if (t_1 <= -5e+49) tmp = t_2; elseif (t_1 <= 2e-87) tmp = x; elseif (t_1 <= 5e+130) tmp = x + y; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+49], t$95$2, If[LessEqual[t$95$1, 2e-87], x, If[LessEqual[t$95$1, 5e+130], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \frac{y}{a} \cdot t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+49}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-87}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+130}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -5.0000000000000004e49 or 4.9999999999999996e130 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 92.8%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6464.8
Applied rewrites64.8%
Taylor expanded in x around 0
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6448.2
Applied rewrites48.2%
if -5.0000000000000004e49 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000004e-87Initial program 99.0%
Taylor expanded in x around inf
Applied rewrites70.0%
if 2.00000000000000004e-87 < (/.f64 (-.f64 z t) (-.f64 z a)) < 4.9999999999999996e130Initial program 99.9%
Taylor expanded in z around inf
Applied rewrites82.8%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (- z t) (- z a)) 5e-87) x (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z - t) / (z - a)) <= 5e-87) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (((z - t) / (z - a)) <= 5d-87) then
tmp = x
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z - t) / (z - a)) <= 5e-87) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((z - t) / (z - a)) <= 5e-87: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(z - t) / Float64(z - a)) <= 5e-87) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((z - t) / (z - a)) <= 5e-87) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], 5e-87], x, N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z - t}{z - a} \leq 5 \cdot 10^{-87}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 5.00000000000000042e-87Initial program 97.5%
Taylor expanded in x around inf
Applied rewrites57.9%
if 5.00000000000000042e-87 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 98.6%
Taylor expanded in z around inf
Applied rewrites73.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- z a)))) (if (<= t_1 0.9999999999618374) x (if (<= t_1 1.000000001) y x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= 0.9999999999618374) {
tmp = x;
} else if (t_1 <= 1.000000001) {
tmp = y;
} 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) :: t_1
real(8) :: tmp
t_1 = (z - t) / (z - a)
if (t_1 <= 0.9999999999618374d0) then
tmp = x
else if (t_1 <= 1.000000001d0) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= 0.9999999999618374) {
tmp = x;
} else if (t_1 <= 1.000000001) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) tmp = 0 if t_1 <= 0.9999999999618374: tmp = x elif t_1 <= 1.000000001: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= 0.9999999999618374) tmp = x; elseif (t_1 <= 1.000000001) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); tmp = 0.0; if (t_1 <= 0.9999999999618374) tmp = x; elseif (t_1 <= 1.000000001) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.9999999999618374], x, If[LessEqual[t$95$1, 1.000000001], y, x]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq 0.9999999999618374:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 1.000000001:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 0.99999999996183742 or 1.0000000010000001 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.3%
Taylor expanded in x around inf
Applied rewrites50.8%
if 0.99999999996183742 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.0000000010000001Initial program 100.0%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
*-commutativeN/A
negate-subN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
negate-subN/A
lower--.f64N/A
lower-/.f6449.4
Applied rewrites49.4%
Taylor expanded in z around inf
Applied rewrites49.3%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return 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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.1%
Taylor expanded in x around inf
Applied rewrites51.2%
herbie shell --seed 2025110
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
(+ x (* y (/ (- z t) (- z a)))))