
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (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 - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (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 - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (/ (- x (* y z)) t_1)))
(if (<= t_2 (- INFINITY))
(* (/ (- (/ x y) z) t_1) y)
(if (<= t_2 1e+291) t_2 (/ (- (/ x z) y) (- a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x - (y * z)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (((x / y) - z) / t_1) * y;
} else if (t_2 <= 1e+291) {
tmp = t_2;
} else {
tmp = ((x / z) - y) / -a;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x - (y * z)) / t_1;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = (((x / y) - z) / t_1) * y;
} else if (t_2 <= 1e+291) {
tmp = t_2;
} else {
tmp = ((x / z) - y) / -a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (a * z) t_2 = (x - (y * z)) / t_1 tmp = 0 if t_2 <= -math.inf: tmp = (((x / y) - z) / t_1) * y elif t_2 <= 1e+291: tmp = t_2 else: tmp = ((x / z) - y) / -a return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x - Float64(y * z)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(x / y) - z) / t_1) * y); elseif (t_2 <= 1e+291) tmp = t_2; else tmp = Float64(Float64(Float64(x / z) - y) / Float64(-a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (a * z); t_2 = (x - (y * z)) / t_1; tmp = 0.0; if (t_2 <= -Inf) tmp = (((x / y) - z) / t_1) * y; elseif (t_2 <= 1e+291) tmp = t_2; else tmp = ((x / z) - y) / -a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(N[(x / y), $MachinePrecision] - z), $MachinePrecision] / t$95$1), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$2, 1e+291], t$95$2, N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / (-a)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x - y \cdot z}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{\frac{x}{y} - z}{t\_1} \cdot y\\
\mathbf{elif}\;t\_2 \leq 10^{+291}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z} - y}{-a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0Initial program 60.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/r*N/A
associate-*r/N/A
div-add-revN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 9.9999999999999996e290Initial program 94.2%
if 9.9999999999999996e290 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 26.9%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6449.6
Applied rewrites49.6%
Taylor expanded in a around inf
distribute-lft-out--N/A
associate-*r/N/A
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-neg.f6496.3
Applied rewrites96.3%
Final simplification95.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- (/ x z) y) (- a))))
(if (<= z -1.45e+51)
t_1
(if (<= z 2.2e-71)
(/ x (- t (* a z)))
(if (<= z 5.4e+50) (* (/ y (fma a z (- t))) z) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((x / z) - y) / -a;
double tmp;
if (z <= -1.45e+51) {
tmp = t_1;
} else if (z <= 2.2e-71) {
tmp = x / (t - (a * z));
} else if (z <= 5.4e+50) {
tmp = (y / fma(a, z, -t)) * z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x / z) - y) / Float64(-a)) tmp = 0.0 if (z <= -1.45e+51) tmp = t_1; elseif (z <= 2.2e-71) tmp = Float64(x / Float64(t - Float64(a * z))); elseif (z <= 5.4e+50) tmp = Float64(Float64(y / fma(a, z, Float64(-t))) * z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / (-a)), $MachinePrecision]}, If[LessEqual[z, -1.45e+51], t$95$1, If[LessEqual[z, 2.2e-71], N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.4e+50], N[(N[(y / N[(a * z + (-t)), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{x}{z} - y}{-a}\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-71}:\\
\;\;\;\;\frac{x}{t - a \cdot z}\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+50}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(a, z, -t\right)} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.4499999999999999e51 or 5.4e50 < z Initial program 61.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.1
Applied rewrites71.1%
Taylor expanded in a around inf
distribute-lft-out--N/A
associate-*r/N/A
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-neg.f6482.9
Applied rewrites82.9%
if -1.4499999999999999e51 < z < 2.19999999999999997e-71Initial program 99.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6477.1
Applied rewrites77.1%
if 2.19999999999999997e-71 < z < 5.4e50Initial program 99.5%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
distribute-neg-inN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f6476.6
Applied rewrites76.6%
Applied rewrites76.6%
Final simplification79.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -8.8e+91)
(/ y a)
(if (<= z -1.3e+46)
(/ (- x) (* z a))
(if (<= z 1.8e-78)
(/ x t)
(if (<= z 1.85e+59) (* (- y) (/ z t)) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.8e+91) {
tmp = y / a;
} else if (z <= -1.3e+46) {
tmp = -x / (z * a);
} else if (z <= 1.8e-78) {
tmp = x / t;
} else if (z <= 1.85e+59) {
tmp = -y * (z / t);
} else {
tmp = y / a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-8.8d+91)) then
tmp = y / a
else if (z <= (-1.3d+46)) then
tmp = -x / (z * a)
else if (z <= 1.8d-78) then
tmp = x / t
else if (z <= 1.85d+59) then
tmp = -y * (z / t)
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.8e+91) {
tmp = y / a;
} else if (z <= -1.3e+46) {
tmp = -x / (z * a);
} else if (z <= 1.8e-78) {
tmp = x / t;
} else if (z <= 1.85e+59) {
tmp = -y * (z / t);
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8.8e+91: tmp = y / a elif z <= -1.3e+46: tmp = -x / (z * a) elif z <= 1.8e-78: tmp = x / t elif z <= 1.85e+59: tmp = -y * (z / t) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8.8e+91) tmp = Float64(y / a); elseif (z <= -1.3e+46) tmp = Float64(Float64(-x) / Float64(z * a)); elseif (z <= 1.8e-78) tmp = Float64(x / t); elseif (z <= 1.85e+59) tmp = Float64(Float64(-y) * Float64(z / t)); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -8.8e+91) tmp = y / a; elseif (z <= -1.3e+46) tmp = -x / (z * a); elseif (z <= 1.8e-78) tmp = x / t; elseif (z <= 1.85e+59) tmp = -y * (z / t); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8.8e+91], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.3e+46], N[((-x) / N[(z * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-78], N[(x / t), $MachinePrecision], If[LessEqual[z, 1.85e+59], N[((-y) * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{+91}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{+46}:\\
\;\;\;\;\frac{-x}{z \cdot a}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-78}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+59}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -8.79999999999999998e91 or 1.84999999999999999e59 < z Initial program 57.8%
Taylor expanded in z around inf
lower-/.f6468.9
Applied rewrites68.9%
if -8.79999999999999998e91 < z < -1.30000000000000007e46Initial program 92.1%
Taylor expanded in t around 0
mul-1-negN/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
distribute-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6484.3
Applied rewrites84.3%
Taylor expanded in x around inf
Applied rewrites75.7%
if -1.30000000000000007e46 < z < 1.8000000000000001e-78Initial program 99.8%
Taylor expanded in z around 0
lower-/.f6463.4
Applied rewrites63.4%
if 1.8000000000000001e-78 < z < 1.84999999999999999e59Initial program 96.3%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6463.3
Applied rewrites63.3%
Taylor expanded in x around 0
Applied rewrites50.4%
Final simplification64.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.35e+92)
(/ y a)
(if (<= z 2.2e-71)
(/ x (- t (* a z)))
(if (<= z 4.5e+183) (* (/ y (fma a z (- t))) z) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.35e+92) {
tmp = y / a;
} else if (z <= 2.2e-71) {
tmp = x / (t - (a * z));
} else if (z <= 4.5e+183) {
tmp = (y / fma(a, z, -t)) * z;
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.35e+92) tmp = Float64(y / a); elseif (z <= 2.2e-71) tmp = Float64(x / Float64(t - Float64(a * z))); elseif (z <= 4.5e+183) tmp = Float64(Float64(y / fma(a, z, Float64(-t))) * z); else tmp = Float64(y / a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.35e+92], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.2e-71], N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e+183], N[(N[(y / N[(a * z + (-t)), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+92}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-71}:\\
\;\;\;\;\frac{x}{t - a \cdot z}\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+183}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(a, z, -t\right)} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.35e92 or 4.50000000000000017e183 < z Initial program 52.9%
Taylor expanded in z around inf
lower-/.f6473.2
Applied rewrites73.2%
if -1.35e92 < z < 2.19999999999999997e-71Initial program 99.1%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6476.8
Applied rewrites76.8%
if 2.19999999999999997e-71 < z < 4.50000000000000017e183Initial program 90.6%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
distribute-neg-inN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f6464.5
Applied rewrites64.5%
Applied rewrites69.0%
Final simplification74.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.35e+92)
(/ y a)
(if (<= z 3.7e-62)
(/ x (- t (* a z)))
(if (<= z 4.5e+183) (* y (/ z (fma a z (- t)))) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.35e+92) {
tmp = y / a;
} else if (z <= 3.7e-62) {
tmp = x / (t - (a * z));
} else if (z <= 4.5e+183) {
tmp = y * (z / fma(a, z, -t));
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.35e+92) tmp = Float64(y / a); elseif (z <= 3.7e-62) tmp = Float64(x / Float64(t - Float64(a * z))); elseif (z <= 4.5e+183) tmp = Float64(y * Float64(z / fma(a, z, Float64(-t)))); else tmp = Float64(y / a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.35e+92], N[(y / a), $MachinePrecision], If[LessEqual[z, 3.7e-62], N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e+183], N[(y * N[(z / N[(a * z + (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+92}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-62}:\\
\;\;\;\;\frac{x}{t - a \cdot z}\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+183}:\\
\;\;\;\;y \cdot \frac{z}{\mathsf{fma}\left(a, z, -t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.35e92 or 4.50000000000000017e183 < z Initial program 52.9%
Taylor expanded in z around inf
lower-/.f6473.2
Applied rewrites73.2%
if -1.35e92 < z < 3.6999999999999998e-62Initial program 99.2%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6476.5
Applied rewrites76.5%
if 3.6999999999999998e-62 < z < 4.50000000000000017e183Initial program 90.2%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
distribute-neg-inN/A
associate-*r*N/A
mul-1-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-neg.f6465.1
Applied rewrites65.1%
Applied rewrites69.9%
Final simplification74.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.3e+170) (not (<= z 4.5e+183))) (/ (- (/ x z) y) (- a)) (/ (- x (* y z)) (- t (* a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.3e+170) || !(z <= 4.5e+183)) {
tmp = ((x / z) - y) / -a;
} else {
tmp = (x - (y * z)) / (t - (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 <= (-7.3d+170)) .or. (.not. (z <= 4.5d+183))) then
tmp = ((x / z) - y) / -a
else
tmp = (x - (y * z)) / (t - (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 <= -7.3e+170) || !(z <= 4.5e+183)) {
tmp = ((x / z) - y) / -a;
} else {
tmp = (x - (y * z)) / (t - (a * z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.3e+170) or not (z <= 4.5e+183): tmp = ((x / z) - y) / -a else: tmp = (x - (y * z)) / (t - (a * z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.3e+170) || !(z <= 4.5e+183)) tmp = Float64(Float64(Float64(x / z) - y) / Float64(-a)); else tmp = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.3e+170) || ~((z <= 4.5e+183))) tmp = ((x / z) - y) / -a; else tmp = (x - (y * z)) / (t - (a * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.3e+170], N[Not[LessEqual[z, 4.5e+183]], $MachinePrecision]], N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / (-a)), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.3 \cdot 10^{+170} \lor \neg \left(z \leq 4.5 \cdot 10^{+183}\right):\\
\;\;\;\;\frac{\frac{x}{z} - y}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t - a \cdot z}\\
\end{array}
\end{array}
if z < -7.30000000000000037e170 or 4.50000000000000017e183 < z Initial program 47.6%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6460.6
Applied rewrites60.6%
Taylor expanded in a around inf
distribute-lft-out--N/A
associate-*r/N/A
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-neg.f6487.3
Applied rewrites87.3%
if -7.30000000000000037e170 < z < 4.50000000000000017e183Initial program 95.4%
Final simplification93.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.35e+92)
(/ y a)
(if (<= z 1.2e-246)
(/ x (- t (* a z)))
(if (<= z 5.7e+51) (/ (- x (* z y)) t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.35e+92) {
tmp = y / a;
} else if (z <= 1.2e-246) {
tmp = x / (t - (a * z));
} else if (z <= 5.7e+51) {
tmp = (x - (z * y)) / t;
} else {
tmp = y / a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-1.35d+92)) then
tmp = y / a
else if (z <= 1.2d-246) then
tmp = x / (t - (a * z))
else if (z <= 5.7d+51) then
tmp = (x - (z * y)) / t
else
tmp = y / a
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+92) {
tmp = y / a;
} else if (z <= 1.2e-246) {
tmp = x / (t - (a * z));
} else if (z <= 5.7e+51) {
tmp = (x - (z * y)) / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.35e+92: tmp = y / a elif z <= 1.2e-246: tmp = x / (t - (a * z)) elif z <= 5.7e+51: tmp = (x - (z * y)) / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.35e+92) tmp = Float64(y / a); elseif (z <= 1.2e-246) tmp = Float64(x / Float64(t - Float64(a * z))); elseif (z <= 5.7e+51) tmp = Float64(Float64(x - Float64(z * y)) / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.35e+92) tmp = y / a; elseif (z <= 1.2e-246) tmp = x / (t - (a * z)); elseif (z <= 5.7e+51) tmp = (x - (z * y)) / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.35e+92], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.2e-246], N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.7e+51], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+92}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-246}:\\
\;\;\;\;\frac{x}{t - a \cdot z}\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{+51}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.35e92 or 5.7000000000000002e51 < z Initial program 57.7%
Taylor expanded in z around inf
lower-/.f6467.5
Applied rewrites67.5%
if -1.35e92 < z < 1.1999999999999999e-246Initial program 98.9%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6480.1
Applied rewrites80.1%
if 1.1999999999999999e-246 < z < 5.7000000000000002e51Initial program 99.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6470.6
Applied rewrites70.6%
Final simplification73.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.85e+46) (/ y a) (if (<= z 1.8e-78) (/ x t) (if (<= z 1.85e+59) (* (- y) (/ z t)) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.85e+46) {
tmp = y / a;
} else if (z <= 1.8e-78) {
tmp = x / t;
} else if (z <= 1.85e+59) {
tmp = -y * (z / t);
} else {
tmp = y / a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-1.85d+46)) then
tmp = y / a
else if (z <= 1.8d-78) then
tmp = x / t
else if (z <= 1.85d+59) then
tmp = -y * (z / t)
else
tmp = y / a
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.85e+46) {
tmp = y / a;
} else if (z <= 1.8e-78) {
tmp = x / t;
} else if (z <= 1.85e+59) {
tmp = -y * (z / t);
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.85e+46: tmp = y / a elif z <= 1.8e-78: tmp = x / t elif z <= 1.85e+59: tmp = -y * (z / t) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.85e+46) tmp = Float64(y / a); elseif (z <= 1.8e-78) tmp = Float64(x / t); elseif (z <= 1.85e+59) tmp = Float64(Float64(-y) * Float64(z / t)); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.85e+46) tmp = y / a; elseif (z <= 1.8e-78) tmp = x / t; elseif (z <= 1.85e+59) tmp = -y * (z / t); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.85e+46], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.8e-78], N[(x / t), $MachinePrecision], If[LessEqual[z, 1.85e+59], N[((-y) * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+46}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-78}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+59}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.84999999999999995e46 or 1.84999999999999999e59 < z Initial program 61.8%
Taylor expanded in z around inf
lower-/.f6462.7
Applied rewrites62.7%
if -1.84999999999999995e46 < z < 1.8000000000000001e-78Initial program 99.8%
Taylor expanded in z around 0
lower-/.f6463.4
Applied rewrites63.4%
if 1.8000000000000001e-78 < z < 1.84999999999999999e59Initial program 96.3%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6463.3
Applied rewrites63.3%
Taylor expanded in x around 0
Applied rewrites50.4%
Final simplification61.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.35e+92) (not (<= z 9e+134))) (/ y a) (/ x (- t (* a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+92) || !(z <= 9e+134)) {
tmp = y / a;
} else {
tmp = x / (t - (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 <= (-1.35d+92)) .or. (.not. (z <= 9d+134))) then
tmp = y / a
else
tmp = x / (t - (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 <= -1.35e+92) || !(z <= 9e+134)) {
tmp = y / a;
} else {
tmp = x / (t - (a * z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.35e+92) or not (z <= 9e+134): tmp = y / a else: tmp = x / (t - (a * z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.35e+92) || !(z <= 9e+134)) tmp = Float64(y / a); else tmp = Float64(x / Float64(t - Float64(a * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.35e+92) || ~((z <= 9e+134))) tmp = y / a; else tmp = x / (t - (a * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.35e+92], N[Not[LessEqual[z, 9e+134]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+92} \lor \neg \left(z \leq 9 \cdot 10^{+134}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - a \cdot z}\\
\end{array}
\end{array}
if z < -1.35e92 or 8.9999999999999995e134 < z Initial program 54.5%
Taylor expanded in z around inf
lower-/.f6471.9
Applied rewrites71.9%
if -1.35e92 < z < 8.9999999999999995e134Initial program 98.1%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6469.9
Applied rewrites69.9%
Final simplification70.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.85e+46) (not (<= z 1.8e+33))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.85e+46) || !(z <= 1.8e+33)) {
tmp = y / a;
} else {
tmp = x / 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 ((z <= (-1.85d+46)) .or. (.not. (z <= 1.8d+33))) then
tmp = y / a
else
tmp = x / t
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.85e+46) || !(z <= 1.8e+33)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.85e+46) or not (z <= 1.8e+33): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.85e+46) || !(z <= 1.8e+33)) tmp = Float64(y / a); else tmp = Float64(x / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.85e+46) || ~((z <= 1.8e+33))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.85e+46], N[Not[LessEqual[z, 1.8e+33]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+46} \lor \neg \left(z \leq 1.8 \cdot 10^{+33}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -1.84999999999999995e46 or 1.8000000000000001e33 < z Initial program 63.0%
Taylor expanded in z around inf
lower-/.f6460.7
Applied rewrites60.7%
if -1.84999999999999995e46 < z < 1.8000000000000001e33Initial program 99.8%
Taylor expanded in z around 0
lower-/.f6459.2
Applied rewrites59.2%
Final simplification59.9%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / 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 / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t}
\end{array}
Initial program 84.0%
Taylor expanded in z around 0
lower-/.f6436.8
Applied rewrites36.8%
Final simplification36.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (- (/ x t_1) (/ y (- (/ t z) a)))))
(if (< z -32113435955957344.0)
t_2
(if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} 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 = t - (a * z)
t_2 = (x / t_1) - (y / ((t / z) - a))
if (z < (-32113435955957344.0d0)) then
tmp = t_2
else if (z < 3.5139522372978296d-86) then
tmp = (x - (y * z)) * (1.0d0 / t_1)
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 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (a * z) t_2 = (x / t_1) - (y / ((t / z) - a)) tmp = 0 if z < -32113435955957344.0: tmp = t_2 elif z < 3.5139522372978296e-86: tmp = (x - (y * z)) * (1.0 / t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x / t_1) - Float64(y / Float64(Float64(t / z) - a))) tmp = 0.0 if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = Float64(Float64(x - Float64(y * z)) * Float64(1.0 / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (a * z); t_2 = (x / t_1) - (y / ((t / z) - a)); tmp = 0.0; if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = (x - (y * z)) * (1.0 / t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / t$95$1), $MachinePrecision] - N[(y / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -32113435955957344.0], t$95$2, If[Less[z, 3.5139522372978296e-86], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t\_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{if}\;z < -32113435955957344:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\
\;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024350
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< z -32113435955957344) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 4392440296622287/125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (- x (* y z)) (/ 1 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))))))
(/ (- x (* y z)) (- t (* a z))))