
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (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) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- (+ (+ (/ t (- a t)) 1.0) (/ x y)) (/ z (- a t))) y))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -5e-231)
t_2
(if (<= t_2 0.0)
(- x (/ (* y (- a z)) t))
(if (<= t_2 1e+306) t_2 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((((t / (a - t)) + 1.0) + (x / y)) - (z / (a - t))) * y;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -5e-231) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = x - ((y * (a - z)) / t);
} else if (t_2 <= 1e+306) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((((t / (a - t)) + 1.0) + (x / y)) - (z / (a - t))) * y;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -5e-231) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = x - ((y * (a - z)) / t);
} else if (t_2 <= 1e+306) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((((t / (a - t)) + 1.0) + (x / y)) - (z / (a - t))) * y t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -5e-231: tmp = t_2 elif t_2 <= 0.0: tmp = x - ((y * (a - z)) / t) elif t_2 <= 1e+306: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(Float64(Float64(t / Float64(a - t)) + 1.0) + Float64(x / y)) - Float64(z / Float64(a - t))) * y) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -5e-231) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(x - Float64(Float64(y * Float64(a - z)) / t)); elseif (t_2 <= 1e+306) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((((t / (a - t)) + 1.0) + (x / y)) - (z / (a - t))) * y; t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -5e-231) tmp = t_2; elseif (t_2 <= 0.0) tmp = x - ((y * (a - z)) / t); elseif (t_2 <= 1e+306) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[(N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -5e-231], t$95$2, If[LessEqual[t$95$2, 0.0], N[(x - N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+306], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\left(\frac{t}{a - t} + 1\right) + \frac{x}{y}\right) - \frac{z}{a - t}\right) \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-231}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;x - \frac{y \cdot \left(a - z\right)}{t}\\
\mathbf{elif}\;t\_2 \leq 10^{+306}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0 or 1.00000000000000002e306 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 52.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6492.9
Applied rewrites92.9%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -5.00000000000000023e-231 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 1.00000000000000002e306Initial program 97.2%
if -5.00000000000000023e-231 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 3.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6465.8
Applied rewrites65.8%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6499.8
Applied rewrites99.8%
Final simplification96.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (<= t_1 (- INFINITY))
(- y (* (- z t) (/ y (- a t))))
(if (<= t_1 -5e-231)
t_1
(if (<= t_1 0.0)
(- x (/ (* y (- a z)) t))
(if (<= t_1 1e+306) t_1 (* (fma -1.0 (/ (- a z) t) (/ x y)) y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y - ((z - t) * (y / (a - t)));
} else if (t_1 <= -5e-231) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = x - ((y * (a - z)) / t);
} else if (t_1 <= 1e+306) {
tmp = t_1;
} else {
tmp = fma(-1.0, ((a - z) / t), (x / y)) * y;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y - Float64(Float64(z - t) * Float64(y / Float64(a - t)))); elseif (t_1 <= -5e-231) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(x - Float64(Float64(y * Float64(a - z)) / t)); elseif (t_1 <= 1e+306) tmp = t_1; else tmp = Float64(fma(-1.0, Float64(Float64(a - z) / t), Float64(x / y)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y - N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-231], t$95$1, If[LessEqual[t$95$1, 0.0], N[(x - N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+306], t$95$1, N[(N[(-1.0 * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;y - \left(z - t\right) \cdot \frac{y}{a - t}\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-231}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;x - \frac{y \cdot \left(a - z\right)}{t}\\
\mathbf{elif}\;t\_1 \leq 10^{+306}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{a - z}{t}, \frac{x}{y}\right) \cdot y\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0Initial program 43.7%
Taylor expanded in x around 0
*-commutativeN/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6469.9
Applied rewrites69.9%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -5.00000000000000023e-231 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 1.00000000000000002e306Initial program 97.2%
if -5.00000000000000023e-231 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 3.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6465.8
Applied rewrites65.8%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6499.8
Applied rewrites99.8%
if 1.00000000000000002e306 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 60.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6492.7
Applied rewrites92.7%
Taylor expanded in t around -inf
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift-/.f6481.7
Applied rewrites81.7%
Final simplification92.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (<= t_1 (- INFINITY))
(- y (* z (/ y a)))
(if (<= t_1 -5e-131)
(+ y x)
(if (<= t_1 0.0) x (if (<= t_1 1e+306) (+ y x) (* (/ z t) y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y - (z * (y / a));
} else if (t_1 <= -5e-131) {
tmp = y + x;
} else if (t_1 <= 0.0) {
tmp = x;
} else if (t_1 <= 1e+306) {
tmp = y + x;
} else {
tmp = (z / t) * y;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = y - (z * (y / a));
} else if (t_1 <= -5e-131) {
tmp = y + x;
} else if (t_1 <= 0.0) {
tmp = x;
} else if (t_1 <= 1e+306) {
tmp = y + x;
} else {
tmp = (z / t) * y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_1 <= -math.inf: tmp = y - (z * (y / a)) elif t_1 <= -5e-131: tmp = y + x elif t_1 <= 0.0: tmp = x elif t_1 <= 1e+306: tmp = y + x else: tmp = (z / t) * y return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y - Float64(z * Float64(y / a))); elseif (t_1 <= -5e-131) tmp = Float64(y + x); elseif (t_1 <= 0.0) tmp = x; elseif (t_1 <= 1e+306) tmp = Float64(y + x); else tmp = Float64(Float64(z / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_1 <= -Inf) tmp = y - (z * (y / a)); elseif (t_1 <= -5e-131) tmp = y + x; elseif (t_1 <= 0.0) tmp = x; elseif (t_1 <= 1e+306) tmp = y + x; else tmp = (z / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-131], N[(y + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], x, If[LessEqual[t$95$1, 1e+306], N[(y + x), $MachinePrecision], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;y - z \cdot \frac{y}{a}\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-131}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_1 \leq 10^{+306}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0Initial program 43.7%
Taylor expanded in x around 0
*-commutativeN/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6469.9
Applied rewrites69.9%
Taylor expanded in z around inf
Applied rewrites69.7%
Taylor expanded in t around 0
Applied rewrites52.6%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -5.0000000000000004e-131 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 1.00000000000000002e306Initial program 97.1%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6475.3
Applied rewrites75.3%
if -5.0000000000000004e-131 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 20.8%
Taylor expanded in x around inf
Applied rewrites48.1%
if 1.00000000000000002e306 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 60.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6492.7
Applied rewrites92.7%
Taylor expanded in z around inf
lower-*.f64N/A
lift-/.f64N/A
lift--.f6467.8
Applied rewrites67.8%
Taylor expanded in t around inf
lower-/.f6456.3
Applied rewrites56.3%
Final simplification67.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ z t) y)) (t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (<= t_2 -2e+300)
t_1
(if (<= t_2 -5e-131)
(+ y x)
(if (<= t_2 0.0) x (if (<= t_2 1e+306) (+ y x) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z / t) * y;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 <= -2e+300) {
tmp = t_1;
} else if (t_2 <= -5e-131) {
tmp = y + x;
} else if (t_2 <= 0.0) {
tmp = x;
} else if (t_2 <= 1e+306) {
tmp = y + x;
} 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 = (z / t) * y
t_2 = (x + y) - (((z - t) * y) / (a - t))
if (t_2 <= (-2d+300)) then
tmp = t_1
else if (t_2 <= (-5d-131)) then
tmp = y + x
else if (t_2 <= 0.0d0) then
tmp = x
else if (t_2 <= 1d+306) then
tmp = y + x
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 = (z / t) * y;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 <= -2e+300) {
tmp = t_1;
} else if (t_2 <= -5e-131) {
tmp = y + x;
} else if (t_2 <= 0.0) {
tmp = x;
} else if (t_2 <= 1e+306) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z / t) * y t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 <= -2e+300: tmp = t_1 elif t_2 <= -5e-131: tmp = y + x elif t_2 <= 0.0: tmp = x elif t_2 <= 1e+306: tmp = y + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z / t) * y) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 <= -2e+300) tmp = t_1; elseif (t_2 <= -5e-131) tmp = Float64(y + x); elseif (t_2 <= 0.0) tmp = x; elseif (t_2 <= 1e+306) tmp = Float64(y + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z / t) * y; t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 <= -2e+300) tmp = t_1; elseif (t_2 <= -5e-131) tmp = y + x; elseif (t_2 <= 0.0) tmp = x; elseif (t_2 <= 1e+306) tmp = y + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+300], t$95$1, If[LessEqual[t$95$2, -5e-131], N[(y + x), $MachinePrecision], If[LessEqual[t$95$2, 0.0], x, If[LessEqual[t$95$2, 1e+306], N[(y + x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+300}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-131}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_2 \leq 10^{+306}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -2.0000000000000001e300 or 1.00000000000000002e306 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 53.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6491.7
Applied rewrites91.7%
Taylor expanded in z around inf
lower-*.f64N/A
lift-/.f64N/A
lift--.f6463.2
Applied rewrites63.2%
Taylor expanded in t around inf
lower-/.f6453.0
Applied rewrites53.0%
if -2.0000000000000001e300 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -5.0000000000000004e-131 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 1.00000000000000002e306Initial program 97.1%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6475.6
Applied rewrites75.6%
if -5.0000000000000004e-131 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 20.8%
Taylor expanded in x around inf
Applied rewrites48.1%
Final simplification66.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y z) t)) (t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (<= t_2 -2e+300)
t_1
(if (<= t_2 -5e-131)
(+ y x)
(if (<= t_2 0.0) x (if (<= t_2 1e+306) (+ y x) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * z) / t;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 <= -2e+300) {
tmp = t_1;
} else if (t_2 <= -5e-131) {
tmp = y + x;
} else if (t_2 <= 0.0) {
tmp = x;
} else if (t_2 <= 1e+306) {
tmp = y + x;
} 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 * z) / t
t_2 = (x + y) - (((z - t) * y) / (a - t))
if (t_2 <= (-2d+300)) then
tmp = t_1
else if (t_2 <= (-5d-131)) then
tmp = y + x
else if (t_2 <= 0.0d0) then
tmp = x
else if (t_2 <= 1d+306) then
tmp = y + x
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 * z) / t;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 <= -2e+300) {
tmp = t_1;
} else if (t_2 <= -5e-131) {
tmp = y + x;
} else if (t_2 <= 0.0) {
tmp = x;
} else if (t_2 <= 1e+306) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * z) / t t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 <= -2e+300: tmp = t_1 elif t_2 <= -5e-131: tmp = y + x elif t_2 <= 0.0: tmp = x elif t_2 <= 1e+306: tmp = y + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * z) / t) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 <= -2e+300) tmp = t_1; elseif (t_2 <= -5e-131) tmp = Float64(y + x); elseif (t_2 <= 0.0) tmp = x; elseif (t_2 <= 1e+306) tmp = Float64(y + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * z) / t; t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 <= -2e+300) tmp = t_1; elseif (t_2 <= -5e-131) tmp = y + x; elseif (t_2 <= 0.0) tmp = x; elseif (t_2 <= 1e+306) tmp = y + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+300], t$95$1, If[LessEqual[t$95$2, -5e-131], N[(y + x), $MachinePrecision], If[LessEqual[t$95$2, 0.0], x, If[LessEqual[t$95$2, 1e+306], N[(y + x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot z}{t}\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+300}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-131}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_2 \leq 10^{+306}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -2.0000000000000001e300 or 1.00000000000000002e306 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 53.6%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6455.5
Applied rewrites55.5%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6446.6
Applied rewrites46.6%
if -2.0000000000000001e300 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -5.0000000000000004e-131 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 1.00000000000000002e306Initial program 97.1%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6475.6
Applied rewrites75.6%
if -5.0000000000000004e-131 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 20.8%
Taylor expanded in x around inf
Applied rewrites48.1%
Final simplification65.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (<= t_1 (- INFINITY))
(- y (* (- z t) (/ y (- a t))))
(if (or (<= t_1 -5e-231) (not (<= t_1 0.0)))
t_1
(- x (/ (* y (- a z)) t))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y - ((z - t) * (y / (a - t)));
} else if ((t_1 <= -5e-231) || !(t_1 <= 0.0)) {
tmp = t_1;
} else {
tmp = x - ((y * (a - z)) / t);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = y - ((z - t) * (y / (a - t)));
} else if ((t_1 <= -5e-231) || !(t_1 <= 0.0)) {
tmp = t_1;
} else {
tmp = x - ((y * (a - z)) / t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_1 <= -math.inf: tmp = y - ((z - t) * (y / (a - t))) elif (t_1 <= -5e-231) or not (t_1 <= 0.0): tmp = t_1 else: tmp = x - ((y * (a - z)) / t) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y - Float64(Float64(z - t) * Float64(y / Float64(a - t)))); elseif ((t_1 <= -5e-231) || !(t_1 <= 0.0)) tmp = t_1; else tmp = Float64(x - Float64(Float64(y * Float64(a - z)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_1 <= -Inf) tmp = y - ((z - t) * (y / (a - t))); elseif ((t_1 <= -5e-231) || ~((t_1 <= 0.0))) tmp = t_1; else tmp = x - ((y * (a - z)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y - N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$1, -5e-231], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], t$95$1, N[(x - N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;y - \left(z - t\right) \cdot \frac{y}{a - t}\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-231} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot \left(a - z\right)}{t}\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0Initial program 43.7%
Taylor expanded in x around 0
*-commutativeN/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6469.9
Applied rewrites69.9%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -5.00000000000000023e-231 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 92.3%
if -5.00000000000000023e-231 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 3.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6465.8
Applied rewrites65.8%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6499.8
Applied rewrites99.8%
Final simplification90.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ (* y z) a))))
(if (<= a -1.95e+91)
(+ y x)
(if (<= a -3.6e-205)
t_1
(if (<= a 4.3e-147) x (if (<= a 1.3e+33) t_1 (+ y x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y * z) / a);
double tmp;
if (a <= -1.95e+91) {
tmp = y + x;
} else if (a <= -3.6e-205) {
tmp = t_1;
} else if (a <= 4.3e-147) {
tmp = x;
} else if (a <= 1.3e+33) {
tmp = t_1;
} else {
tmp = y + x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x - ((y * z) / a)
if (a <= (-1.95d+91)) then
tmp = y + x
else if (a <= (-3.6d-205)) then
tmp = t_1
else if (a <= 4.3d-147) then
tmp = x
else if (a <= 1.3d+33) then
tmp = t_1
else
tmp = y + x
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) / a);
double tmp;
if (a <= -1.95e+91) {
tmp = y + x;
} else if (a <= -3.6e-205) {
tmp = t_1;
} else if (a <= 4.3e-147) {
tmp = x;
} else if (a <= 1.3e+33) {
tmp = t_1;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - ((y * z) / a) tmp = 0 if a <= -1.95e+91: tmp = y + x elif a <= -3.6e-205: tmp = t_1 elif a <= 4.3e-147: tmp = x elif a <= 1.3e+33: tmp = t_1 else: tmp = y + x return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(y * z) / a)) tmp = 0.0 if (a <= -1.95e+91) tmp = Float64(y + x); elseif (a <= -3.6e-205) tmp = t_1; elseif (a <= 4.3e-147) tmp = x; elseif (a <= 1.3e+33) tmp = t_1; else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - ((y * z) / a); tmp = 0.0; if (a <= -1.95e+91) tmp = y + x; elseif (a <= -3.6e-205) tmp = t_1; elseif (a <= 4.3e-147) tmp = x; elseif (a <= 1.3e+33) tmp = t_1; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.95e+91], N[(y + x), $MachinePrecision], If[LessEqual[a, -3.6e-205], t$95$1, If[LessEqual[a, 4.3e-147], x, If[LessEqual[a, 1.3e+33], t$95$1, N[(y + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y \cdot z}{a}\\
\mathbf{if}\;a \leq -1.95 \cdot 10^{+91}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq -3.6 \cdot 10^{-205}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4.3 \cdot 10^{-147}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.3 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -1.94999999999999984e91 or 1.2999999999999999e33 < a Initial program 78.5%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6482.3
Applied rewrites82.3%
if -1.94999999999999984e91 < a < -3.5999999999999998e-205 or 4.3000000000000001e-147 < a < 1.2999999999999999e33Initial program 78.5%
Taylor expanded in x around inf
Applied rewrites69.3%
Taylor expanded in t around 0
lower-/.f64N/A
lift-*.f6460.3
Applied rewrites60.3%
if -3.5999999999999998e-205 < a < 4.3000000000000001e-147Initial program 72.0%
Taylor expanded in x around inf
Applied rewrites54.0%
Final simplification67.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- y (* z (/ y (- a t))))))
(if (<= y -2.1e-20)
t_1
(if (<= y 1.15e-208)
(- x (/ (* y z) a))
(if (<= y 5.8e+104) (+ y x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y - (z * (y / (a - t)));
double tmp;
if (y <= -2.1e-20) {
tmp = t_1;
} else if (y <= 1.15e-208) {
tmp = x - ((y * z) / a);
} else if (y <= 5.8e+104) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = y - (z * (y / (a - t)))
if (y <= (-2.1d-20)) then
tmp = t_1
else if (y <= 1.15d-208) then
tmp = x - ((y * z) / a)
else if (y <= 5.8d+104) then
tmp = y + x
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 - (z * (y / (a - t)));
double tmp;
if (y <= -2.1e-20) {
tmp = t_1;
} else if (y <= 1.15e-208) {
tmp = x - ((y * z) / a);
} else if (y <= 5.8e+104) {
tmp = y + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y - (z * (y / (a - t))) tmp = 0 if y <= -2.1e-20: tmp = t_1 elif y <= 1.15e-208: tmp = x - ((y * z) / a) elif y <= 5.8e+104: tmp = y + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y - Float64(z * Float64(y / Float64(a - t)))) tmp = 0.0 if (y <= -2.1e-20) tmp = t_1; elseif (y <= 1.15e-208) tmp = Float64(x - Float64(Float64(y * z) / a)); elseif (y <= 5.8e+104) tmp = Float64(y + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y - (z * (y / (a - t))); tmp = 0.0; if (y <= -2.1e-20) tmp = t_1; elseif (y <= 1.15e-208) tmp = x - ((y * z) / a); elseif (y <= 5.8e+104) tmp = y + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y - N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.1e-20], t$95$1, If[LessEqual[y, 1.15e-208], N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e+104], N[(y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - z \cdot \frac{y}{a - t}\\
\mathbf{if}\;y \leq -2.1 \cdot 10^{-20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-208}:\\
\;\;\;\;x - \frac{y \cdot z}{a}\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+104}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.0999999999999999e-20 or 5.7999999999999997e104 < y Initial program 62.6%
Taylor expanded in x around 0
*-commutativeN/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6463.1
Applied rewrites63.1%
Taylor expanded in z around inf
Applied rewrites62.9%
if -2.0999999999999999e-20 < y < 1.14999999999999998e-208Initial program 93.7%
Taylor expanded in x around inf
Applied rewrites89.7%
Taylor expanded in t around 0
lower-/.f64N/A
lift-*.f6481.0
Applied rewrites81.0%
if 1.14999999999999998e-208 < y < 5.7999999999999997e104Initial program 86.0%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6472.5
Applied rewrites72.5%
Final simplification70.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.2e+91) (not (<= a 1.5e+33))) (+ y x) (- x (/ (* y z) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.2e+91) || !(a <= 1.5e+33)) {
tmp = y + x;
} else {
tmp = x - ((y * z) / (a - t));
}
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 <= (-2.2d+91)) .or. (.not. (a <= 1.5d+33))) then
tmp = y + x
else
tmp = x - ((y * z) / (a - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.2e+91) || !(a <= 1.5e+33)) {
tmp = y + x;
} else {
tmp = x - ((y * z) / (a - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.2e+91) or not (a <= 1.5e+33): tmp = y + x else: tmp = x - ((y * z) / (a - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.2e+91) || !(a <= 1.5e+33)) tmp = Float64(y + x); else tmp = Float64(x - Float64(Float64(y * z) / Float64(a - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2.2e+91) || ~((a <= 1.5e+33))) tmp = y + x; else tmp = x - ((y * z) / (a - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.2e+91], N[Not[LessEqual[a, 1.5e+33]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x - N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.2 \cdot 10^{+91} \lor \neg \left(a \leq 1.5 \cdot 10^{+33}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot z}{a - t}\\
\end{array}
\end{array}
if a < -2.19999999999999999e91 or 1.49999999999999992e33 < a Initial program 78.5%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6482.3
Applied rewrites82.3%
if -2.19999999999999999e91 < a < 1.49999999999999992e33Initial program 76.2%
Taylor expanded in x around inf
Applied rewrites70.1%
Taylor expanded in z around inf
lift-*.f6488.8
Applied rewrites88.8%
Final simplification86.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.6e-11) (- (+ x y) (/ (* z y) a)) (if (<= a 1.5e+33) (- x (/ (* y z) (- a t))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.6e-11) {
tmp = (x + y) - ((z * y) / a);
} else if (a <= 1.5e+33) {
tmp = x - ((y * z) / (a - t));
} else {
tmp = y + 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 <= (-2.6d-11)) then
tmp = (x + y) - ((z * y) / a)
else if (a <= 1.5d+33) then
tmp = x - ((y * z) / (a - t))
else
tmp = y + 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 <= -2.6e-11) {
tmp = (x + y) - ((z * y) / a);
} else if (a <= 1.5e+33) {
tmp = x - ((y * z) / (a - t));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.6e-11: tmp = (x + y) - ((z * y) / a) elif a <= 1.5e+33: tmp = x - ((y * z) / (a - t)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.6e-11) tmp = Float64(Float64(x + y) - Float64(Float64(z * y) / a)); elseif (a <= 1.5e+33) tmp = Float64(x - Float64(Float64(y * z) / Float64(a - t))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.6e-11) tmp = (x + y) - ((z * y) / a); elseif (a <= 1.5e+33) tmp = x - ((y * z) / (a - t)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.6e-11], N[(N[(x + y), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.5e+33], N[(x - N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{-11}:\\
\;\;\;\;\left(x + y\right) - \frac{z \cdot y}{a}\\
\mathbf{elif}\;a \leq 1.5 \cdot 10^{+33}:\\
\;\;\;\;x - \frac{y \cdot z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -2.6000000000000001e-11Initial program 84.1%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6482.1
Applied rewrites82.1%
if -2.6000000000000001e-11 < a < 1.49999999999999992e33Initial program 74.4%
Taylor expanded in x around inf
Applied rewrites71.6%
Taylor expanded in z around inf
lift-*.f6493.2
Applied rewrites93.2%
if 1.49999999999999992e33 < a Initial program 75.2%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6481.1
Applied rewrites81.1%
Final simplification87.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.35e+164) (not (<= z 4.2e+136))) (/ (* (- y) z) (- a t)) (+ y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+164) || !(z <= 4.2e+136)) {
tmp = (-y * z) / (a - t);
} else {
tmp = y + 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 ((z <= (-1.35d+164)) .or. (.not. (z <= 4.2d+136))) then
tmp = (-y * z) / (a - t)
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+164) || !(z <= 4.2e+136)) {
tmp = (-y * z) / (a - t);
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.35e+164) or not (z <= 4.2e+136): tmp = (-y * z) / (a - t) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.35e+164) || !(z <= 4.2e+136)) tmp = Float64(Float64(Float64(-y) * z) / Float64(a - t)); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.35e+164) || ~((z <= 4.2e+136))) tmp = (-y * z) / (a - t); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.35e+164], N[Not[LessEqual[z, 4.2e+136]], $MachinePrecision]], N[(N[((-y) * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+164} \lor \neg \left(z \leq 4.2 \cdot 10^{+136}\right):\\
\;\;\;\;\frac{\left(-y\right) \cdot z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -1.35000000000000003e164 or 4.1999999999999998e136 < z Initial program 85.7%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift--.f6466.4
Applied rewrites66.4%
if -1.35000000000000003e164 < z < 4.1999999999999998e136Initial program 74.2%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6465.6
Applied rewrites65.6%
Final simplification65.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.15e-12) (not (<= a 1.75e+19))) (+ y x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.15e-12) || !(a <= 1.75e+19)) {
tmp = y + x;
} 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 <= (-1.15d-12)) .or. (.not. (a <= 1.75d+19))) then
tmp = y + x
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 <= -1.15e-12) || !(a <= 1.75e+19)) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.15e-12) or not (a <= 1.75e+19): tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.15e-12) || !(a <= 1.75e+19)) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.15e-12) || ~((a <= 1.75e+19))) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.15e-12], N[Not[LessEqual[a, 1.75e+19]], $MachinePrecision]], N[(y + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.15 \cdot 10^{-12} \lor \neg \left(a \leq 1.75 \cdot 10^{+19}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.14999999999999995e-12 or 1.75e19 < a Initial program 80.1%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6475.7
Applied rewrites75.7%
if -1.14999999999999995e-12 < a < 1.75e19Initial program 74.0%
Taylor expanded in x around inf
Applied rewrites48.1%
Final simplification61.9%
(FPCore (x y z t a) :precision binary64 (if (<= x -8e-184) x (if (<= x 8.8e-160) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8e-184) {
tmp = x;
} else if (x <= 8.8e-160) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (x <= (-8d-184)) then
tmp = x
else if (x <= 8.8d-160) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8e-184) {
tmp = x;
} else if (x <= 8.8e-160) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -8e-184: tmp = x elif x <= 8.8e-160: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -8e-184) tmp = x; elseif (x <= 8.8e-160) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -8e-184) tmp = x; elseif (x <= 8.8e-160) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -8e-184], x, If[LessEqual[x, 8.8e-160], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-184}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-160}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.0000000000000005e-184 or 8.8e-160 < x Initial program 80.0%
Taylor expanded in x around inf
Applied rewrites55.7%
if -8.0000000000000005e-184 < x < 8.8e-160Initial program 68.6%
Taylor expanded in x around 0
*-commutativeN/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6464.4
Applied rewrites64.4%
Taylor expanded in a around inf
Applied rewrites36.1%
Final simplification50.6%
(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 77.1%
Taylor expanded in x around inf
Applied rewrites44.8%
Final simplification44.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (< t_2 -1.3664970889390727e-7)
t_1
(if (< t_2 1.4754293444577233e-239)
(/ (- (* y (- a z)) (* x t)) (- a t))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - 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 + x) - (((z - t) * (1.0d0 / (a - t))) * y)
t_2 = (x + y) - (((z - t) * y) / (a - t))
if (t_2 < (-1.3664970889390727d-7)) then
tmp = t_1
else if (t_2 < 1.4754293444577233d-239) then
tmp = ((y * (a - z)) - (x * t)) / (a - 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 + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y) t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 < -1.3664970889390727e-7: tmp = t_1 elif t_2 < 1.4754293444577233e-239: tmp = ((y * (a - z)) - (x * t)) / (a - t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + x) - Float64(Float64(Float64(z - t) * Float64(1.0 / Float64(a - t))) * y)) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = Float64(Float64(Float64(y * Float64(a - z)) - Float64(x * t)) / Float64(a - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y); t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = ((y * (a - z)) - (x * t)) / (a - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -1.3664970889390727e-7], t$95$1, If[Less[t$95$2, 1.4754293444577233e-239], N[(N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 < -1.3664970889390727 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4754293444577233 \cdot 10^{-239}:\\
\;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025051
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -13664970889390727/100000000000000000000000) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 14754293444577233/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)))))
(- (+ x y) (/ (* (- z t) y) (- a t))))