
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (- t z) -1.0)))
(if (or (<= a -1.7e+81) (not (<= a 200000000000.0)))
(- x (/ (- y z) (/ t_1 a)))
(- x (/ (* (- y z) a) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) - -1.0;
double tmp;
if ((a <= -1.7e+81) || !(a <= 200000000000.0)) {
tmp = x - ((y - z) / (t_1 / a));
} else {
tmp = x - (((y - z) * a) / 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 = (t - z) - (-1.0d0)
if ((a <= (-1.7d+81)) .or. (.not. (a <= 200000000000.0d0))) then
tmp = x - ((y - z) / (t_1 / a))
else
tmp = x - (((y - z) * a) / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) - -1.0;
double tmp;
if ((a <= -1.7e+81) || !(a <= 200000000000.0)) {
tmp = x - ((y - z) / (t_1 / a));
} else {
tmp = x - (((y - z) * a) / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t - z) - -1.0 tmp = 0 if (a <= -1.7e+81) or not (a <= 200000000000.0): tmp = x - ((y - z) / (t_1 / a)) else: tmp = x - (((y - z) * a) / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t - z) - -1.0) tmp = 0.0 if ((a <= -1.7e+81) || !(a <= 200000000000.0)) tmp = Float64(x - Float64(Float64(y - z) / Float64(t_1 / a))); else tmp = Float64(x - Float64(Float64(Float64(y - z) * a) / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t - z) - -1.0; tmp = 0.0; if ((a <= -1.7e+81) || ~((a <= 200000000000.0))) tmp = x - ((y - z) / (t_1 / a)); else tmp = x - (((y - z) * a) / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]}, If[Or[LessEqual[a, -1.7e+81], N[Not[LessEqual[a, 200000000000.0]], $MachinePrecision]], N[(x - N[(N[(y - z), $MachinePrecision] / N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - z\right) - -1\\
\mathbf{if}\;a \leq -1.7 \cdot 10^{+81} \lor \neg \left(a \leq 200000000000\right):\\
\;\;\;\;x - \frac{y - z}{\frac{t\_1}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\left(y - z\right) \cdot a}{t\_1}\\
\end{array}
\end{array}
if a < -1.70000000000000001e81 or 2e11 < a Initial program 99.8%
if -1.70000000000000001e81 < a < 2e11Initial program 92.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.9
lift-+.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (- t z) -1.0)) (t_2 (/ (- y z) (/ t_1 a))))
(if (or (<= t_2 -1e+109) (not (<= t_2 2e+145)))
(* (- y z) (/ a (+ (- -1.0 t) z)))
(- x (/ (* (- y z) a) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) - -1.0;
double t_2 = (y - z) / (t_1 / a);
double tmp;
if ((t_2 <= -1e+109) || !(t_2 <= 2e+145)) {
tmp = (y - z) * (a / ((-1.0 - t) + z));
} else {
tmp = x - (((y - z) * a) / t_1);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (t - z) - (-1.0d0)
t_2 = (y - z) / (t_1 / a)
if ((t_2 <= (-1d+109)) .or. (.not. (t_2 <= 2d+145))) then
tmp = (y - z) * (a / (((-1.0d0) - t) + z))
else
tmp = x - (((y - z) * a) / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) - -1.0;
double t_2 = (y - z) / (t_1 / a);
double tmp;
if ((t_2 <= -1e+109) || !(t_2 <= 2e+145)) {
tmp = (y - z) * (a / ((-1.0 - t) + z));
} else {
tmp = x - (((y - z) * a) / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t - z) - -1.0 t_2 = (y - z) / (t_1 / a) tmp = 0 if (t_2 <= -1e+109) or not (t_2 <= 2e+145): tmp = (y - z) * (a / ((-1.0 - t) + z)) else: tmp = x - (((y - z) * a) / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t - z) - -1.0) t_2 = Float64(Float64(y - z) / Float64(t_1 / a)) tmp = 0.0 if ((t_2 <= -1e+109) || !(t_2 <= 2e+145)) tmp = Float64(Float64(y - z) * Float64(a / Float64(Float64(-1.0 - t) + z))); else tmp = Float64(x - Float64(Float64(Float64(y - z) * a) / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t - z) - -1.0; t_2 = (y - z) / (t_1 / a); tmp = 0.0; if ((t_2 <= -1e+109) || ~((t_2 <= 2e+145))) tmp = (y - z) * (a / ((-1.0 - t) + z)); else tmp = x - (((y - z) * a) / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] / N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -1e+109], N[Not[LessEqual[t$95$2, 2e+145]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(a / N[(N[(-1.0 - t), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - z\right) - -1\\
t_2 := \frac{y - z}{\frac{t\_1}{a}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+109} \lor \neg \left(t\_2 \leq 2 \cdot 10^{+145}\right):\\
\;\;\;\;\left(y - z\right) \cdot \frac{a}{\left(-1 - t\right) + z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\left(y - z\right) \cdot a}{t\_1}\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -9.99999999999999982e108 or 2e145 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites88.8%
if -9.99999999999999982e108 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 2e145Initial program 94.4%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6497.5
lift-+.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6497.5
Applied rewrites97.5%
Final simplification95.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- t z)) a x)))
(if (<= z -8.8e+30)
t_1
(if (<= z 1.1e-175)
(fma (/ (- y z) t) (- a) x)
(if (<= z 2.35e-38) (- x (* y a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / (t - z)), a, x);
double tmp;
if (z <= -8.8e+30) {
tmp = t_1;
} else if (z <= 1.1e-175) {
tmp = fma(((y - z) / t), -a, x);
} else if (z <= 2.35e-38) {
tmp = x - (y * a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / Float64(t - z)), a, x) tmp = 0.0 if (z <= -8.8e+30) tmp = t_1; elseif (z <= 1.1e-175) tmp = fma(Float64(Float64(y - z) / t), Float64(-a), x); elseif (z <= 2.35e-38) tmp = Float64(x - Float64(y * a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -8.8e+30], t$95$1, If[LessEqual[z, 1.1e-175], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * (-a) + x), $MachinePrecision], If[LessEqual[z, 2.35e-38], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{t - z}, a, x\right)\\
\mathbf{if}\;z \leq -8.8 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-175}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{t}, -a, x\right)\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{-38}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.7999999999999999e30 or 2.34999999999999999e-38 < z Initial program 92.6%
Taylor expanded in y around 0
Applied rewrites86.3%
Taylor expanded in t around inf
Applied rewrites85.0%
if -8.7999999999999999e30 < z < 1.1e-175Initial program 98.8%
Taylor expanded in t around inf
Applied rewrites78.1%
if 1.1e-175 < z < 2.34999999999999999e-38Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites90.5%
Taylor expanded in t around 0
Applied rewrites71.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- t z)) a x)))
(if (<= z -2.2e+28)
t_1
(if (<= z -2.5e-238)
(- x (/ (* y a) t))
(if (<= z 2.35e-38) (- x (* y a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / (t - z)), a, x);
double tmp;
if (z <= -2.2e+28) {
tmp = t_1;
} else if (z <= -2.5e-238) {
tmp = x - ((y * a) / t);
} else if (z <= 2.35e-38) {
tmp = x - (y * a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / Float64(t - z)), a, x) tmp = 0.0 if (z <= -2.2e+28) tmp = t_1; elseif (z <= -2.5e-238) tmp = Float64(x - Float64(Float64(y * a) / t)); elseif (z <= 2.35e-38) tmp = Float64(x - Float64(y * a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -2.2e+28], t$95$1, If[LessEqual[z, -2.5e-238], N[(x - N[(N[(y * a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.35e-38], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{t - z}, a, x\right)\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-238}:\\
\;\;\;\;x - \frac{y \cdot a}{t}\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{-38}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.19999999999999986e28 or 2.34999999999999999e-38 < z Initial program 92.6%
Taylor expanded in y around 0
Applied rewrites86.3%
Taylor expanded in t around inf
Applied rewrites85.0%
if -2.19999999999999986e28 < z < -2.5e-238Initial program 97.5%
Taylor expanded in t around inf
Applied rewrites85.1%
Taylor expanded in y around inf
Applied rewrites85.2%
if -2.5e-238 < z < 2.34999999999999999e-38Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites96.5%
Taylor expanded in t around 0
Applied rewrites70.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.5e+142) (not (<= z 4e+49))) (fma (/ z (- t z)) a x) (- x (* (/ y (- (+ 1.0 t) z)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.5e+142) || !(z <= 4e+49)) {
tmp = fma((z / (t - z)), a, x);
} else {
tmp = x - ((y / ((1.0 + t) - z)) * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.5e+142) || !(z <= 4e+49)) tmp = fma(Float64(z / Float64(t - z)), a, x); else tmp = Float64(x - Float64(Float64(y / Float64(Float64(1.0 + t) - z)) * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.5e+142], N[Not[LessEqual[z, 4e+49]], $MachinePrecision]], N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - N[(N[(y / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+142} \lor \neg \left(z \leq 4 \cdot 10^{+49}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\left(1 + t\right) - z} \cdot a\\
\end{array}
\end{array}
if z < -7.5000000000000002e142 or 3.99999999999999979e49 < z Initial program 88.4%
Taylor expanded in y around 0
Applied rewrites93.3%
Taylor expanded in t around inf
Applied rewrites93.3%
if -7.5000000000000002e142 < z < 3.99999999999999979e49Initial program 99.2%
Taylor expanded in y around inf
Applied rewrites91.3%
Final simplification91.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -7.5e+142)
(fma (/ z (- t z)) a x)
(if (<= z 2.35e-38)
(- x (* (/ y (+ 1.0 t)) a))
(fma (/ z (- (+ 1.0 t) z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.5e+142) {
tmp = fma((z / (t - z)), a, x);
} else if (z <= 2.35e-38) {
tmp = x - ((y / (1.0 + t)) * a);
} else {
tmp = fma((z / ((1.0 + t) - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.5e+142) tmp = fma(Float64(z / Float64(t - z)), a, x); elseif (z <= 2.35e-38) tmp = Float64(x - Float64(Float64(y / Float64(1.0 + t)) * a)); else tmp = fma(Float64(z / Float64(Float64(1.0 + t) - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.5e+142], N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 2.35e-38], N[(x - N[(N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+142}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t - z}, a, x\right)\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{-38}:\\
\;\;\;\;x - \frac{y}{1 + t} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(1 + t\right) - z}, a, x\right)\\
\end{array}
\end{array}
if z < -7.5000000000000002e142Initial program 94.4%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in t around inf
Applied rewrites100.0%
if -7.5000000000000002e142 < z < 2.34999999999999999e-38Initial program 99.2%
Taylor expanded in z around 0
Applied rewrites93.0%
if 2.34999999999999999e-38 < z Initial program 89.4%
Taylor expanded in y around 0
Applied rewrites83.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.5e+142) (not (<= z 2.5e-38))) (fma (/ z (- t z)) a x) (- x (* (/ y (+ 1.0 t)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.5e+142) || !(z <= 2.5e-38)) {
tmp = fma((z / (t - z)), a, x);
} else {
tmp = x - ((y / (1.0 + t)) * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.5e+142) || !(z <= 2.5e-38)) tmp = fma(Float64(z / Float64(t - z)), a, x); else tmp = Float64(x - Float64(Float64(y / Float64(1.0 + t)) * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.5e+142], N[Not[LessEqual[z, 2.5e-38]], $MachinePrecision]], N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - N[(N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+142} \lor \neg \left(z \leq 2.5 \cdot 10^{-38}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{1 + t} \cdot a\\
\end{array}
\end{array}
if z < -7.5000000000000002e142 or 2.50000000000000017e-38 < z Initial program 91.1%
Taylor expanded in y around 0
Applied rewrites88.8%
Taylor expanded in t around inf
Applied rewrites87.2%
if -7.5000000000000002e142 < z < 2.50000000000000017e-38Initial program 99.2%
Taylor expanded in z around 0
Applied rewrites93.0%
Final simplification90.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.8e-5) (not (<= z 310.0))) (fma (/ z (- 1.0 z)) a x) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.8e-5) || !(z <= 310.0)) {
tmp = fma((z / (1.0 - z)), a, x);
} else {
tmp = x - (y * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.8e-5) || !(z <= 310.0)) tmp = fma(Float64(z / Float64(1.0 - z)), a, x); else tmp = Float64(x - Float64(y * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.8e-5], N[Not[LessEqual[z, 310.0]], $MachinePrecision]], N[(N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-5} \lor \neg \left(z \leq 310\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if z < -3.8000000000000002e-5 or 310 < z Initial program 92.5%
Taylor expanded in y around 0
Applied rewrites85.4%
Taylor expanded in t around 0
Applied rewrites77.3%
if -3.8000000000000002e-5 < z < 310Initial program 99.0%
Taylor expanded in z around 0
Applied rewrites95.8%
Taylor expanded in t around 0
Applied rewrites72.3%
Final simplification74.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.3e+31)
(- x a)
(if (<= z -2.5e-238)
(- x (/ (* y a) t))
(if (<= z 310.0) (- x (* y a)) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.3e+31) {
tmp = x - a;
} else if (z <= -2.5e-238) {
tmp = x - ((y * a) / t);
} else if (z <= 310.0) {
tmp = x - (y * a);
} else {
tmp = x - 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 <= (-3.3d+31)) then
tmp = x - a
else if (z <= (-2.5d-238)) then
tmp = x - ((y * a) / t)
else if (z <= 310.0d0) then
tmp = x - (y * a)
else
tmp = x - 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 <= -3.3e+31) {
tmp = x - a;
} else if (z <= -2.5e-238) {
tmp = x - ((y * a) / t);
} else if (z <= 310.0) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.3e+31: tmp = x - a elif z <= -2.5e-238: tmp = x - ((y * a) / t) elif z <= 310.0: tmp = x - (y * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.3e+31) tmp = Float64(x - a); elseif (z <= -2.5e-238) tmp = Float64(x - Float64(Float64(y * a) / t)); elseif (z <= 310.0) tmp = Float64(x - Float64(y * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.3e+31) tmp = x - a; elseif (z <= -2.5e-238) tmp = x - ((y * a) / t); elseif (z <= 310.0) tmp = x - (y * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.3e+31], N[(x - a), $MachinePrecision], If[LessEqual[z, -2.5e-238], N[(x - N[(N[(y * a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 310.0], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+31}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-238}:\\
\;\;\;\;x - \frac{y \cdot a}{t}\\
\mathbf{elif}\;z \leq 310:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.29999999999999992e31 or 310 < z Initial program 92.2%
Taylor expanded in z around inf
Applied rewrites76.6%
if -3.29999999999999992e31 < z < -2.5e-238Initial program 97.5%
Taylor expanded in t around inf
Applied rewrites85.1%
Taylor expanded in y around inf
Applied rewrites85.2%
if -2.5e-238 < z < 310Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites94.9%
Taylor expanded in t around 0
Applied rewrites70.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -0.165) (not (<= z 310.0))) (- x a) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -0.165) || !(z <= 310.0)) {
tmp = x - a;
} else {
tmp = x - (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 <= (-0.165d0)) .or. (.not. (z <= 310.0d0))) then
tmp = x - a
else
tmp = x - (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 <= -0.165) || !(z <= 310.0)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -0.165) or not (z <= 310.0): tmp = x - a else: tmp = x - (y * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -0.165) || !(z <= 310.0)) tmp = Float64(x - a); else tmp = Float64(x - Float64(y * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -0.165) || ~((z <= 310.0))) tmp = x - a; else tmp = x - (y * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 310.0]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 310\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 310 < z Initial program 92.5%
Taylor expanded in z around inf
Applied rewrites75.4%
if -0.165000000000000008 < z < 310Initial program 99.0%
Taylor expanded in z around 0
Applied rewrites95.8%
Taylor expanded in t around 0
Applied rewrites72.3%
Final simplification73.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.8e-10) (not (<= z 1350.0))) (- x a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.8e-10) || !(z <= 1350.0)) {
tmp = x - a;
} 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 ((z <= (-3.8d-10)) .or. (.not. (z <= 1350.0d0))) then
tmp = x - a
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 ((z <= -3.8e-10) || !(z <= 1350.0)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.8e-10) or not (z <= 1350.0): tmp = x - a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.8e-10) || !(z <= 1350.0)) tmp = Float64(x - a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.8e-10) || ~((z <= 1350.0))) tmp = x - a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.8e-10], N[Not[LessEqual[z, 1350.0]], $MachinePrecision]], N[(x - a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-10} \lor \neg \left(z \leq 1350\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.7999999999999998e-10 or 1350 < z Initial program 92.6%
Taylor expanded in z around inf
Applied rewrites74.9%
if -3.7999999999999998e-10 < z < 1350Initial program 99.0%
Taylor expanded in x around inf
Applied rewrites60.1%
Final simplification67.8%
(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 95.7%
Taylor expanded in x around inf
Applied rewrites56.4%
(FPCore (x y z t a) :precision binary64 (- x (* (/ (- y z) (+ (- t z) 1.0)) a)))
double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - (((y - z) / ((t - z) + 1.0d0)) * a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
def code(x, y, z, t, a): return x - (((y - z) / ((t - z) + 1.0)) * a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(Float64(y - z) / Float64(Float64(t - z) + 1.0)) * a)) end
function tmp = code(x, y, z, t, a) tmp = x - (((y - z) / ((t - z) + 1.0)) * a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(N[(y - z), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\left(t - z\right) + 1} \cdot a
\end{array}
herbie shell --seed 2025019
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (- x (* (/ (- y z) (+ (- t z) 1)) a)))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))