
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x + y) - (((z - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x + y) - (((z - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.75e+144)
(fma (/ (- z a) t) y x)
(if (<= t 5e+83)
(- x (- (* (/ y (- a t)) (- z t)) y))
(fma (- z a) (/ y t) x))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.75e+144) {
tmp = fma(((z - a) / t), y, x);
} else if (t <= 5e+83) {
tmp = x - (((y / (a - t)) * (z - t)) - y);
} else {
tmp = fma((z - a), (y / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.75e+144) tmp = fma(Float64(Float64(z - a) / t), y, x); elseif (t <= 5e+83) tmp = Float64(x - Float64(Float64(Float64(y / Float64(a - t)) * Float64(z - t)) - y)); else tmp = fma(Float64(z - a), Float64(y / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.75e+144], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t, 5e+83], N[(x - N[(N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(z - a), $MachinePrecision] * N[(y / t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -2.75 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - a}{t}, y, x\right)\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+83}:\\
\;\;\;\;x - \left(\frac{y}{a - t} \cdot \left(z - t\right) - y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - a, \frac{y}{t}, x\right)\\
\end{array}
if t < -2.7500000000000001e144Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f6460.8%
Applied rewrites60.8%
if -2.7500000000000001e144 < t < 5.0000000000000003e83Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
if 5.0000000000000003e83 < t Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
mult-flip-revN/A
lower-/.f6461.8%
Applied rewrites61.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.75e+144)
(fma (/ (- z a) t) y x)
(if (<= t 2.7e-12)
(+ (fma (/ y (- a t)) (- t z) y) x)
(fma (- z a) (/ y t) x))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.75e+144) {
tmp = fma(((z - a) / t), y, x);
} else if (t <= 2.7e-12) {
tmp = fma((y / (a - t)), (t - z), y) + x;
} else {
tmp = fma((z - a), (y / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.75e+144) tmp = fma(Float64(Float64(z - a) / t), y, x); elseif (t <= 2.7e-12) tmp = Float64(fma(Float64(y / Float64(a - t)), Float64(t - z), y) + x); else tmp = fma(Float64(z - a), Float64(y / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.75e+144], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t, 2.7e-12], N[(N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision], N[(N[(z - a), $MachinePrecision] * N[(y / t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -2.75 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - a}{t}, y, x\right)\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a - t}, t - z, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - a, \frac{y}{t}, x\right)\\
\end{array}
if t < -2.7500000000000001e144Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f6460.8%
Applied rewrites60.8%
if -2.7500000000000001e144 < t < 2.6999999999999998e-12Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lower-+.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6482.6%
Applied rewrites82.6%
if 2.6999999999999998e-12 < t Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
mult-flip-revN/A
lower-/.f6461.8%
Applied rewrites61.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.75e+144)
(fma (/ (- z a) t) y x)
(if (<= t 2.7e-12)
(- (+ x y) (/ (* y z) (- a t)))
(fma (- z a) (/ y t) x))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.75e+144) {
tmp = fma(((z - a) / t), y, x);
} else if (t <= 2.7e-12) {
tmp = (x + y) - ((y * z) / (a - t));
} else {
tmp = fma((z - a), (y / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.75e+144) tmp = fma(Float64(Float64(z - a) / t), y, x); elseif (t <= 2.7e-12) tmp = Float64(Float64(x + y) - Float64(Float64(y * z) / Float64(a - t))); else tmp = fma(Float64(z - a), Float64(y / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.75e+144], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t, 2.7e-12], N[(N[(x + y), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - a), $MachinePrecision] * N[(y / t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -2.75 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - a}{t}, y, x\right)\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{-12}:\\
\;\;\;\;\left(x + y\right) - \frac{y \cdot z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - a, \frac{y}{t}, x\right)\\
\end{array}
if t < -2.7500000000000001e144Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f6460.8%
Applied rewrites60.8%
if -2.7500000000000001e144 < t < 2.6999999999999998e-12Initial program 76.5%
Taylor expanded in z around inf
lower-*.f6477.6%
Applied rewrites77.6%
if 2.6999999999999998e-12 < t Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
mult-flip-revN/A
lower-/.f6461.8%
Applied rewrites61.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -3.6e-6)
(fma (/ (- z a) t) y x)
(if (<= t 2.7e-12)
(- (+ x y) (* z (/ y a)))
(fma (- z a) (/ y t) x))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.6e-6) {
tmp = fma(((z - a) / t), y, x);
} else if (t <= 2.7e-12) {
tmp = (x + y) - (z * (y / a));
} else {
tmp = fma((z - a), (y / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.6e-6) tmp = fma(Float64(Float64(z - a) / t), y, x); elseif (t <= 2.7e-12) tmp = Float64(Float64(x + y) - Float64(z * Float64(y / a))); else tmp = fma(Float64(z - a), Float64(y / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.6e-6], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t, 2.7e-12], N[(N[(x + y), $MachinePrecision] - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - a), $MachinePrecision] * N[(y / t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - a}{t}, y, x\right)\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{-12}:\\
\;\;\;\;\left(x + y\right) - z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - a, \frac{y}{t}, x\right)\\
\end{array}
if t < -3.5999999999999998e-6Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f6460.8%
Applied rewrites60.8%
if -3.5999999999999998e-6 < t < 2.6999999999999998e-12Initial program 76.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6464.4%
Applied rewrites64.4%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6466.3%
Applied rewrites66.3%
if 2.6999999999999998e-12 < t Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
mult-flip-revN/A
lower-/.f6461.8%
Applied rewrites61.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (- y))))
(if (<= a -2.3e-15)
t_1
(if (<= a 9.8e+88) (fma (- z a) (/ y t) x) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = x - -y;
double tmp;
if (a <= -2.3e-15) {
tmp = t_1;
} else if (a <= 9.8e+88) {
tmp = fma((z - a), (y / t), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(-y)) tmp = 0.0 if (a <= -2.3e-15) tmp = t_1; elseif (a <= 9.8e+88) tmp = fma(Float64(z - a), Float64(y / t), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - (-y)), $MachinePrecision]}, If[LessEqual[a, -2.3e-15], t$95$1, If[LessEqual[a, 9.8e+88], N[(N[(z - a), $MachinePrecision] * N[(y / t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x - \left(-y\right)\\
\mathbf{if}\;a \leq -2.3 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 9.8 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(z - a, \frac{y}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if a < -2.2999999999999999e-15 or 9.8000000000000005e88 < a Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
Taylor expanded in a around inf
lower-*.f6459.4%
Applied rewrites59.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6459.4%
Applied rewrites59.4%
if -2.2999999999999999e-15 < a < 9.8000000000000005e88Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
mult-flip-revN/A
lower-/.f6461.8%
Applied rewrites61.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (- y))))
(if (<= a -740000.0)
t_1
(if (<= a 9.8e+88) (fma (/ (- z a) t) y x) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = x - -y;
double tmp;
if (a <= -740000.0) {
tmp = t_1;
} else if (a <= 9.8e+88) {
tmp = fma(((z - a) / t), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(-y)) tmp = 0.0 if (a <= -740000.0) tmp = t_1; elseif (a <= 9.8e+88) tmp = fma(Float64(Float64(z - a) / t), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - (-y)), $MachinePrecision]}, If[LessEqual[a, -740000.0], t$95$1, If[LessEqual[a, 9.8e+88], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x - \left(-y\right)\\
\mathbf{if}\;a \leq -740000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 9.8 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - a}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if a < -7.4e5 or 9.8000000000000005e88 < a Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
Taylor expanded in a around inf
lower-*.f6459.4%
Applied rewrites59.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6459.4%
Applied rewrites59.4%
if -7.4e5 < a < 9.8000000000000005e88Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f6460.8%
Applied rewrites60.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (- y))))
(if (<= a -16000000.0)
t_1
(if (<= a 3.8e+94) (+ x (/ (* y z) t)) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = x - -y;
double tmp;
if (a <= -16000000.0) {
tmp = t_1;
} else if (a <= 3.8e+94) {
tmp = x + ((y * z) / 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 - -y
if (a <= (-16000000.0d0)) then
tmp = t_1
else if (a <= 3.8d+94) then
tmp = x + ((y * z) / 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 - -y;
double tmp;
if (a <= -16000000.0) {
tmp = t_1;
} else if (a <= 3.8e+94) {
tmp = x + ((y * z) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - -y tmp = 0 if a <= -16000000.0: tmp = t_1 elif a <= 3.8e+94: tmp = x + ((y * z) / t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(-y)) tmp = 0.0 if (a <= -16000000.0) tmp = t_1; elseif (a <= 3.8e+94) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - -y; tmp = 0.0; if (a <= -16000000.0) tmp = t_1; elseif (a <= 3.8e+94) tmp = x + ((y * z) / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - (-y)), $MachinePrecision]}, If[LessEqual[a, -16000000.0], t$95$1, If[LessEqual[a, 3.8e+94], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x - \left(-y\right)\\
\mathbf{if}\;a \leq -16000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.8 \cdot 10^{+94}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if a < -1.6e7 or 3.7999999999999996e94 < a Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
Taylor expanded in a around inf
lower-*.f6459.4%
Applied rewrites59.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6459.4%
Applied rewrites59.4%
if -1.6e7 < a < 3.7999999999999996e94Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f6460.6%
Applied rewrites60.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ y (- t a))))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t))))
(t_3 (- x (- y))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -2e-293)
t_3
(if (<= t_2 0.0)
(/ (* (- z a) y) t)
(if (<= t_2 2e+306) t_3 t_1))))))double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / (t - a));
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double t_3 = x - -y;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -2e-293) {
tmp = t_3;
} else if (t_2 <= 0.0) {
tmp = ((z - a) * y) / t;
} else if (t_2 <= 2e+306) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / (t - a));
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double t_3 = x - -y;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -2e-293) {
tmp = t_3;
} else if (t_2 <= 0.0) {
tmp = ((z - a) * y) / t;
} else if (t_2 <= 2e+306) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (y / (t - a)) t_2 = (x + y) - (((z - t) * y) / (a - t)) t_3 = x - -y tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -2e-293: tmp = t_3 elif t_2 <= 0.0: tmp = ((z - a) * y) / t elif t_2 <= 2e+306: tmp = t_3 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(y / Float64(t - a))) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) t_3 = Float64(x - Float64(-y)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -2e-293) tmp = t_3; elseif (t_2 <= 0.0) tmp = Float64(Float64(Float64(z - a) * y) / t); elseif (t_2 <= 2e+306) tmp = t_3; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (y / (t - a)); t_2 = (x + y) - (((z - t) * y) / (a - t)); t_3 = x - -y; tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -2e-293) tmp = t_3; elseif (t_2 <= 0.0) tmp = ((z - a) * y) / t; elseif (t_2 <= 2e+306) tmp = t_3; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x - (-y)), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -2e-293], t$95$3, If[LessEqual[t$95$2, 0.0], N[(N[(N[(z - a), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t$95$2, 2e+306], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
t_1 := z \cdot \frac{y}{t - a}\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
t_3 := x - \left(-y\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-293}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{\left(z - a\right) \cdot y}{t}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0 or 2e306 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
lift--.f64N/A
sub-flipN/A
lift--.f64N/A
sub-negate-revN/A
associate--l+N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-frac-neg2N/A
lift-/.f64N/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
lower-fma.f6482.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6482.6%
Applied rewrites82.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.8%
Applied rewrites26.8%
+-commutative26.8%
+-commutative26.8%
lift-+.f64N/A
fp-cancel-sign-sub-invN/A
lift--.f64N/A
distribute-frac-neg2N/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
associate-/l*N/A
lift-+.f6426.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift--.f64N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f6429.0%
Applied rewrites29.0%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -2.0000000000000001e-293 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 2e306Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
Taylor expanded in a around inf
lower-*.f6459.4%
Applied rewrites59.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6459.4%
Applied rewrites59.4%
if -2.0000000000000001e-293 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6425.1%
Applied rewrites25.1%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
associate-*r/N/A
sub-negate-revN/A
distribute-rgt-neg-inN/A
lower-/.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f6422.8%
Applied rewrites22.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ z (- t a)) y))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t))))
(t_3 (- x (- y))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -2e-293)
t_3
(if (<= t_2 0.0)
(/ (* (- z a) y) t)
(if (<= t_2 2e+306) t_3 t_1))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z / (t - a)) * y;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double t_3 = x - -y;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -2e-293) {
tmp = t_3;
} else if (t_2 <= 0.0) {
tmp = ((z - a) * y) / t;
} else if (t_2 <= 2e+306) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z / (t - a)) * y;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double t_3 = x - -y;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -2e-293) {
tmp = t_3;
} else if (t_2 <= 0.0) {
tmp = ((z - a) * y) / t;
} else if (t_2 <= 2e+306) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z / (t - a)) * y t_2 = (x + y) - (((z - t) * y) / (a - t)) t_3 = x - -y tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -2e-293: tmp = t_3 elif t_2 <= 0.0: tmp = ((z - a) * y) / t elif t_2 <= 2e+306: tmp = t_3 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z / Float64(t - a)) * y) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) t_3 = Float64(x - Float64(-y)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -2e-293) tmp = t_3; elseif (t_2 <= 0.0) tmp = Float64(Float64(Float64(z - a) * y) / t); elseif (t_2 <= 2e+306) tmp = t_3; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z / (t - a)) * y; t_2 = (x + y) - (((z - t) * y) / (a - t)); t_3 = x - -y; tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -2e-293) tmp = t_3; elseif (t_2 <= 0.0) tmp = ((z - a) * y) / t; elseif (t_2 <= 2e+306) tmp = t_3; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x - (-y)), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -2e-293], t$95$3, If[LessEqual[t$95$2, 0.0], N[(N[(N[(z - a), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t$95$2, 2e+306], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
t_1 := \frac{z}{t - a} \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
t_3 := x - \left(-y\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-293}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{\left(z - a\right) \cdot y}{t}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0 or 2e306 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
lift--.f64N/A
sub-flipN/A
lift--.f64N/A
sub-negate-revN/A
associate--l+N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-frac-neg2N/A
lift-/.f64N/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
lower-fma.f6482.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6482.6%
Applied rewrites82.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.8%
Applied rewrites26.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.9%
Applied rewrites28.9%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -2.0000000000000001e-293 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 2e306Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
Taylor expanded in a around inf
lower-*.f6459.4%
Applied rewrites59.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6459.4%
Applied rewrites59.4%
if -2.0000000000000001e-293 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6425.1%
Applied rewrites25.1%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
associate-*r/N/A
sub-negate-revN/A
distribute-rgt-neg-inN/A
lower-/.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f6422.8%
Applied rewrites22.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ z (- t a)) y))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t))))
(t_3 (- x (- y))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -2e-293)
t_3
(if (<= t_2 0.0)
(* (/ (- z a) t) y)
(if (<= t_2 2e+306) t_3 t_1))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z / (t - a)) * y;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double t_3 = x - -y;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -2e-293) {
tmp = t_3;
} else if (t_2 <= 0.0) {
tmp = ((z - a) / t) * y;
} else if (t_2 <= 2e+306) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z / (t - a)) * y;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double t_3 = x - -y;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -2e-293) {
tmp = t_3;
} else if (t_2 <= 0.0) {
tmp = ((z - a) / t) * y;
} else if (t_2 <= 2e+306) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z / (t - a)) * y t_2 = (x + y) - (((z - t) * y) / (a - t)) t_3 = x - -y tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -2e-293: tmp = t_3 elif t_2 <= 0.0: tmp = ((z - a) / t) * y elif t_2 <= 2e+306: tmp = t_3 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z / Float64(t - a)) * y) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) t_3 = Float64(x - Float64(-y)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -2e-293) tmp = t_3; elseif (t_2 <= 0.0) tmp = Float64(Float64(Float64(z - a) / t) * y); elseif (t_2 <= 2e+306) tmp = t_3; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z / (t - a)) * y; t_2 = (x + y) - (((z - t) * y) / (a - t)); t_3 = x - -y; tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -2e-293) tmp = t_3; elseif (t_2 <= 0.0) tmp = ((z - a) / t) * y; elseif (t_2 <= 2e+306) tmp = t_3; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x - (-y)), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -2e-293], t$95$3, If[LessEqual[t$95$2, 0.0], N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$2, 2e+306], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
t_1 := \frac{z}{t - a} \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
t_3 := x - \left(-y\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-293}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{z - a}{t} \cdot y\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0 or 2e306 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
lift--.f64N/A
sub-flipN/A
lift--.f64N/A
sub-negate-revN/A
associate--l+N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-frac-neg2N/A
lift-/.f64N/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
lower-fma.f6482.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6482.6%
Applied rewrites82.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.8%
Applied rewrites26.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.9%
Applied rewrites28.9%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -2.0000000000000001e-293 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 2e306Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
Taylor expanded in a around inf
lower-*.f6459.4%
Applied rewrites59.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6459.4%
Applied rewrites59.4%
if -2.0000000000000001e-293 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 76.5%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6458.4%
Applied rewrites58.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6458.4%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6458.6%
Applied rewrites58.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6425.1%
Applied rewrites25.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6425.1%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.3%
Applied rewrites25.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ z (- t a)) y))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t))))
(t_3 (- x (- y))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -2e-195)
t_3
(if (<= t_2 2e-199) (* 1.0 x) (if (<= t_2 2e+306) t_3 t_1))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z / (t - a)) * y;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double t_3 = x - -y;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -2e-195) {
tmp = t_3;
} else if (t_2 <= 2e-199) {
tmp = 1.0 * x;
} else if (t_2 <= 2e+306) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z / (t - a)) * y;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double t_3 = x - -y;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -2e-195) {
tmp = t_3;
} else if (t_2 <= 2e-199) {
tmp = 1.0 * x;
} else if (t_2 <= 2e+306) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z / (t - a)) * y t_2 = (x + y) - (((z - t) * y) / (a - t)) t_3 = x - -y tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -2e-195: tmp = t_3 elif t_2 <= 2e-199: tmp = 1.0 * x elif t_2 <= 2e+306: tmp = t_3 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z / Float64(t - a)) * y) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) t_3 = Float64(x - Float64(-y)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -2e-195) tmp = t_3; elseif (t_2 <= 2e-199) tmp = Float64(1.0 * x); elseif (t_2 <= 2e+306) tmp = t_3; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z / (t - a)) * y; t_2 = (x + y) - (((z - t) * y) / (a - t)); t_3 = x - -y; tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -2e-195) tmp = t_3; elseif (t_2 <= 2e-199) tmp = 1.0 * x; elseif (t_2 <= 2e+306) tmp = t_3; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x - (-y)), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -2e-195], t$95$3, If[LessEqual[t$95$2, 2e-199], N[(1.0 * x), $MachinePrecision], If[LessEqual[t$95$2, 2e+306], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
t_1 := \frac{z}{t - a} \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
t_3 := x - \left(-y\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-195}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-199}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+306}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0 or 2e306 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
lift--.f64N/A
sub-flipN/A
lift--.f64N/A
sub-negate-revN/A
associate--l+N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-frac-neg2N/A
lift-/.f64N/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
lower-fma.f6482.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6482.6%
Applied rewrites82.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.8%
Applied rewrites26.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.9%
Applied rewrites28.9%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -2.0000000000000002e-195 or 2e-199 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 2e306Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
Taylor expanded in a around inf
lower-*.f6459.4%
Applied rewrites59.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6459.4%
Applied rewrites59.4%
if -2.0000000000000002e-195 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 2e-199Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
Taylor expanded in a around inf
lower-*.f6459.4%
Applied rewrites59.4%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-/.f6456.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6456.8%
Applied rewrites56.8%
Taylor expanded in x around inf
Applied rewrites50.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- x (- y)))) (if (<= a -3.5e-73) t_1 (if (<= a 2e+92) (* 1.0 x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - -y;
double tmp;
if (a <= -3.5e-73) {
tmp = t_1;
} else if (a <= 2e+92) {
tmp = 1.0 * x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x - -y
if (a <= (-3.5d-73)) then
tmp = t_1
else if (a <= 2d+92) then
tmp = 1.0d0 * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - -y;
double tmp;
if (a <= -3.5e-73) {
tmp = t_1;
} else if (a <= 2e+92) {
tmp = 1.0 * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - -y tmp = 0 if a <= -3.5e-73: tmp = t_1 elif a <= 2e+92: tmp = 1.0 * x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(-y)) tmp = 0.0 if (a <= -3.5e-73) tmp = t_1; elseif (a <= 2e+92) tmp = Float64(1.0 * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - -y; tmp = 0.0; if (a <= -3.5e-73) tmp = t_1; elseif (a <= 2e+92) tmp = 1.0 * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - (-y)), $MachinePrecision]}, If[LessEqual[a, -3.5e-73], t$95$1, If[LessEqual[a, 2e+92], N[(1.0 * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x - \left(-y\right)\\
\mathbf{if}\;a \leq -3.5 \cdot 10^{-73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2 \cdot 10^{+92}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if a < -3.4999999999999998e-73 or 2.0000000000000001e92 < a Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
Taylor expanded in a around inf
lower-*.f6459.4%
Applied rewrites59.4%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6459.4%
Applied rewrites59.4%
if -3.4999999999999998e-73 < a < 2.0000000000000001e92Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
Taylor expanded in a around inf
lower-*.f6459.4%
Applied rewrites59.4%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-/.f6456.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6456.8%
Applied rewrites56.8%
Taylor expanded in x around inf
Applied rewrites50.7%
(FPCore (x y z t a) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t, double a) {
return 1.0 * 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 = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t, double a) {
return 1.0 * x;
}
def code(x, y, z, t, a): return 1.0 * x
function code(x, y, z, t, a) return Float64(1.0 * x) end
function tmp = code(x, y, z, t, a) tmp = 1.0 * x; end
code[x_, y_, z_, t_, a_] := N[(1.0 * x), $MachinePrecision]
1 \cdot x
Initial program 76.5%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6479.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.7%
Applied rewrites86.7%
Taylor expanded in a around inf
lower-*.f6459.4%
Applied rewrites59.4%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-/.f6456.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6456.8%
Applied rewrites56.8%
Taylor expanded in x around inf
Applied rewrites50.7%
herbie shell --seed 2025212
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
(- (+ x y) (/ (* (- z t) y) (- a t))))