
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y - z) * ((t - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z))) (t_2 (+ x (* (- y z) t_1))))
(if (<= t_2 -2e-306)
(fma t_1 (- y z) x)
(if (<= t_2 0.0)
(*
(fma (/ (- t (* a (/ (- x t) z))) y) -1.0 (/ (- (- t x)) (- a z)))
(- y))
(if (<= t_2 5e-37)
(*
t
(-
(fma -1.0 (* (/ x t) (/ (- y z) (- a z))) (+ (/ x t) (/ y (- a z))))
(/ z (- a z))))
t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = x + ((y - z) * t_1);
double tmp;
if (t_2 <= -2e-306) {
tmp = fma(t_1, (y - z), x);
} else if (t_2 <= 0.0) {
tmp = fma(((t - (a * ((x - t) / z))) / y), -1.0, (-(t - x) / (a - z))) * -y;
} else if (t_2 <= 5e-37) {
tmp = t * (fma(-1.0, ((x / t) * ((y - z) / (a - z))), ((x / t) + (y / (a - z)))) - (z / (a - z)));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if (t_2 <= -2e-306) tmp = fma(t_1, Float64(y - z), x); elseif (t_2 <= 0.0) tmp = Float64(fma(Float64(Float64(t - Float64(a * Float64(Float64(x - t) / z))) / y), -1.0, Float64(Float64(-Float64(t - x)) / Float64(a - z))) * Float64(-y)); elseif (t_2 <= 5e-37) tmp = Float64(t * Float64(fma(-1.0, Float64(Float64(x / t) * Float64(Float64(y - z) / Float64(a - z))), Float64(Float64(x / t) + Float64(y / Float64(a - z)))) - Float64(z / Float64(a - z)))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-306], N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(N[(N[(t - N[(a * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + N[((-N[(t - x), $MachinePrecision]) / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-y)), $MachinePrecision], If[LessEqual[t$95$2, 5e-37], N[(t * N[(N[(-1.0 * N[(N[(x / t), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x / t), $MachinePrecision] + N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-306}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, y - z, x\right)\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - a \cdot \frac{x - t}{z}}{y}, -1, \frac{-\left(t - x\right)}{a - z}\right) \cdot \left(-y\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-37}:\\
\;\;\;\;t \cdot \left(\mathsf{fma}\left(-1, \frac{x}{t} \cdot \frac{y - z}{a - z}, \frac{x}{t} + \frac{y}{a - z}\right) - \frac{z}{a - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000006e-306Initial program 96.2%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6496.3
Applied rewrites96.3%
if -2.00000000000000006e-306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 3.3%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites15.2%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6476.1
Applied rewrites76.1%
if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.9999999999999997e-37Initial program 64.7%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6464.7
Applied rewrites64.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6458.6
Applied rewrites58.6%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
Applied rewrites99.9%
if 4.9999999999999997e-37 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 95.2%
Final simplification93.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- t x)) a)) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -5e+305)
t_1
(if (<= t_2 -2000000.0)
(+ x t)
(if (<= t_2 -2e-63)
(/ (* (- y z) t) a)
(if (<= t_2 -2e-306)
x
(if (<= t_2 1e-167) t (if (<= t_2 2e+279) (+ x t) t_1))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (t - x)) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+305) {
tmp = t_1;
} else if (t_2 <= -2000000.0) {
tmp = x + t;
} else if (t_2 <= -2e-63) {
tmp = ((y - z) * t) / a;
} else if (t_2 <= -2e-306) {
tmp = x;
} else if (t_2 <= 1e-167) {
tmp = t;
} else if (t_2 <= 2e+279) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y * (t - x)) / a
t_2 = x + ((y - z) * ((t - x) / (a - z)))
if (t_2 <= (-5d+305)) then
tmp = t_1
else if (t_2 <= (-2000000.0d0)) then
tmp = x + t
else if (t_2 <= (-2d-63)) then
tmp = ((y - z) * t) / a
else if (t_2 <= (-2d-306)) then
tmp = x
else if (t_2 <= 1d-167) then
tmp = t
else if (t_2 <= 2d+279) then
tmp = x + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (t - x)) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+305) {
tmp = t_1;
} else if (t_2 <= -2000000.0) {
tmp = x + t;
} else if (t_2 <= -2e-63) {
tmp = ((y - z) * t) / a;
} else if (t_2 <= -2e-306) {
tmp = x;
} else if (t_2 <= 1e-167) {
tmp = t;
} else if (t_2 <= 2e+279) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (t - x)) / a t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -5e+305: tmp = t_1 elif t_2 <= -2000000.0: tmp = x + t elif t_2 <= -2e-63: tmp = ((y - z) * t) / a elif t_2 <= -2e-306: tmp = x elif t_2 <= 1e-167: tmp = t elif t_2 <= 2e+279: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(t - x)) / a) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -5e+305) tmp = t_1; elseif (t_2 <= -2000000.0) tmp = Float64(x + t); elseif (t_2 <= -2e-63) tmp = Float64(Float64(Float64(y - z) * t) / a); elseif (t_2 <= -2e-306) tmp = x; elseif (t_2 <= 1e-167) tmp = t; elseif (t_2 <= 2e+279) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (t - x)) / a; t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -5e+305) tmp = t_1; elseif (t_2 <= -2000000.0) tmp = x + t; elseif (t_2 <= -2e-63) tmp = ((y - z) * t) / a; elseif (t_2 <= -2e-306) tmp = x; elseif (t_2 <= 1e-167) tmp = t; elseif (t_2 <= 2e+279) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+305], t$95$1, If[LessEqual[t$95$2, -2000000.0], N[(x + t), $MachinePrecision], If[LessEqual[t$95$2, -2e-63], N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t$95$2, -2e-306], x, If[LessEqual[t$95$2, 1e-167], t, If[LessEqual[t$95$2, 2e+279], N[(x + t), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(t - x\right)}{a}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+305}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2000000:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-63}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a}\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-306}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_2 \leq 10^{-167}:\\
\;\;\;\;t\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+279}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5.00000000000000009e305 or 2.00000000000000012e279 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.4%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.4
Applied rewrites91.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6489.6
Applied rewrites89.6%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6486.4
Applied rewrites86.4%
Taylor expanded in z around 0
lower-/.f64N/A
lift-*.f64N/A
lift--.f6463.4
Applied rewrites63.4%
if -5.00000000000000009e305 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e6 or 1e-167 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2.00000000000000012e279Initial program 97.5%
Taylor expanded in z around inf
lift--.f6427.5
Applied rewrites27.5%
Taylor expanded in x around 0
Applied rewrites51.5%
if -2e6 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000013e-63Initial program 99.8%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
Applied rewrites55.6%
if -2.00000000000000013e-63 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000006e-306Initial program 84.3%
Taylor expanded in a around inf
Applied rewrites63.4%
if -2.00000000000000006e-306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e-167Initial program 5.5%
Taylor expanded in z around inf
Applied rewrites42.5%
Final simplification53.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_1 -5e+305)
(/ (* y t) (- a z))
(if (<= t_1 -2000000.0)
(+ x t)
(if (<= t_1 -2e-63)
(/ (* (- y z) t) a)
(if (<= t_1 -2e-306)
x
(if (<= t_1 1e-167)
t
(if (<= t_1 1e+294) (+ x t) (* t (/ y (- a z)))))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -5e+305) {
tmp = (y * t) / (a - z);
} else if (t_1 <= -2000000.0) {
tmp = x + t;
} else if (t_1 <= -2e-63) {
tmp = ((y - z) * t) / a;
} else if (t_1 <= -2e-306) {
tmp = x;
} else if (t_1 <= 1e-167) {
tmp = t;
} else if (t_1 <= 1e+294) {
tmp = x + t;
} else {
tmp = t * (y / (a - z));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + ((y - z) * ((t - x) / (a - z)))
if (t_1 <= (-5d+305)) then
tmp = (y * t) / (a - z)
else if (t_1 <= (-2000000.0d0)) then
tmp = x + t
else if (t_1 <= (-2d-63)) then
tmp = ((y - z) * t) / a
else if (t_1 <= (-2d-306)) then
tmp = x
else if (t_1 <= 1d-167) then
tmp = t
else if (t_1 <= 1d+294) then
tmp = x + t
else
tmp = t * (y / (a - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_1 <= -5e+305) {
tmp = (y * t) / (a - z);
} else if (t_1 <= -2000000.0) {
tmp = x + t;
} else if (t_1 <= -2e-63) {
tmp = ((y - z) * t) / a;
} else if (t_1 <= -2e-306) {
tmp = x;
} else if (t_1 <= 1e-167) {
tmp = t;
} else if (t_1 <= 1e+294) {
tmp = x + t;
} else {
tmp = t * (y / (a - z));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_1 <= -5e+305: tmp = (y * t) / (a - z) elif t_1 <= -2000000.0: tmp = x + t elif t_1 <= -2e-63: tmp = ((y - z) * t) / a elif t_1 <= -2e-306: tmp = x elif t_1 <= 1e-167: tmp = t elif t_1 <= 1e+294: tmp = x + t else: tmp = t * (y / (a - z)) return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_1 <= -5e+305) tmp = Float64(Float64(y * t) / Float64(a - z)); elseif (t_1 <= -2000000.0) tmp = Float64(x + t); elseif (t_1 <= -2e-63) tmp = Float64(Float64(Float64(y - z) * t) / a); elseif (t_1 <= -2e-306) tmp = x; elseif (t_1 <= 1e-167) tmp = t; elseif (t_1 <= 1e+294) tmp = Float64(x + t); else tmp = Float64(t * Float64(y / Float64(a - z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_1 <= -5e+305) tmp = (y * t) / (a - z); elseif (t_1 <= -2000000.0) tmp = x + t; elseif (t_1 <= -2e-63) tmp = ((y - z) * t) / a; elseif (t_1 <= -2e-306) tmp = x; elseif (t_1 <= 1e-167) tmp = t; elseif (t_1 <= 1e+294) tmp = x + t; else tmp = t * (y / (a - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+305], N[(N[(y * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -2000000.0], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, -2e-63], N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t$95$1, -2e-306], x, If[LessEqual[t$95$1, 1e-167], t, If[LessEqual[t$95$1, 1e+294], N[(x + t), $MachinePrecision], N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+305}:\\
\;\;\;\;\frac{y \cdot t}{a - z}\\
\mathbf{elif}\;t\_1 \leq -2000000:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-63}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a}\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-306}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 10^{-167}:\\
\;\;\;\;t\\
\mathbf{elif}\;t\_1 \leq 10^{+294}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5.00000000000000009e305Initial program 95.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6448.9
Applied rewrites48.9%
Taylor expanded in y around inf
Applied rewrites48.6%
if -5.00000000000000009e305 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e6 or 1e-167 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.00000000000000007e294Initial program 97.6%
Taylor expanded in z around inf
lift--.f6426.9
Applied rewrites26.9%
Taylor expanded in x around 0
Applied rewrites51.2%
if -2e6 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000013e-63Initial program 99.8%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
Applied rewrites55.6%
if -2.00000000000000013e-63 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000006e-306Initial program 84.3%
Taylor expanded in a around inf
Applied rewrites63.4%
if -2.00000000000000006e-306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e-167Initial program 5.5%
Taylor expanded in z around inf
Applied rewrites42.5%
if 1.00000000000000007e294 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 87.0%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6456.1
Applied rewrites56.1%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6459.0
Applied rewrites59.0%
Final simplification51.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))) (t_2 (* t (/ y (- a z)))))
(if (<= t_1 -5e+305)
(/ (* y t) (- a z))
(if (<= t_1 -2000000.0)
(+ x t)
(if (<= t_1 -2e-66)
t_2
(if (<= t_1 -2e-306)
x
(if (<= t_1 1e-167) t (if (<= t_1 1e+294) (+ x t) t_2))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double t_2 = t * (y / (a - z));
double tmp;
if (t_1 <= -5e+305) {
tmp = (y * t) / (a - z);
} else if (t_1 <= -2000000.0) {
tmp = x + t;
} else if (t_1 <= -2e-66) {
tmp = t_2;
} else if (t_1 <= -2e-306) {
tmp = x;
} else if (t_1 <= 1e-167) {
tmp = t;
} else if (t_1 <= 1e+294) {
tmp = x + t;
} 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 = x + ((y - z) * ((t - x) / (a - z)))
t_2 = t * (y / (a - z))
if (t_1 <= (-5d+305)) then
tmp = (y * t) / (a - z)
else if (t_1 <= (-2000000.0d0)) then
tmp = x + t
else if (t_1 <= (-2d-66)) then
tmp = t_2
else if (t_1 <= (-2d-306)) then
tmp = x
else if (t_1 <= 1d-167) then
tmp = t
else if (t_1 <= 1d+294) then
tmp = x + t
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 = x + ((y - z) * ((t - x) / (a - z)));
double t_2 = t * (y / (a - z));
double tmp;
if (t_1 <= -5e+305) {
tmp = (y * t) / (a - z);
} else if (t_1 <= -2000000.0) {
tmp = x + t;
} else if (t_1 <= -2e-66) {
tmp = t_2;
} else if (t_1 <= -2e-306) {
tmp = x;
} else if (t_1 <= 1e-167) {
tmp = t;
} else if (t_1 <= 1e+294) {
tmp = x + t;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * ((t - x) / (a - z))) t_2 = t * (y / (a - z)) tmp = 0 if t_1 <= -5e+305: tmp = (y * t) / (a - z) elif t_1 <= -2000000.0: tmp = x + t elif t_1 <= -2e-66: tmp = t_2 elif t_1 <= -2e-306: tmp = x elif t_1 <= 1e-167: tmp = t elif t_1 <= 1e+294: tmp = x + t else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) t_2 = Float64(t * Float64(y / Float64(a - z))) tmp = 0.0 if (t_1 <= -5e+305) tmp = Float64(Float64(y * t) / Float64(a - z)); elseif (t_1 <= -2000000.0) tmp = Float64(x + t); elseif (t_1 <= -2e-66) tmp = t_2; elseif (t_1 <= -2e-306) tmp = x; elseif (t_1 <= 1e-167) tmp = t; elseif (t_1 <= 1e+294) tmp = Float64(x + t); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y - z) * ((t - x) / (a - z))); t_2 = t * (y / (a - z)); tmp = 0.0; if (t_1 <= -5e+305) tmp = (y * t) / (a - z); elseif (t_1 <= -2000000.0) tmp = x + t; elseif (t_1 <= -2e-66) tmp = t_2; elseif (t_1 <= -2e-306) tmp = x; elseif (t_1 <= 1e-167) tmp = t; elseif (t_1 <= 1e+294) tmp = x + t; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+305], N[(N[(y * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -2000000.0], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, -2e-66], t$95$2, If[LessEqual[t$95$1, -2e-306], x, If[LessEqual[t$95$1, 1e-167], t, If[LessEqual[t$95$1, 1e+294], N[(x + t), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
t_2 := t \cdot \frac{y}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+305}:\\
\;\;\;\;\frac{y \cdot t}{a - z}\\
\mathbf{elif}\;t\_1 \leq -2000000:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-66}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-306}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 10^{-167}:\\
\;\;\;\;t\\
\mathbf{elif}\;t\_1 \leq 10^{+294}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5.00000000000000009e305Initial program 95.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6448.9
Applied rewrites48.9%
Taylor expanded in y around inf
Applied rewrites48.6%
if -5.00000000000000009e305 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e6 or 1e-167 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.00000000000000007e294Initial program 97.6%
Taylor expanded in z around inf
lift--.f6426.9
Applied rewrites26.9%
Taylor expanded in x around 0
Applied rewrites51.2%
if -2e6 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-66 or 1.00000000000000007e294 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 92.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6461.9
Applied rewrites61.9%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6452.6
Applied rewrites52.6%
if -2e-66 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000006e-306Initial program 83.4%
Taylor expanded in a around inf
Applied rewrites66.8%
if -2.00000000000000006e-306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e-167Initial program 5.5%
Taylor expanded in z around inf
Applied rewrites42.5%
Final simplification50.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (/ y (- a z)))) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -5e+291)
t_1
(if (<= t_2 -2000000.0)
(+ x t)
(if (<= t_2 -2e-66)
t_1
(if (<= t_2 -2e-306)
x
(if (<= t_2 1e-167) t (if (<= t_2 1e+294) (+ x t) t_1))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (y / (a - z));
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+291) {
tmp = t_1;
} else if (t_2 <= -2000000.0) {
tmp = x + t;
} else if (t_2 <= -2e-66) {
tmp = t_1;
} else if (t_2 <= -2e-306) {
tmp = x;
} else if (t_2 <= 1e-167) {
tmp = t;
} else if (t_2 <= 1e+294) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t * (y / (a - z))
t_2 = x + ((y - z) * ((t - x) / (a - z)))
if (t_2 <= (-5d+291)) then
tmp = t_1
else if (t_2 <= (-2000000.0d0)) then
tmp = x + t
else if (t_2 <= (-2d-66)) then
tmp = t_1
else if (t_2 <= (-2d-306)) then
tmp = x
else if (t_2 <= 1d-167) then
tmp = t
else if (t_2 <= 1d+294) then
tmp = x + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t * (y / (a - z));
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+291) {
tmp = t_1;
} else if (t_2 <= -2000000.0) {
tmp = x + t;
} else if (t_2 <= -2e-66) {
tmp = t_1;
} else if (t_2 <= -2e-306) {
tmp = x;
} else if (t_2 <= 1e-167) {
tmp = t;
} else if (t_2 <= 1e+294) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t * (y / (a - z)) t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -5e+291: tmp = t_1 elif t_2 <= -2000000.0: tmp = x + t elif t_2 <= -2e-66: tmp = t_1 elif t_2 <= -2e-306: tmp = x elif t_2 <= 1e-167: tmp = t elif t_2 <= 1e+294: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(t * Float64(y / Float64(a - z))) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -5e+291) tmp = t_1; elseif (t_2 <= -2000000.0) tmp = Float64(x + t); elseif (t_2 <= -2e-66) tmp = t_1; elseif (t_2 <= -2e-306) tmp = x; elseif (t_2 <= 1e-167) tmp = t; elseif (t_2 <= 1e+294) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t * (y / (a - z)); t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -5e+291) tmp = t_1; elseif (t_2 <= -2000000.0) tmp = x + t; elseif (t_2 <= -2e-66) tmp = t_1; elseif (t_2 <= -2e-306) tmp = x; elseif (t_2 <= 1e-167) tmp = t; elseif (t_2 <= 1e+294) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+291], t$95$1, If[LessEqual[t$95$2, -2000000.0], N[(x + t), $MachinePrecision], If[LessEqual[t$95$2, -2e-66], t$95$1, If[LessEqual[t$95$2, -2e-306], x, If[LessEqual[t$95$2, 1e-167], t, If[LessEqual[t$95$2, 1e+294], N[(x + t), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y}{a - z}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+291}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2000000:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-306}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_2 \leq 10^{-167}:\\
\;\;\;\;t\\
\mathbf{elif}\;t\_2 \leq 10^{+294}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5.0000000000000001e291 or -2e6 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e-66 or 1.00000000000000007e294 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 93.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6455.2
Applied rewrites55.2%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6450.6
Applied rewrites50.6%
if -5.0000000000000001e291 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2e6 or 1e-167 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.00000000000000007e294Initial program 97.5%
Taylor expanded in z around inf
lift--.f6426.6
Applied rewrites26.6%
Taylor expanded in x around 0
Applied rewrites51.5%
if -2e-66 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000006e-306Initial program 83.4%
Taylor expanded in a around inf
Applied rewrites66.8%
if -2.00000000000000006e-306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e-167Initial program 5.5%
Taylor expanded in z around inf
Applied rewrites42.5%
Final simplification50.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y t) a)) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -5e+305)
t_1
(if (<= t_2 -5e-7)
(+ x t)
(if (<= t_2 -2e-306)
x
(if (<= t_2 1e-167) t (if (<= t_2 1e+294) (+ x t) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * t) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+305) {
tmp = t_1;
} else if (t_2 <= -5e-7) {
tmp = x + t;
} else if (t_2 <= -2e-306) {
tmp = x;
} else if (t_2 <= 1e-167) {
tmp = t;
} else if (t_2 <= 1e+294) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y * t) / a
t_2 = x + ((y - z) * ((t - x) / (a - z)))
if (t_2 <= (-5d+305)) then
tmp = t_1
else if (t_2 <= (-5d-7)) then
tmp = x + t
else if (t_2 <= (-2d-306)) then
tmp = x
else if (t_2 <= 1d-167) then
tmp = t
else if (t_2 <= 1d+294) then
tmp = x + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * t) / a;
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -5e+305) {
tmp = t_1;
} else if (t_2 <= -5e-7) {
tmp = x + t;
} else if (t_2 <= -2e-306) {
tmp = x;
} else if (t_2 <= 1e-167) {
tmp = t;
} else if (t_2 <= 1e+294) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * t) / a t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -5e+305: tmp = t_1 elif t_2 <= -5e-7: tmp = x + t elif t_2 <= -2e-306: tmp = x elif t_2 <= 1e-167: tmp = t elif t_2 <= 1e+294: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * t) / a) t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if (t_2 <= -5e+305) tmp = t_1; elseif (t_2 <= -5e-7) tmp = Float64(x + t); elseif (t_2 <= -2e-306) tmp = x; elseif (t_2 <= 1e-167) tmp = t; elseif (t_2 <= 1e+294) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * t) / a; t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -5e+305) tmp = t_1; elseif (t_2 <= -5e-7) tmp = x + t; elseif (t_2 <= -2e-306) tmp = x; elseif (t_2 <= 1e-167) tmp = t; elseif (t_2 <= 1e+294) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+305], t$95$1, If[LessEqual[t$95$2, -5e-7], N[(x + t), $MachinePrecision], If[LessEqual[t$95$2, -2e-306], x, If[LessEqual[t$95$2, 1e-167], t, If[LessEqual[t$95$2, 1e+294], N[(x + t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot t}{a}\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+305}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-7}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-306}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_2 \leq 10^{-167}:\\
\;\;\;\;t\\
\mathbf{elif}\;t\_2 \leq 10^{+294}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5.00000000000000009e305 or 1.00000000000000007e294 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 90.8%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6452.7
Applied rewrites52.7%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6439.0
Applied rewrites39.0%
if -5.00000000000000009e305 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999977e-7 or 1e-167 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.00000000000000007e294Initial program 97.6%
Taylor expanded in z around inf
lift--.f6426.8
Applied rewrites26.8%
Taylor expanded in x around 0
Applied rewrites50.8%
if -4.99999999999999977e-7 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000006e-306Initial program 90.9%
Taylor expanded in a around inf
Applied rewrites44.1%
if -2.00000000000000006e-306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e-167Initial program 5.5%
Taylor expanded in z around inf
Applied rewrites42.5%
Final simplification46.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z))) (t_2 (+ x (* (- y z) t_1))))
(if (or (<= t_2 -2e-306) (not (<= t_2 1e-167)))
(fma t_1 (- y z) x)
(fma (/ (* (- t x) (- y a)) z) -1.0 t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = x + ((y - z) * t_1);
double tmp;
if ((t_2 <= -2e-306) || !(t_2 <= 1e-167)) {
tmp = fma(t_1, (y - z), x);
} else {
tmp = fma((((t - x) * (y - a)) / z), -1.0, t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if ((t_2 <= -2e-306) || !(t_2 <= 1e-167)) tmp = fma(t_1, Float64(y - z), x); else tmp = fma(Float64(Float64(Float64(t - x) * Float64(y - a)) / z), -1.0, t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -2e-306], N[Not[LessEqual[t$95$2, 1e-167]], $MachinePrecision]], N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-306} \lor \neg \left(t\_2 \leq 10^{-167}\right):\\
\;\;\;\;\mathsf{fma}\left(t\_1, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}, -1, t\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000006e-306 or 1e-167 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 95.1%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6495.1
Applied rewrites95.1%
if -2.00000000000000006e-306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e-167Initial program 5.5%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites72.4%
Final simplification91.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z))) (t_2 (+ x (* (- y z) t_1))))
(if (<= t_2 -2e-306)
(fma t_1 (- y z) x)
(if (<= t_2 1e-167) (fma (/ (* (- t x) (- y a)) z) -1.0 t) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = x + ((y - z) * t_1);
double tmp;
if (t_2 <= -2e-306) {
tmp = fma(t_1, (y - z), x);
} else if (t_2 <= 1e-167) {
tmp = fma((((t - x) * (y - a)) / z), -1.0, t);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if (t_2 <= -2e-306) tmp = fma(t_1, Float64(y - z), x); elseif (t_2 <= 1e-167) tmp = fma(Float64(Float64(Float64(t - x) * Float64(y - a)) / z), -1.0, t); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-306], N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 1e-167], N[(N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * -1.0 + t), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-306}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, y - z, x\right)\\
\mathbf{elif}\;t\_2 \leq 10^{-167}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}, -1, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000006e-306Initial program 96.2%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6496.3
Applied rewrites96.3%
if -2.00000000000000006e-306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e-167Initial program 5.5%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites72.4%
if 1e-167 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 93.9%
Final simplification91.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z))) (t_2 (+ x (* (- y z) t_1))))
(if (or (<= t_2 -2e-306) (not (<= t_2 1e-167)))
(fma t_1 (- y z) x)
(* (/ (- y z) (- a z)) t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = x + ((y - z) * t_1);
double tmp;
if ((t_2 <= -2e-306) || !(t_2 <= 1e-167)) {
tmp = fma(t_1, (y - z), x);
} else {
tmp = ((y - z) / (a - z)) * t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if ((t_2 <= -2e-306) || !(t_2 <= 1e-167)) tmp = fma(t_1, Float64(y - z), x); else tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -2e-306], N[Not[LessEqual[t$95$2, 1e-167]], $MachinePrecision]], N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-306} \lor \neg \left(t\_2 \leq 10^{-167}\right):\\
\;\;\;\;\mathsf{fma}\left(t\_1, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000006e-306 or 1e-167 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 95.1%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6495.1
Applied rewrites95.1%
if -2.00000000000000006e-306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e-167Initial program 5.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6433.9
Applied rewrites33.9%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6442.5
Applied rewrites42.5%
Final simplification85.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.1e+184) (not (<= z 5.4e+87))) (* (/ (- y z) (- a z)) t) (+ x (* y (/ (- t x) (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.1e+184) || !(z <= 5.4e+87)) {
tmp = ((y - z) / (a - z)) * t;
} else {
tmp = x + (y * ((t - x) / (a - z)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-6.1d+184)) .or. (.not. (z <= 5.4d+87))) then
tmp = ((y - z) / (a - z)) * t
else
tmp = x + (y * ((t - x) / (a - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.1e+184) || !(z <= 5.4e+87)) {
tmp = ((y - z) / (a - z)) * t;
} else {
tmp = x + (y * ((t - x) / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.1e+184) or not (z <= 5.4e+87): tmp = ((y - z) / (a - z)) * t else: tmp = x + (y * ((t - x) / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.1e+184) || !(z <= 5.4e+87)) tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); else tmp = Float64(x + Float64(y * Float64(Float64(t - x) / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -6.1e+184) || ~((z <= 5.4e+87))) tmp = ((y - z) / (a - z)) * t; else tmp = x + (y * ((t - x) / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.1e+184], N[Not[LessEqual[z, 5.4e+87]], $MachinePrecision]], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(x + N[(y * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.1 \cdot 10^{+184} \lor \neg \left(z \leq 5.4 \cdot 10^{+87}\right):\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t - x}{a - z}\\
\end{array}
\end{array}
if z < -6.10000000000000009e184 or 5.40000000000000013e87 < z Initial program 58.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6432.0
Applied rewrites32.0%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6464.5
Applied rewrites64.5%
if -6.10000000000000009e184 < z < 5.40000000000000013e87Initial program 89.0%
Taylor expanded in y around inf
Applied rewrites80.6%
Final simplification75.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.1e+184) (not (<= z 5.4e+87))) (* (/ (- y z) (- a z)) t) (fma (/ (- t x) (- a z)) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.1e+184) || !(z <= 5.4e+87)) {
tmp = ((y - z) / (a - z)) * t;
} else {
tmp = fma(((t - x) / (a - z)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.1e+184) || !(z <= 5.4e+87)) tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); else tmp = fma(Float64(Float64(t - x) / Float64(a - z)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.1e+184], N[Not[LessEqual[z, 5.4e+87]], $MachinePrecision]], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.1 \cdot 10^{+184} \lor \neg \left(z \leq 5.4 \cdot 10^{+87}\right):\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y, x\right)\\
\end{array}
\end{array}
if z < -6.10000000000000009e184 or 5.40000000000000013e87 < z Initial program 58.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6432.0
Applied rewrites32.0%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6464.5
Applied rewrites64.5%
if -6.10000000000000009e184 < z < 5.40000000000000013e87Initial program 89.0%
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6489.2
Applied rewrites89.2%
Taylor expanded in y around inf
Applied rewrites80.6%
Final simplification75.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.6e+15) (not (<= a 2.95e-12))) (fma (- t x) (/ (- y z) a) x) (* (/ (- y z) (- a z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.6e+15) || !(a <= 2.95e-12)) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = ((y - z) / (a - z)) * t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.6e+15) || !(a <= 2.95e-12)) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.6e+15], N[Not[LessEqual[a, 2.95e-12]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{+15} \lor \neg \left(a \leq 2.95 \cdot 10^{-12}\right):\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\end{array}
\end{array}
if a < -1.6e15 or 2.95e-12 < a Initial program 88.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6474.9
Applied rewrites74.9%
if -1.6e15 < a < 2.95e-12Initial program 68.7%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6453.2
Applied rewrites53.2%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6469.2
Applied rewrites69.2%
Final simplification72.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.3e+40) (not (<= a 2.95e-12))) (fma y (/ (- t x) a) x) (* (/ (- y z) (- a z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.3e+40) || !(a <= 2.95e-12)) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = ((y - z) / (a - z)) * t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.3e+40) || !(a <= 2.95e-12)) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.3e+40], N[Not[LessEqual[a, 2.95e-12]], $MachinePrecision]], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.3 \cdot 10^{+40} \lor \neg \left(a \leq 2.95 \cdot 10^{-12}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\end{array}
\end{array}
if a < -2.29999999999999994e40 or 2.95e-12 < a Initial program 88.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6471.2
Applied rewrites71.2%
if -2.29999999999999994e40 < a < 2.95e-12Initial program 70.3%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6451.6
Applied rewrites51.6%
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6467.1
Applied rewrites67.1%
Final simplification69.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -6.1e+184) (* (- t) (/ z (- a z))) (if (<= z 1.35e-17) (fma y (/ (- t x) a) x) (* (- y z) (/ t (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.1e+184) {
tmp = -t * (z / (a - z));
} else if (z <= 1.35e-17) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = (y - z) * (t / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.1e+184) tmp = Float64(Float64(-t) * Float64(z / Float64(a - z))); elseif (z <= 1.35e-17) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = Float64(Float64(y - z) * Float64(t / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.1e+184], N[((-t) * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e-17], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.1 \cdot 10^{+184}:\\
\;\;\;\;\left(-t\right) \cdot \frac{z}{a - z}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-17}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\
\end{array}
\end{array}
if z < -6.10000000000000009e184Initial program 53.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6422.5
Applied rewrites22.5%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6468.5
Applied rewrites68.5%
if -6.10000000000000009e184 < z < 1.3500000000000001e-17Initial program 90.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.3
Applied rewrites73.3%
if 1.3500000000000001e-17 < z Initial program 66.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6439.6
Applied rewrites39.6%
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--.f6452.2
Applied rewrites52.2%
Final simplification66.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.1e+184) (not (<= z 130000000.0))) (* (- t) (/ z (- a z))) (fma y (/ (- t x) a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.1e+184) || !(z <= 130000000.0)) {
tmp = -t * (z / (a - z));
} else {
tmp = fma(y, ((t - x) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.1e+184) || !(z <= 130000000.0)) tmp = Float64(Float64(-t) * Float64(z / Float64(a - z))); else tmp = fma(y, Float64(Float64(t - x) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.1e+184], N[Not[LessEqual[z, 130000000.0]], $MachinePrecision]], N[((-t) * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.1 \cdot 10^{+184} \lor \neg \left(z \leq 130000000\right):\\
\;\;\;\;\left(-t\right) \cdot \frac{z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\end{array}
\end{array}
if z < -6.10000000000000009e184 or 1.3e8 < z Initial program 61.3%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6434.3
Applied rewrites34.3%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6455.6
Applied rewrites55.6%
if -6.10000000000000009e184 < z < 1.3e8Initial program 90.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6472.2
Applied rewrites72.2%
Final simplification65.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -9.6e+184) t (if (<= z 150000000.0) (fma y (/ (- t x) a) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.6e+184) {
tmp = t;
} else if (z <= 150000000.0) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.6e+184) tmp = t; elseif (z <= 150000000.0) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.6e+184], t, If[LessEqual[z, 150000000.0], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.6 \cdot 10^{+184}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 150000000:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -9.59999999999999986e184 or 1.5e8 < z Initial program 61.3%
Taylor expanded in z around inf
Applied rewrites50.6%
if -9.59999999999999986e184 < z < 1.5e8Initial program 90.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6472.2
Applied rewrites72.2%
Final simplification64.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.35e+106) x (if (<= a 6e+17) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.35e+106) {
tmp = x;
} else if (a <= 6e+17) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-3.35d+106)) then
tmp = x
else if (a <= 6d+17) then
tmp = t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.35e+106) {
tmp = x;
} else if (a <= 6e+17) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.35e+106: tmp = x elif a <= 6e+17: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.35e+106) tmp = x; elseif (a <= 6e+17) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.35e+106) tmp = x; elseif (a <= 6e+17) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.35e+106], x, If[LessEqual[a, 6e+17], t, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.35 \cdot 10^{+106}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 6 \cdot 10^{+17}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.35e106 or 6e17 < a Initial program 89.3%
Taylor expanded in a around inf
Applied rewrites48.6%
if -3.35e106 < a < 6e17Initial program 72.6%
Taylor expanded in z around inf
Applied rewrites35.3%
Final simplification40.7%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 79.4%
Taylor expanded in z around inf
Applied rewrites24.3%
Final simplification24.3%
herbie shell --seed 2025043
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:precision binary64
(+ x (* (- y z) (/ (- t x) (- a z)))))