
(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]
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
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]
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
(FPCore (x y z t a) :precision binary64 (fma (/ (- z y) (- (- t z) -1.0)) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / ((t - z) - -1.0)), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(Float64(t - z) - -1.0)), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\mathsf{fma}\left(\frac{z - y}{\left(t - z\right) - -1}, a, x\right)
Initial program 97.0%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
frac-2neg-revN/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.6%
Applied rewrites99.6%
(FPCore (x y z t a)
:precision binary64
(if (<= t -5e-6)
(fma (/ (- z y) (- t -1.0)) a x)
(if (<= t 5e+65)
(fma (/ (- z y) (- 1.0 z)) a x)
(- x (* (/ (- y z) t) a)))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5e-6) {
tmp = fma(((z - y) / (t - -1.0)), a, x);
} else if (t <= 5e+65) {
tmp = fma(((z - y) / (1.0 - z)), a, x);
} else {
tmp = x - (((y - z) / t) * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5e-6) tmp = fma(Float64(Float64(z - y) / Float64(t - -1.0)), a, x); elseif (t <= 5e+65) tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); else tmp = Float64(x - Float64(Float64(Float64(y - z) / t) * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5e-6], N[(N[(N[(z - y), $MachinePrecision] / N[(t - -1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[t, 5e+65], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{t - -1}, a, x\right)\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+65}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y - z}{t} \cdot a\\
\end{array}
if t < -5.0000000000000004e-6Initial program 97.0%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
frac-2neg-revN/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.6%
Applied rewrites99.6%
Taylor expanded in z around 0
Applied rewrites74.2%
if -5.0000000000000004e-6 < t < 4.9999999999999997e65Initial program 97.0%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
frac-2neg-revN/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.6%
Applied rewrites99.6%
Taylor expanded in t around 0
lower--.f6479.9%
Applied rewrites79.9%
if 4.9999999999999997e65 < t Initial program 97.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6450.4%
Applied rewrites50.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.6%
Applied rewrites53.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* (/ (- y z) t) a))))
(if (<= t -2.6e+18)
t_1
(if (<= t 5e+65) (fma (/ (- z y) (- 1.0 z)) a x) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = x - (((y - z) / t) * a);
double tmp;
if (t <= -2.6e+18) {
tmp = t_1;
} else if (t <= 5e+65) {
tmp = fma(((z - y) / (1.0 - z)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(Float64(y - z) / t) * a)) tmp = 0.0 if (t <= -2.6e+18) tmp = t_1; elseif (t <= 5e+65) tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.6e+18], t$95$1, If[LessEqual[t, 5e+65], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x - \frac{y - z}{t} \cdot a\\
\mathbf{if}\;t \leq -2.6 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+65}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -2.6e18 or 4.9999999999999997e65 < t Initial program 97.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6450.4%
Applied rewrites50.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.6%
Applied rewrites53.6%
if -2.6e18 < t < 4.9999999999999997e65Initial program 97.0%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
frac-2neg-revN/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.6%
Applied rewrites99.6%
Taylor expanded in t around 0
lower--.f6479.9%
Applied rewrites79.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* (/ (- y z) t) a))))
(if (<= t -2.6e+18)
t_1
(if (<= t 5e+65) (fma (- z y) (/ a (- 1.0 z)) x) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = x - (((y - z) / t) * a);
double tmp;
if (t <= -2.6e+18) {
tmp = t_1;
} else if (t <= 5e+65) {
tmp = fma((z - y), (a / (1.0 - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(Float64(y - z) / t) * a)) tmp = 0.0 if (t <= -2.6e+18) tmp = t_1; elseif (t <= 5e+65) tmp = fma(Float64(z - y), Float64(a / Float64(1.0 - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.6e+18], t$95$1, If[LessEqual[t, 5e+65], N[(N[(z - y), $MachinePrecision] * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x - \frac{y - z}{t} \cdot a\\
\mathbf{if}\;t \leq -2.6 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+65}:\\
\;\;\;\;\mathsf{fma}\left(z - y, \frac{a}{1 - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -2.6e18 or 4.9999999999999997e65 < t Initial program 97.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6450.4%
Applied rewrites50.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.6%
Applied rewrites53.6%
if -2.6e18 < t < 4.9999999999999997e65Initial program 97.0%
Taylor expanded in t around 0
lower--.f6478.0%
Applied rewrites78.0%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
div-flip-revN/A
lower-/.f6478.2%
Applied rewrites78.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* (/ (- y z) t) a))))
(if (<= t -2.6e+18)
t_1
(if (<= t 3.1e+18) (- x (* y (/ a (- 1.0 z)))) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = x - (((y - z) / t) * a);
double tmp;
if (t <= -2.6e+18) {
tmp = t_1;
} else if (t <= 3.1e+18) {
tmp = x - (y * (a / (1.0 - 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) * a)
if (t <= (-2.6d+18)) then
tmp = t_1
else if (t <= 3.1d+18) then
tmp = x - (y * (a / (1.0d0 - 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) * a);
double tmp;
if (t <= -2.6e+18) {
tmp = t_1;
} else if (t <= 3.1e+18) {
tmp = x - (y * (a / (1.0 - z)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (((y - z) / t) * a) tmp = 0 if t <= -2.6e+18: tmp = t_1 elif t <= 3.1e+18: tmp = x - (y * (a / (1.0 - z))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(Float64(y - z) / t) * a)) tmp = 0.0 if (t <= -2.6e+18) tmp = t_1; elseif (t <= 3.1e+18) tmp = Float64(x - Float64(y * Float64(a / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (((y - z) / t) * a); tmp = 0.0; if (t <= -2.6e+18) tmp = t_1; elseif (t <= 3.1e+18) tmp = x - (y * (a / (1.0 - z))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.6e+18], t$95$1, If[LessEqual[t, 3.1e+18], N[(x - N[(y * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x - \frac{y - z}{t} \cdot a\\
\mathbf{if}\;t \leq -2.6 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+18}:\\
\;\;\;\;x - y \cdot \frac{a}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -2.6e18 or 3.1e18 < t Initial program 97.0%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6450.4%
Applied rewrites50.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6453.6%
Applied rewrites53.6%
if -2.6e18 < t < 3.1e18Initial program 97.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6474.9%
Applied rewrites74.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6464.1%
Applied rewrites64.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.3%
Applied rewrites65.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= t -2.6e+18)
t_1
(if (<= t 3.1e+18) (- x (* y (/ a (- 1.0 z)))) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / t), a, x);
double tmp;
if (t <= -2.6e+18) {
tmp = t_1;
} else if (t <= 3.1e+18) {
tmp = x - (y * (a / (1.0 - z)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / t), a, x) tmp = 0.0 if (t <= -2.6e+18) tmp = t_1; elseif (t <= 3.1e+18) tmp = Float64(x - Float64(y * Float64(a / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[t, -2.6e+18], t$95$1, If[LessEqual[t, 3.1e+18], N[(x - N[(y * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{if}\;t \leq -2.6 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+18}:\\
\;\;\;\;x - y \cdot \frac{a}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -2.6e18 or 3.1e18 < t Initial program 97.0%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
frac-2neg-revN/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.6%
Applied rewrites99.6%
Taylor expanded in t around 0
lower--.f6479.9%
Applied rewrites79.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6453.6%
Applied rewrites53.6%
if -2.6e18 < t < 3.1e18Initial program 97.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6474.9%
Applied rewrites74.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6464.1%
Applied rewrites64.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.3%
Applied rewrites65.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) t) a x)))
(if (<= t -2200.0)
t_1
(if (<= t 2.1e-146)
(- x a)
(if (<= t 3.1e+18) (- x (* y a)) t_1)))))double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / t), a, x);
double tmp;
if (t <= -2200.0) {
tmp = t_1;
} else if (t <= 2.1e-146) {
tmp = x - a;
} else if (t <= 3.1e+18) {
tmp = x - (y * a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / t), a, x) tmp = 0.0 if (t <= -2200.0) tmp = t_1; elseif (t <= 2.1e-146) tmp = Float64(x - a); elseif (t <= 3.1e+18) 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[(N[(z - y), $MachinePrecision] / t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[t, -2200.0], t$95$1, If[LessEqual[t, 2.1e-146], N[(x - a), $MachinePrecision], If[LessEqual[t, 3.1e+18], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{t}, a, x\right)\\
\mathbf{if}\;t \leq -2200:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{-146}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+18}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -2200 or 3.1e18 < t Initial program 97.0%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
frac-2neg-revN/A
remove-double-negN/A
lift-/.f64N/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.6%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.6%
Applied rewrites99.6%
Taylor expanded in t around 0
lower--.f6479.9%
Applied rewrites79.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6453.6%
Applied rewrites53.6%
if -2200 < t < 2.0999999999999999e-146Initial program 97.0%
Taylor expanded in z around inf
Applied rewrites59.8%
if 2.0999999999999999e-146 < t < 3.1e18Initial program 97.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6474.9%
Applied rewrites74.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6464.1%
Applied rewrites64.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.3%
Applied rewrites65.3%
Taylor expanded in z around 0
Applied rewrites58.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -440.0)
(- x a)
(if (<= z 1.55e-12)
(- x (* y (+ a (* a z))))
(if (<= z 1.1e+113) (- x (* (- a) (/ y z))) (- x a)))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -440.0) {
tmp = x - a;
} else if (z <= 1.55e-12) {
tmp = x - (y * (a + (a * z)));
} else if (z <= 1.1e+113) {
tmp = x - (-a * (y / z));
} 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 <= (-440.0d0)) then
tmp = x - a
else if (z <= 1.55d-12) then
tmp = x - (y * (a + (a * z)))
else if (z <= 1.1d+113) then
tmp = x - (-a * (y / z))
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 <= -440.0) {
tmp = x - a;
} else if (z <= 1.55e-12) {
tmp = x - (y * (a + (a * z)));
} else if (z <= 1.1e+113) {
tmp = x - (-a * (y / z));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -440.0: tmp = x - a elif z <= 1.55e-12: tmp = x - (y * (a + (a * z))) elif z <= 1.1e+113: tmp = x - (-a * (y / z)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -440.0) tmp = Float64(x - a); elseif (z <= 1.55e-12) tmp = Float64(x - Float64(y * Float64(a + Float64(a * z)))); elseif (z <= 1.1e+113) tmp = Float64(x - Float64(Float64(-a) * Float64(y / z))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -440.0) tmp = x - a; elseif (z <= 1.55e-12) tmp = x - (y * (a + (a * z))); elseif (z <= 1.1e+113) tmp = x - (-a * (y / z)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -440.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.55e-12], N[(x - N[(y * N[(a + N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1e+113], N[(x - N[((-a) * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -440:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-12}:\\
\;\;\;\;x - y \cdot \left(a + a \cdot z\right)\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+113}:\\
\;\;\;\;x - \left(-a\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
if z < -440 or 1.1000000000000001e113 < z Initial program 97.0%
Taylor expanded in z around inf
Applied rewrites59.8%
if -440 < z < 1.5500000000000001e-12Initial program 97.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6474.9%
Applied rewrites74.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6464.1%
Applied rewrites64.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.3%
Applied rewrites65.3%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6451.1%
Applied rewrites51.1%
if 1.5500000000000001e-12 < z < 1.1000000000000001e113Initial program 97.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6474.9%
Applied rewrites74.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6447.2%
Applied rewrites47.2%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6447.2%
Applied rewrites47.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -7.5e+17)
(- x a)
(if (<= z 1.55e-12)
(- x (* y a))
(if (<= z 1.1e+113) (- x (* (- a) (/ y z))) (- x a)))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.5e+17) {
tmp = x - a;
} else if (z <= 1.55e-12) {
tmp = x - (y * a);
} else if (z <= 1.1e+113) {
tmp = x - (-a * (y / z));
} 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 <= (-7.5d+17)) then
tmp = x - a
else if (z <= 1.55d-12) then
tmp = x - (y * a)
else if (z <= 1.1d+113) then
tmp = x - (-a * (y / z))
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 <= -7.5e+17) {
tmp = x - a;
} else if (z <= 1.55e-12) {
tmp = x - (y * a);
} else if (z <= 1.1e+113) {
tmp = x - (-a * (y / z));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.5e+17: tmp = x - a elif z <= 1.55e-12: tmp = x - (y * a) elif z <= 1.1e+113: tmp = x - (-a * (y / z)) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.5e+17) tmp = Float64(x - a); elseif (z <= 1.55e-12) tmp = Float64(x - Float64(y * a)); elseif (z <= 1.1e+113) tmp = Float64(x - Float64(Float64(-a) * Float64(y / z))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7.5e+17) tmp = x - a; elseif (z <= 1.55e-12) tmp = x - (y * a); elseif (z <= 1.1e+113) tmp = x - (-a * (y / z)); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.5e+17], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.55e-12], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1e+113], N[(x - N[((-a) * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+17}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-12}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+113}:\\
\;\;\;\;x - \left(-a\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
if z < -7.5e17 or 1.1000000000000001e113 < z Initial program 97.0%
Taylor expanded in z around inf
Applied rewrites59.8%
if -7.5e17 < z < 1.5500000000000001e-12Initial program 97.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6474.9%
Applied rewrites74.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6464.1%
Applied rewrites64.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.3%
Applied rewrites65.3%
Taylor expanded in z around 0
Applied rewrites58.0%
if 1.5500000000000001e-12 < z < 1.1000000000000001e113Initial program 97.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6474.9%
Applied rewrites74.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6447.2%
Applied rewrites47.2%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6447.2%
Applied rewrites47.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -7.5e+17) (- x a) (if (<= z 215000.0) (- x (* y a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.5e+17) {
tmp = x - a;
} else if (z <= 215000.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 <= (-7.5d+17)) then
tmp = x - a
else if (z <= 215000.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 <= -7.5e+17) {
tmp = x - a;
} else if (z <= 215000.0) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.5e+17: tmp = x - a elif z <= 215000.0: tmp = x - (y * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.5e+17) tmp = Float64(x - a); elseif (z <= 215000.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 <= -7.5e+17) tmp = x - a; elseif (z <= 215000.0) tmp = x - (y * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.5e+17], N[(x - a), $MachinePrecision], If[LessEqual[z, 215000.0], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+17}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 215000:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
if z < -7.5e17 or 215000 < z Initial program 97.0%
Taylor expanded in z around inf
Applied rewrites59.8%
if -7.5e17 < z < 215000Initial program 97.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6474.9%
Applied rewrites74.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6464.1%
Applied rewrites64.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6465.3%
Applied rewrites65.3%
Taylor expanded in z around 0
Applied rewrites58.0%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.9e+110) (* 1.0 x) (if (<= t 6.2e+159) (- x a) (* 1.0 x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.9e+110) {
tmp = 1.0 * x;
} else if (t <= 6.2e+159) {
tmp = x - a;
} else {
tmp = 1.0 * 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 (t <= (-2.9d+110)) then
tmp = 1.0d0 * x
else if (t <= 6.2d+159) then
tmp = x - a
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.9e+110) {
tmp = 1.0 * x;
} else if (t <= 6.2e+159) {
tmp = x - a;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.9e+110: tmp = 1.0 * x elif t <= 6.2e+159: tmp = x - a else: tmp = 1.0 * x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.9e+110) tmp = Float64(1.0 * x); elseif (t <= 6.2e+159) tmp = Float64(x - a); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.9e+110) tmp = 1.0 * x; elseif (t <= 6.2e+159) tmp = x - a; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.9e+110], N[(1.0 * x), $MachinePrecision], If[LessEqual[t, 6.2e+159], N[(x - a), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{+110}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{+159}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if t < -2.9e110 or 6.1999999999999996e159 < t Initial program 97.0%
Taylor expanded in z around inf
Applied rewrites59.8%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-/.f6457.8%
Applied rewrites57.8%
Taylor expanded in x around inf
Applied rewrites53.9%
if -2.9e110 < t < 6.1999999999999996e159Initial program 97.0%
Taylor expanded in z around inf
Applied rewrites59.8%
(FPCore (x y z t a) :precision binary64 (- x a))
double code(double x, double y, double z, double t, double a) {
return x - 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 - a
end function
public static double code(double x, double y, double z, double t, double a) {
return x - a;
}
def code(x, y, z, t, a): return x - a
function code(x, y, z, t, a) return Float64(x - a) end
function tmp = code(x, y, z, t, a) tmp = x - a; end
code[x_, y_, z_, t_, a_] := N[(x - a), $MachinePrecision]
x - a
Initial program 97.0%
Taylor expanded in z around inf
Applied rewrites59.8%
herbie shell --seed 2025212
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))