
(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}
Herbie found 9 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 (- x (/ (- y z) (/ (+ (- t z) 1.0) a)))))
(if (<= t_1 -1e+50)
t_1
(if (<= t_1 2e-43)
(* x (+ 1.0 (- (/ (* a (- y z)) (* x (- (+ 1.0 t) z))))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y - z) / (((t - z) + 1.0) / a));
double tmp;
if (t_1 <= -1e+50) {
tmp = t_1;
} else if (t_1 <= 2e-43) {
tmp = x * (1.0 + -((a * (y - z)) / (x * ((1.0 + t) - z))));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x - ((y - z) / (((t - z) + 1.0d0) / a))
if (t_1 <= (-1d+50)) then
tmp = t_1
else if (t_1 <= 2d-43) then
tmp = x * (1.0d0 + -((a * (y - z)) / (x * ((1.0d0 + t) - z))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y - z) / (((t - z) + 1.0) / a));
double tmp;
if (t_1 <= -1e+50) {
tmp = t_1;
} else if (t_1 <= 2e-43) {
tmp = x * (1.0 + -((a * (y - z)) / (x * ((1.0 + t) - z))));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - ((y - z) / (((t - z) + 1.0) / a)) tmp = 0 if t_1 <= -1e+50: tmp = t_1 elif t_1 <= 2e-43: tmp = x * (1.0 + -((a * (y - z)) / (x * ((1.0 + t) - z)))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) tmp = 0.0 if (t_1 <= -1e+50) tmp = t_1; elseif (t_1 <= 2e-43) tmp = Float64(x * Float64(1.0 + Float64(-Float64(Float64(a * Float64(y - z)) / Float64(x * Float64(Float64(1.0 + t) - z)))))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - ((y - z) / (((t - z) + 1.0) / a)); tmp = 0.0; if (t_1 <= -1e+50) tmp = t_1; elseif (t_1 <= 2e-43) tmp = x * (1.0 + -((a * (y - z)) / (x * ((1.0 + t) - z)))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+50], t$95$1, If[LessEqual[t$95$1, 2e-43], N[(x * N[(1.0 + (-N[(N[(a * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(x * N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-43}:\\
\;\;\;\;x \cdot \left(1 + \left(-\frac{a \cdot \left(y - z\right)}{x \cdot \left(\left(1 + t\right) - z\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 x (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a))) < -1.0000000000000001e50 or 2.00000000000000015e-43 < (-.f64 x (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a))) Initial program 99.8%
if -1.0000000000000001e50 < (-.f64 x (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a))) < 2.00000000000000015e-43Initial program 89.1%
Taylor expanded in y around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.1%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift--.f64N/A
lift-+.f6498.3
Applied rewrites98.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ (- z) (/ (+ (- t z) 1.0) a)))))
(if (<= z -2.7e-6)
t_1
(if (<= z 1.05e-41) (- x (* a (/ y (+ 1.0 t)))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (-z / (((t - z) + 1.0) / a));
double tmp;
if (z <= -2.7e-6) {
tmp = t_1;
} else if (z <= 1.05e-41) {
tmp = x - (a * (y / (1.0 + t)));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x - (-z / (((t - z) + 1.0d0) / a))
if (z <= (-2.7d-6)) then
tmp = t_1
else if (z <= 1.05d-41) then
tmp = x - (a * (y / (1.0d0 + t)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - (-z / (((t - z) + 1.0) / a));
double tmp;
if (z <= -2.7e-6) {
tmp = t_1;
} else if (z <= 1.05e-41) {
tmp = x - (a * (y / (1.0 + t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (-z / (((t - z) + 1.0) / a)) tmp = 0 if z <= -2.7e-6: tmp = t_1 elif z <= 1.05e-41: tmp = x - (a * (y / (1.0 + t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(-z) / Float64(Float64(Float64(t - z) + 1.0) / a))) tmp = 0.0 if (z <= -2.7e-6) tmp = t_1; elseif (z <= 1.05e-41) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 + t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (-z / (((t - z) + 1.0) / a)); tmp = 0.0; if (z <= -2.7e-6) tmp = t_1; elseif (z <= 1.05e-41) tmp = x - (a * (y / (1.0 + t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[((-z) / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.7e-6], t$95$1, If[LessEqual[z, 1.05e-41], N[(x - N[(a * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{-z}{\frac{\left(t - z\right) + 1}{a}}\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-41}:\\
\;\;\;\;x - a \cdot \frac{y}{1 + t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.69999999999999998e-6 or 1.05000000000000006e-41 < z Initial program 94.8%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6480.4
Applied rewrites80.4%
if -2.69999999999999998e-6 < z < 1.05000000000000006e-41Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6493.6
Applied rewrites93.6%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.75e+33)
(- x (* a (/ y t)))
(if (<= t 25000000000000.0)
(- x (/ (- y z) (/ (- 1.0 z) a)))
(- x (/ (- y z) (/ t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.75e+33) {
tmp = x - (a * (y / t));
} else if (t <= 25000000000000.0) {
tmp = x - ((y - z) / ((1.0 - z) / a));
} else {
tmp = x - ((y - z) / (t / 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 (t <= (-1.75d+33)) then
tmp = x - (a * (y / t))
else if (t <= 25000000000000.0d0) then
tmp = x - ((y - z) / ((1.0d0 - z) / a))
else
tmp = x - ((y - z) / (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.75e+33) {
tmp = x - (a * (y / t));
} else if (t <= 25000000000000.0) {
tmp = x - ((y - z) / ((1.0 - z) / a));
} else {
tmp = x - ((y - z) / (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.75e+33: tmp = x - (a * (y / t)) elif t <= 25000000000000.0: tmp = x - ((y - z) / ((1.0 - z) / a)) else: tmp = x - ((y - z) / (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.75e+33) tmp = Float64(x - Float64(a * Float64(y / t))); elseif (t <= 25000000000000.0) tmp = Float64(x - Float64(Float64(y - z) / Float64(Float64(1.0 - z) / a))); else tmp = Float64(x - Float64(Float64(y - z) / Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.75e+33) tmp = x - (a * (y / t)); elseif (t <= 25000000000000.0) tmp = x - ((y - z) / ((1.0 - z) / a)); else tmp = x - ((y - z) / (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.75e+33], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 25000000000000.0], N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(1.0 - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y - z), $MachinePrecision] / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.75 \cdot 10^{+33}:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{elif}\;t \leq 25000000000000:\\
\;\;\;\;x - \frac{y - z}{\frac{1 - z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y - z}{\frac{t}{a}}\\
\end{array}
\end{array}
if t < -1.75000000000000005e33Initial program 96.6%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6479.3
Applied rewrites79.3%
Taylor expanded in t around inf
Applied rewrites79.3%
if -1.75000000000000005e33 < t < 2.5e13Initial program 96.8%
Taylor expanded in t around 0
lower--.f6494.7
Applied rewrites94.7%
if 2.5e13 < t Initial program 96.9%
Taylor expanded in t around inf
Applied rewrites83.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.8e+57)
(- x a)
(if (<= z 6.5e-90)
(- x (* a y))
(if (<= z 8.5e+53) (- x (* a (/ y t))) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.8e+57) {
tmp = x - a;
} else if (z <= 6.5e-90) {
tmp = x - (a * y);
} else if (z <= 8.5e+53) {
tmp = x - (a * (y / t));
} 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 <= (-2.8d+57)) then
tmp = x - a
else if (z <= 6.5d-90) then
tmp = x - (a * y)
else if (z <= 8.5d+53) then
tmp = x - (a * (y / t))
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 <= -2.8e+57) {
tmp = x - a;
} else if (z <= 6.5e-90) {
tmp = x - (a * y);
} else if (z <= 8.5e+53) {
tmp = x - (a * (y / t));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.8e+57: tmp = x - a elif z <= 6.5e-90: tmp = x - (a * y) elif z <= 8.5e+53: tmp = x - (a * (y / t)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.8e+57) tmp = Float64(x - a); elseif (z <= 6.5e-90) tmp = Float64(x - Float64(a * y)); elseif (z <= 8.5e+53) tmp = Float64(x - Float64(a * Float64(y / t))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.8e+57) tmp = x - a; elseif (z <= 6.5e-90) tmp = x - (a * y); elseif (z <= 8.5e+53) tmp = x - (a * (y / t)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.8e+57], N[(x - a), $MachinePrecision], If[LessEqual[z, 6.5e-90], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e+53], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+57}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-90}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+53}:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.8e57 or 8.5000000000000002e53 < z Initial program 93.5%
Taylor expanded in z around inf
Applied rewrites80.5%
if -2.8e57 < z < 6.4999999999999996e-90Initial program 98.9%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6474.7
Applied rewrites74.7%
Taylor expanded in z around 0
lower-*.f6470.4
Applied rewrites70.4%
if 6.4999999999999996e-90 < z < 8.5000000000000002e53Initial program 99.4%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6476.6
Applied rewrites76.6%
Taylor expanded in t around inf
Applied rewrites60.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -7e+58) (- x a) (if (<= z 9e+53) (- x (* a (/ y (+ 1.0 t)))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7e+58) {
tmp = x - a;
} else if (z <= 9e+53) {
tmp = x - (a * (y / (1.0 + t)));
} 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 <= (-7d+58)) then
tmp = x - a
else if (z <= 9d+53) then
tmp = x - (a * (y / (1.0d0 + t)))
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 <= -7e+58) {
tmp = x - a;
} else if (z <= 9e+53) {
tmp = x - (a * (y / (1.0 + t)));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7e+58: tmp = x - a elif z <= 9e+53: tmp = x - (a * (y / (1.0 + t))) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7e+58) tmp = Float64(x - a); elseif (z <= 9e+53) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 + t)))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7e+58) tmp = x - a; elseif (z <= 9e+53) tmp = x - (a * (y / (1.0 + t))); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7e+58], N[(x - a), $MachinePrecision], If[LessEqual[z, 9e+53], N[(x - N[(a * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+58}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+53}:\\
\;\;\;\;x - a \cdot \frac{y}{1 + t}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -6.9999999999999995e58 or 9.0000000000000004e53 < z Initial program 93.5%
Taylor expanded in z around inf
Applied rewrites80.6%
if -6.9999999999999995e58 < z < 9.0000000000000004e53Initial program 99.0%
Taylor expanded in z around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6488.2
Applied rewrites88.2%
(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}
Initial program 96.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.8e+57) (- x a) (if (<= z 1.2e-89) (- x (* a y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.8e+57) {
tmp = x - a;
} else if (z <= 1.2e-89) {
tmp = x - (a * y);
} 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 <= (-2.8d+57)) then
tmp = x - a
else if (z <= 1.2d-89) then
tmp = x - (a * y)
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 <= -2.8e+57) {
tmp = x - a;
} else if (z <= 1.2e-89) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.8e+57: tmp = x - a elif z <= 1.2e-89: tmp = x - (a * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.8e+57) tmp = Float64(x - a); elseif (z <= 1.2e-89) tmp = Float64(x - Float64(a * y)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.8e+57) tmp = x - a; elseif (z <= 1.2e-89) tmp = x - (a * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.8e+57], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.2e-89], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+57}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-89}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.8e57 or 1.20000000000000008e-89 < z Initial program 94.8%
Taylor expanded in z around inf
Applied rewrites73.6%
if -2.8e57 < z < 1.20000000000000008e-89Initial program 98.9%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6474.7
Applied rewrites74.7%
Taylor expanded in z around 0
lower-*.f6470.4
Applied rewrites70.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.46e+51) (- x a) (if (<= z 1.2e+53) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.46e+51) {
tmp = x - a;
} else if (z <= 1.2e+53) {
tmp = x;
} 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 <= (-1.46d+51)) then
tmp = x - a
else if (z <= 1.2d+53) then
tmp = x
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 <= -1.46e+51) {
tmp = x - a;
} else if (z <= 1.2e+53) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.46e+51: tmp = x - a elif z <= 1.2e+53: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.46e+51) tmp = Float64(x - a); elseif (z <= 1.2e+53) tmp = x; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.46e+51) tmp = x - a; elseif (z <= 1.2e+53) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.46e+51], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.2e+53], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.46 \cdot 10^{+51}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+53}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.4600000000000001e51 or 1.2e53 < z Initial program 93.5%
Taylor expanded in z around inf
Applied rewrites80.4%
if -1.4600000000000001e51 < z < 1.2e53Initial program 99.1%
Taylor expanded in x around inf
Applied rewrites56.2%
(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 96.8%
Taylor expanded in x around inf
Applied rewrites53.9%
(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 2025095
(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))))