
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 = x + (y * ((z - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 = x + (y * ((z - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- a t)))) (if (<= t_1 (- INFINITY)) (* z (/ y (- a t))) (+ x (* y t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = z * (y / (a - t));
} else {
tmp = x + (y * t_1);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = z * (y / (a - t));
} else {
tmp = x + (y * t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) tmp = 0 if t_1 <= -math.inf: tmp = z * (y / (a - t)) else: tmp = x + (y * t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(z * Float64(y / Float64(a - t))); else tmp = Float64(x + Float64(y * t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (a - t); tmp = 0.0; if (t_1 <= -Inf) tmp = z * (y / (a - t)); else tmp = x + (y * t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -inf.0Initial program 59.9%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6491.1
Applied rewrites91.1%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f641.8
Applied rewrites1.8%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6411.5
Applied rewrites11.5%
Taylor expanded in z around inf
Applied rewrites91.1%
if -inf.0 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 98.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ z (- a t))))) (t_2 (/ (- z t) (- a t))))
(if (<= t_2 (- INFINITY))
(* z (/ y (- a t)))
(if (<= t_2 -5e+16)
t_1
(if (<= t_2 4e-21)
(fma y (/ (- z t) a) x)
(if (<= t_2 1.0) (fma (/ (- t) (- a t)) y x) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (z / (a - t)));
double t_2 = (z - t) / (a - t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = z * (y / (a - t));
} else if (t_2 <= -5e+16) {
tmp = t_1;
} else if (t_2 <= 4e-21) {
tmp = fma(y, ((z - t) / a), x);
} else if (t_2 <= 1.0) {
tmp = fma((-t / (a - t)), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(z / Float64(a - t)))) t_2 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(z * Float64(y / Float64(a - t))); elseif (t_2 <= -5e+16) tmp = t_1; elseif (t_2 <= 4e-21) tmp = fma(y, Float64(Float64(z - t) / a), x); elseif (t_2 <= 1.0) tmp = fma(Float64(Float64(-t) / Float64(a - t)), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -5e+16], t$95$1, If[LessEqual[t$95$2, 4e-21], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 1.0], N[(N[((-t) / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{a - t}\\
t_2 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;z \cdot \frac{y}{a - t}\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
\mathbf{elif}\;t\_2 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{a - t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -inf.0Initial program 59.9%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6491.1
Applied rewrites91.1%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f641.8
Applied rewrites1.8%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6411.5
Applied rewrites11.5%
Taylor expanded in z around inf
Applied rewrites91.1%
if -inf.0 < (/.f64 (-.f64 z t) (-.f64 a t)) < -5e16 or 1 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.4%
Taylor expanded in z around inf
Applied rewrites95.1%
if -5e16 < (/.f64 (-.f64 z t) (-.f64 a t)) < 3.99999999999999963e-21Initial program 99.1%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6497.2
Applied rewrites97.2%
if 3.99999999999999963e-21 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1Initial program 100.0%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6498.5
Applied rewrites98.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.5
Applied rewrites98.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ z (- a t))))) (t_2 (/ (- z t) (- a t))))
(if (<= t_2 (- INFINITY))
(* z (/ y (- a t)))
(if (<= t_2 -5e+16)
t_1
(if (<= t_2 4e-19)
(fma y (/ (- z t) a) x)
(if (<= t_2 1.0) (+ x y) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (z / (a - t)));
double t_2 = (z - t) / (a - t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = z * (y / (a - t));
} else if (t_2 <= -5e+16) {
tmp = t_1;
} else if (t_2 <= 4e-19) {
tmp = fma(y, ((z - t) / a), x);
} else if (t_2 <= 1.0) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(z / Float64(a - t)))) t_2 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(z * Float64(y / Float64(a - t))); elseif (t_2 <= -5e+16) tmp = t_1; elseif (t_2 <= 4e-19) tmp = fma(y, Float64(Float64(z - t) / a), x); elseif (t_2 <= 1.0) tmp = Float64(x + y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -5e+16], t$95$1, If[LessEqual[t$95$2, 4e-19], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 1.0], N[(x + y), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{a - t}\\
t_2 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;z \cdot \frac{y}{a - t}\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
\mathbf{elif}\;t\_2 \leq 1:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -inf.0Initial program 59.9%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6491.1
Applied rewrites91.1%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f641.8
Applied rewrites1.8%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6411.5
Applied rewrites11.5%
Taylor expanded in z around inf
Applied rewrites91.1%
if -inf.0 < (/.f64 (-.f64 z t) (-.f64 a t)) < -5e16 or 1 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.4%
Taylor expanded in z around inf
Applied rewrites95.1%
if -5e16 < (/.f64 (-.f64 z t) (-.f64 a t)) < 3.9999999999999999e-19Initial program 99.1%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6497.2
Applied rewrites97.2%
if 3.9999999999999999e-19 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1Initial program 100.0%
Taylor expanded in t around inf
Applied rewrites97.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (/ y (- a t))))
(if (<= t_1 -5e+197)
(* z t_2)
(if (<= t_1 4e-19)
(fma y (/ (- z t) a) x)
(if (<= t_1 2.5e+15) (+ x y) (* (- z t) t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = y / (a - t);
double tmp;
if (t_1 <= -5e+197) {
tmp = z * t_2;
} else if (t_1 <= 4e-19) {
tmp = fma(y, ((z - t) / a), x);
} else if (t_1 <= 2.5e+15) {
tmp = x + y;
} else {
tmp = (z - t) * t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(y / Float64(a - t)) tmp = 0.0 if (t_1 <= -5e+197) tmp = Float64(z * t_2); elseif (t_1 <= 4e-19) tmp = fma(y, Float64(Float64(z - t) / a), x); elseif (t_1 <= 2.5e+15) tmp = Float64(x + y); else tmp = Float64(Float64(z - t) * t_2); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+197], N[(z * t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 4e-19], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2.5e+15], N[(x + y), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := \frac{y}{a - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+197}:\\
\;\;\;\;z \cdot t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 2.5 \cdot 10^{+15}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\left(z - t\right) \cdot t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -5.00000000000000009e197Initial program 85.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6484.8
Applied rewrites84.8%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f641.8
Applied rewrites1.8%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f646.9
Applied rewrites6.9%
Taylor expanded in z around inf
Applied rewrites85.0%
if -5.00000000000000009e197 < (/.f64 (-.f64 z t) (-.f64 a t)) < 3.9999999999999999e-19Initial program 99.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6489.7
Applied rewrites89.7%
if 3.9999999999999999e-19 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2.5e15Initial program 100.0%
Taylor expanded in t around inf
Applied rewrites94.8%
if 2.5e15 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 95.0%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6462.5
Applied rewrites62.5%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6465.9
Applied rewrites65.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (* z (/ y (- a t)))))
(if (<= t_1 -5e+197)
t_2
(if (<= t_1 4e-19)
(fma y (/ (- z t) a) x)
(if (<= t_1 2.5e+15) (+ x y) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = z * (y / (a - t));
double tmp;
if (t_1 <= -5e+197) {
tmp = t_2;
} else if (t_1 <= 4e-19) {
tmp = fma(y, ((z - t) / a), x);
} else if (t_1 <= 2.5e+15) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(z * Float64(y / Float64(a - t))) tmp = 0.0 if (t_1 <= -5e+197) tmp = t_2; elseif (t_1 <= 4e-19) tmp = fma(y, Float64(Float64(z - t) / a), x); elseif (t_1 <= 2.5e+15) 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+197], t$95$2, If[LessEqual[t$95$1, 4e-19], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2.5e+15], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := z \cdot \frac{y}{a - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+197}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 2.5 \cdot 10^{+15}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -5.00000000000000009e197 or 2.5e15 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 92.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6468.1
Applied rewrites68.1%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f645.0
Applied rewrites5.0%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f647.6
Applied rewrites7.6%
Taylor expanded in z around inf
Applied rewrites70.6%
if -5.00000000000000009e197 < (/.f64 (-.f64 z t) (-.f64 a t)) < 3.9999999999999999e-19Initial program 99.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6489.7
Applied rewrites89.7%
if 3.9999999999999999e-19 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2.5e15Initial program 100.0%
Taylor expanded in t around inf
Applied rewrites94.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (* z (/ y (- a t)))))
(if (<= t_1 -5e+197)
t_2
(if (<= t_1 4e-21) (fma y (/ z a) x) (if (<= t_1 2.5e+15) (+ x y) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = z * (y / (a - t));
double tmp;
if (t_1 <= -5e+197) {
tmp = t_2;
} else if (t_1 <= 4e-21) {
tmp = fma(y, (z / a), x);
} else if (t_1 <= 2.5e+15) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(z * Float64(y / Float64(a - t))) tmp = 0.0 if (t_1 <= -5e+197) tmp = t_2; elseif (t_1 <= 4e-21) tmp = fma(y, Float64(z / a), x); elseif (t_1 <= 2.5e+15) 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+197], t$95$2, If[LessEqual[t$95$1, 4e-21], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2.5e+15], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := z \cdot \frac{y}{a - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+197}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 2.5 \cdot 10^{+15}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -5.00000000000000009e197 or 2.5e15 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 92.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6468.1
Applied rewrites68.1%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f645.0
Applied rewrites5.0%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f647.6
Applied rewrites7.6%
Taylor expanded in z around inf
Applied rewrites70.6%
if -5.00000000000000009e197 < (/.f64 (-.f64 z t) (-.f64 a t)) < 3.99999999999999963e-21Initial program 99.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6479.8
Applied rewrites79.8%
if 3.99999999999999963e-21 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2.5e15Initial program 100.0%
Taylor expanded in t around inf
Applied rewrites94.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (* y (/ z (- a t)))))
(if (<= t_1 -5e+197)
t_2
(if (<= t_1 4e-21) (fma y (/ z a) x) (if (<= t_1 2.5e+15) (+ x y) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = y * (z / (a - t));
double tmp;
if (t_1 <= -5e+197) {
tmp = t_2;
} else if (t_1 <= 4e-21) {
tmp = fma(y, (z / a), x);
} else if (t_1 <= 2.5e+15) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(y * Float64(z / Float64(a - t))) tmp = 0.0 if (t_1 <= -5e+197) tmp = t_2; elseif (t_1 <= 4e-21) tmp = fma(y, Float64(z / a), x); elseif (t_1 <= 2.5e+15) 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+197], t$95$2, If[LessEqual[t$95$1, 4e-21], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2.5e+15], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := y \cdot \frac{z}{a - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+197}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 2.5 \cdot 10^{+15}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -5.00000000000000009e197 or 2.5e15 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 92.5%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6467.6
Applied rewrites67.6%
if -5.00000000000000009e197 < (/.f64 (-.f64 z t) (-.f64 a t)) < 3.99999999999999963e-21Initial program 99.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6479.8
Applied rewrites79.8%
if 3.99999999999999963e-21 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2.5e15Initial program 100.0%
Taylor expanded in t around inf
Applied rewrites94.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ z a) x)) (t_2 (/ (- z t) (- a t))))
(if (<= t_2 -2e+224)
(/ (* (- y) z) t)
(if (<= t_2 4e-21) t_1 (if (<= t_2 5e+21) (+ x y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (z / a), x);
double t_2 = (z - t) / (a - t);
double tmp;
if (t_2 <= -2e+224) {
tmp = (-y * z) / t;
} else if (t_2 <= 4e-21) {
tmp = t_1;
} else if (t_2 <= 5e+21) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(z / a), x) t_2 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_2 <= -2e+224) tmp = Float64(Float64(Float64(-y) * z) / t); elseif (t_2 <= 4e-21) tmp = t_1; elseif (t_2 <= 5e+21) tmp = Float64(x + y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+224], N[(N[((-y) * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t$95$2, 4e-21], t$95$1, If[LessEqual[t$95$2, 5e+21], N[(x + y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
t_2 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+224}:\\
\;\;\;\;\frac{\left(-y\right) \cdot z}{t}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+21}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -1.99999999999999994e224Initial program 81.9%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6473.2
Applied rewrites73.2%
Taylor expanded in t around inf
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6451.0
Applied rewrites51.0%
if -1.99999999999999994e224 < (/.f64 (-.f64 z t) (-.f64 a t)) < 3.99999999999999963e-21 or 5e21 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 98.1%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6474.8
Applied rewrites74.8%
if 3.99999999999999963e-21 < (/.f64 (-.f64 z t) (-.f64 a t)) < 5e21Initial program 100.0%
Taylor expanded in t around inf
Applied rewrites94.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (/ (* (- y) z) t)))
(if (<= t_1 -5e+197)
t_2
(if (<= t_1 2e-91) x (if (<= t_1 1e+143) (+ x y) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = (-y * z) / t;
double tmp;
if (t_1 <= -5e+197) {
tmp = t_2;
} else if (t_1 <= 2e-91) {
tmp = x;
} else if (t_1 <= 1e+143) {
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) / (a - t)
t_2 = (-y * z) / t
if (t_1 <= (-5d+197)) then
tmp = t_2
else if (t_1 <= 2d-91) then
tmp = x
else if (t_1 <= 1d+143) 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) / (a - t);
double t_2 = (-y * z) / t;
double tmp;
if (t_1 <= -5e+197) {
tmp = t_2;
} else if (t_1 <= 2e-91) {
tmp = x;
} else if (t_1 <= 1e+143) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) t_2 = (-y * z) / t tmp = 0 if t_1 <= -5e+197: tmp = t_2 elif t_1 <= 2e-91: tmp = x elif t_1 <= 1e+143: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(Float64(Float64(-y) * z) / t) tmp = 0.0 if (t_1 <= -5e+197) tmp = t_2; elseif (t_1 <= 2e-91) tmp = x; elseif (t_1 <= 1e+143) 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) / (a - t); t_2 = (-y * z) / t; tmp = 0.0; if (t_1 <= -5e+197) tmp = t_2; elseif (t_1 <= 2e-91) tmp = x; elseif (t_1 <= 1e+143) 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-y) * z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+197], t$95$2, If[LessEqual[t$95$1, 2e-91], x, If[LessEqual[t$95$1, 1e+143], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := \frac{\left(-y\right) \cdot z}{t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+197}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-91}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 10^{+143}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -5.00000000000000009e197 or 1e143 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 88.2%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6473.8
Applied rewrites73.8%
Taylor expanded in t around inf
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6449.1
Applied rewrites49.1%
if -5.00000000000000009e197 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2.00000000000000004e-91Initial program 99.1%
Taylor expanded in x around inf
Applied rewrites62.5%
if 2.00000000000000004e-91 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e143Initial program 99.9%
Taylor expanded in t around inf
Applied rewrites82.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 -5e+164)
(/ (* y z) a)
(if (<= t_1 2e-91) x (if (<= t_1 5e+23) (+ x y) (* y (/ z a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -5e+164) {
tmp = (y * z) / a;
} else if (t_1 <= 2e-91) {
tmp = x;
} else if (t_1 <= 5e+23) {
tmp = x + y;
} else {
tmp = y * (z / a);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (z - t) / (a - t)
if (t_1 <= (-5d+164)) then
tmp = (y * z) / a
else if (t_1 <= 2d-91) then
tmp = x
else if (t_1 <= 5d+23) then
tmp = x + y
else
tmp = y * (z / a)
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) / (a - t);
double tmp;
if (t_1 <= -5e+164) {
tmp = (y * z) / a;
} else if (t_1 <= 2e-91) {
tmp = x;
} else if (t_1 <= 5e+23) {
tmp = x + y;
} else {
tmp = y * (z / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) tmp = 0 if t_1 <= -5e+164: tmp = (y * z) / a elif t_1 <= 2e-91: tmp = x elif t_1 <= 5e+23: tmp = x + y else: tmp = y * (z / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= -5e+164) tmp = Float64(Float64(y * z) / a); elseif (t_1 <= 2e-91) tmp = x; elseif (t_1 <= 5e+23) tmp = Float64(x + y); else tmp = Float64(y * Float64(z / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (a - t); tmp = 0.0; if (t_1 <= -5e+164) tmp = (y * z) / a; elseif (t_1 <= 2e-91) tmp = x; elseif (t_1 <= 5e+23) tmp = x + y; else tmp = y * (z / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+164], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t$95$1, 2e-91], x, If[LessEqual[t$95$1, 5e+23], N[(x + y), $MachinePrecision], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+164}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-91}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+23}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -4.9999999999999995e164Initial program 87.9%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6482.5
Applied rewrites82.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6453.6
Applied rewrites53.6%
if -4.9999999999999995e164 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2.00000000000000004e-91Initial program 99.1%
Taylor expanded in x around inf
Applied rewrites63.9%
if 2.00000000000000004e-91 < (/.f64 (-.f64 z t) (-.f64 a t)) < 4.9999999999999999e23Initial program 99.9%
Taylor expanded in t around inf
Applied rewrites89.1%
if 4.9999999999999999e23 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 94.8%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6465.8
Applied rewrites65.8%
Taylor expanded in t around 0
lower-/.f6441.1
Applied rewrites41.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (/ (* y z) a)))
(if (<= t_1 -5e+164)
t_2
(if (<= t_1 2e-91) x (if (<= t_1 1e+245) (+ x y) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = (y * z) / a;
double tmp;
if (t_1 <= -5e+164) {
tmp = t_2;
} else if (t_1 <= 2e-91) {
tmp = x;
} else if (t_1 <= 1e+245) {
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) / (a - t)
t_2 = (y * z) / a
if (t_1 <= (-5d+164)) then
tmp = t_2
else if (t_1 <= 2d-91) then
tmp = x
else if (t_1 <= 1d+245) 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) / (a - t);
double t_2 = (y * z) / a;
double tmp;
if (t_1 <= -5e+164) {
tmp = t_2;
} else if (t_1 <= 2e-91) {
tmp = x;
} else if (t_1 <= 1e+245) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) t_2 = (y * z) / a tmp = 0 if t_1 <= -5e+164: tmp = t_2 elif t_1 <= 2e-91: tmp = x elif t_1 <= 1e+245: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(Float64(y * z) / a) tmp = 0.0 if (t_1 <= -5e+164) tmp = t_2; elseif (t_1 <= 2e-91) tmp = x; elseif (t_1 <= 1e+245) 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) / (a - t); t_2 = (y * z) / a; tmp = 0.0; if (t_1 <= -5e+164) tmp = t_2; elseif (t_1 <= 2e-91) tmp = x; elseif (t_1 <= 1e+245) 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+164], t$95$2, If[LessEqual[t$95$1, 2e-91], x, If[LessEqual[t$95$1, 1e+245], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := \frac{y \cdot z}{a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+164}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-91}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 10^{+245}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -4.9999999999999995e164 or 1.00000000000000004e245 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 84.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6484.6
Applied rewrites84.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6456.0
Applied rewrites56.0%
if -4.9999999999999995e164 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2.00000000000000004e-91Initial program 99.1%
Taylor expanded in x around inf
Applied rewrites63.9%
if 2.00000000000000004e-91 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1.00000000000000004e245Initial program 99.9%
Taylor expanded in t around inf
Applied rewrites78.0%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (- z t) (- a t)) 7.5e-90) x (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z - t) / (a - t)) <= 7.5e-90) {
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) / (a - t)) <= 7.5d-90) 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) / (a - t)) <= 7.5e-90) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((z - t) / (a - t)) <= 7.5e-90: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(z - t) / Float64(a - t)) <= 7.5e-90) 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) / (a - t)) <= 7.5e-90) 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[(a - t), $MachinePrecision]), $MachinePrecision], 7.5e-90], x, N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z - t}{a - t} \leq 7.5 \cdot 10^{-90}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 7.4999999999999999e-90Initial program 97.4%
Taylor expanded in x around inf
Applied rewrites56.8%
if 7.4999999999999999e-90 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 98.6%
Taylor expanded in t around inf
Applied rewrites74.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* y (/ (- z t) (- a t))))) (if (<= t_1 -4e+154) y (if (<= t_1 4e+219) x y))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (a - t));
double tmp;
if (t_1 <= -4e+154) {
tmp = y;
} else if (t_1 <= 4e+219) {
tmp = x;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = y * ((z - t) / (a - t))
if (t_1 <= (-4d+154)) then
tmp = y
else if (t_1 <= 4d+219) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (a - t));
double tmp;
if (t_1 <= -4e+154) {
tmp = y;
} else if (t_1 <= 4e+219) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * ((z - t) / (a - t)) tmp = 0 if t_1 <= -4e+154: tmp = y elif t_1 <= 4e+219: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(a - t))) tmp = 0.0 if (t_1 <= -4e+154) tmp = y; elseif (t_1 <= 4e+219) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * ((z - t) / (a - t)); tmp = 0.0; if (t_1 <= -4e+154) tmp = y; elseif (t_1 <= 4e+219) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+154], y, If[LessEqual[t$95$1, 4e+219], x, y]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+154}:\\
\;\;\;\;y\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+219}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if (*.f64 y (/.f64 (-.f64 z t) (-.f64 a t))) < -4.00000000000000015e154 or 3.99999999999999986e219 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 a t))) Initial program 93.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6463.3
Applied rewrites63.3%
Taylor expanded in t around inf
Applied rewrites26.2%
if -4.00000000000000015e154 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 a t))) < 3.99999999999999986e219Initial program 99.5%
Taylor expanded in x around inf
Applied rewrites63.9%
(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 rewrites50.6%
herbie shell --seed 2025119
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
(+ x (* y (/ (- z t) (- a t)))))