
(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]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
Herbie found 14 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]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma z (/ y (- t a)) (fma y (/ t (- a t)) (+ y x))))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (<= t_2 -5e-202) t_1 (if (<= t_2 5e-252) (fma y (/ (- z a) t) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(z, (y / (t - a)), fma(y, (t / (a - t)), (y + x)));
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 <= -5e-202) {
tmp = t_1;
} else if (t_2 <= 5e-252) {
tmp = fma(y, ((z - a) / t), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(z, Float64(y / Float64(t - a)), fma(y, Float64(t / Float64(a - t)), Float64(y + x))) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 <= -5e-202) tmp = t_1; elseif (t_2 <= 5e-252) tmp = fma(y, Float64(Float64(z - a) / t), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] + N[(y * N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision] + N[(y + x), $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]}, If[LessEqual[t$95$2, -5e-202], t$95$1, If[LessEqual[t$95$2, 5e-252], N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{y}{t - a}, \mathsf{fma}\left(y, \frac{t}{a - t}, y + x\right)\right)\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-202}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-252}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - a}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -4.99999999999999973e-202 or 5.00000000000000008e-252 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 77.6%
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
distribute-neg-outN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
div-addN/A
*-commutativeN/A
remove-double-negN/A
associate-+l+N/A
Applied rewrites87.5%
if -4.99999999999999973e-202 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 5.00000000000000008e-252Initial program 77.6%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6457.2
Applied rewrites57.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-2negN/A
mul-1-negN/A
remove-double-negN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
associate-/l*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites59.9%
(FPCore (x y z t a)
:precision binary64
(if (<= a -5.8e-118)
(- x (- (* (/ y (- t a)) (- t z)) y))
(if (<= a 3.7e-153)
(+ x (* -1.0 (/ (- (* a y) (* y z)) t)))
(fma (/ (- t z) (- a t)) y (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.8e-118) {
tmp = x - (((y / (t - a)) * (t - z)) - y);
} else if (a <= 3.7e-153) {
tmp = x + (-1.0 * (((a * y) - (y * z)) / t));
} else {
tmp = fma(((t - z) / (a - t)), y, (y + x));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.8e-118) tmp = Float64(x - Float64(Float64(Float64(y / Float64(t - a)) * Float64(t - z)) - y)); elseif (a <= 3.7e-153) tmp = Float64(x + Float64(-1.0 * Float64(Float64(Float64(a * y) - Float64(y * z)) / t))); else tmp = fma(Float64(Float64(t - z) / Float64(a - t)), y, Float64(y + x)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.8e-118], N[(x - N[(N[(N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.7e-153], N[(x + N[(-1.0 * N[(N[(N[(a * y), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t - z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{-118}:\\
\;\;\;\;x - \left(\frac{y}{t - a} \cdot \left(t - z\right) - y\right)\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{-153}:\\
\;\;\;\;x + -1 \cdot \frac{a \cdot y - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{a - t}, y, y + x\right)\\
\end{array}
\end{array}
if a < -5.79999999999999961e-118Initial program 77.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6480.7
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
lower-*.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6487.5
Applied rewrites87.5%
if -5.79999999999999961e-118 < a < 3.7000000000000003e-153Initial program 77.6%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6457.2
Applied rewrites57.2%
if 3.7000000000000003e-153 < a Initial program 77.6%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
div-subN/A
lift-/.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
Applied rewrites84.1%
(FPCore (x y z t a)
:precision binary64
(if (<= a -5.8e-118)
(- x (- (* (/ y (- t a)) (- t z)) y))
(if (<= a 3.7e-153)
(fma (/ 1.0 t) (* (- z a) y) x)
(fma (/ (- t z) (- a t)) y (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.8e-118) {
tmp = x - (((y / (t - a)) * (t - z)) - y);
} else if (a <= 3.7e-153) {
tmp = fma((1.0 / t), ((z - a) * y), x);
} else {
tmp = fma(((t - z) / (a - t)), y, (y + x));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.8e-118) tmp = Float64(x - Float64(Float64(Float64(y / Float64(t - a)) * Float64(t - z)) - y)); elseif (a <= 3.7e-153) tmp = fma(Float64(1.0 / t), Float64(Float64(z - a) * y), x); else tmp = fma(Float64(Float64(t - z) / Float64(a - t)), y, Float64(y + x)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.8e-118], N[(x - N[(N[(N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.7e-153], N[(N[(1.0 / t), $MachinePrecision] * N[(N[(z - a), $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(t - z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{-118}:\\
\;\;\;\;x - \left(\frac{y}{t - a} \cdot \left(t - z\right) - y\right)\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{-153}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{t}, \left(z - a\right) \cdot y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{a - t}, y, y + x\right)\\
\end{array}
\end{array}
if a < -5.79999999999999961e-118Initial program 77.6%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6480.7
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
lower-*.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6487.5
Applied rewrites87.5%
if -5.79999999999999961e-118 < a < 3.7000000000000003e-153Initial program 77.6%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6457.2
Applied rewrites57.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
mult-flipN/A
distribute-lft-neg-inN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6457.4
Applied rewrites57.4%
if 3.7000000000000003e-153 < a Initial program 77.6%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
div-subN/A
lift-/.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
Applied rewrites84.1%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.9e+22)
(+ (fma (/ y (- a t)) (- t z) y) x)
(if (<= a 3.1e-153)
(fma y (/ (- z a) t) x)
(fma (/ (- t z) (- a t)) y (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.9e+22) {
tmp = fma((y / (a - t)), (t - z), y) + x;
} else if (a <= 3.1e-153) {
tmp = fma(y, ((z - a) / t), x);
} else {
tmp = fma(((t - z) / (a - t)), y, (y + x));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.9e+22) tmp = Float64(fma(Float64(y / Float64(a - t)), Float64(t - z), y) + x); elseif (a <= 3.1e-153) tmp = fma(y, Float64(Float64(z - a) / t), x); else tmp = fma(Float64(Float64(t - z) / Float64(a - t)), y, Float64(y + x)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.9e+22], N[(N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 3.1e-153], N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(t - z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a - t}, t - z, y\right) + x\\
\mathbf{elif}\;a \leq 3.1 \cdot 10^{-153}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - a}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{a - t}, y, y + x\right)\\
\end{array}
\end{array}
if a < -1.9000000000000002e22Initial program 77.6%
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--.f6483.4
Applied rewrites83.4%
if -1.9000000000000002e22 < a < 3.09999999999999995e-153Initial program 77.6%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6457.2
Applied rewrites57.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-2negN/A
mul-1-negN/A
remove-double-negN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
associate-/l*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites59.9%
if 3.09999999999999995e-153 < a Initial program 77.6%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
div-subN/A
lift-/.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-neg-fracN/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
Applied rewrites84.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ (fma (/ y (- a t)) (- t z) y) x))) (if (<= a -1.9e+22) t_1 (if (<= a 3.1e-153) (fma y (/ (- z a) t) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / (a - t)), (t - z), y) + x;
double tmp;
if (a <= -1.9e+22) {
tmp = t_1;
} else if (a <= 3.1e-153) {
tmp = fma(y, ((z - a) / t), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(fma(Float64(y / Float64(a - t)), Float64(t - z), y) + x) tmp = 0.0 if (a <= -1.9e+22) tmp = t_1; elseif (a <= 3.1e-153) tmp = fma(y, Float64(Float64(z - a) / t), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.9e+22], t$95$1, If[LessEqual[a, 3.1e-153], N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a - t}, t - z, y\right) + x\\
\mathbf{if}\;a \leq -1.9 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.1 \cdot 10^{-153}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - a}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.9000000000000002e22 or 3.09999999999999995e-153 < a Initial program 77.6%
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--.f6483.4
Applied rewrites83.4%
if -1.9000000000000002e22 < a < 3.09999999999999995e-153Initial program 77.6%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6457.2
Applied rewrites57.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-2negN/A
mul-1-negN/A
remove-double-negN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
associate-/l*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites59.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- y (- (* (/ z a) y) x)))) (if (<= a -3.15e+22) t_1 (if (<= a 5.5e-50) (fma y (/ (- z a) t) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y - (((z / a) * y) - x);
double tmp;
if (a <= -3.15e+22) {
tmp = t_1;
} else if (a <= 5.5e-50) {
tmp = fma(y, ((z - a) / t), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y - Float64(Float64(Float64(z / a) * y) - x)) tmp = 0.0 if (a <= -3.15e+22) tmp = t_1; elseif (a <= 5.5e-50) tmp = fma(y, Float64(Float64(z - a) / t), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y - N[(N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.15e+22], t$95$1, If[LessEqual[a, 5.5e-50], N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - \left(\frac{z}{a} \cdot y - x\right)\\
\mathbf{if}\;a \leq -3.15 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 5.5 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - a}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.1500000000000001e22 or 5.49999999999999975e-50 < a Initial program 77.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6465.8
Applied rewrites65.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6467.6
Applied rewrites67.6%
if -3.1500000000000001e22 < a < 5.49999999999999975e-50Initial program 77.6%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6457.2
Applied rewrites57.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-2negN/A
mul-1-negN/A
remove-double-negN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
associate-/l*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites59.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- y (* -1.0 x)))) (if (<= a -1.66e+25) t_1 (if (<= a 4.05e-47) (fma y (/ (- z a) t) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y - (-1.0 * x);
double tmp;
if (a <= -1.66e+25) {
tmp = t_1;
} else if (a <= 4.05e-47) {
tmp = fma(y, ((z - a) / t), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y - Float64(-1.0 * x)) tmp = 0.0 if (a <= -1.66e+25) tmp = t_1; elseif (a <= 4.05e-47) tmp = fma(y, Float64(Float64(z - a) / t), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y - N[(-1.0 * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.66e+25], t$95$1, If[LessEqual[a, 4.05e-47], N[(y * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - -1 \cdot x\\
\mathbf{if}\;a \leq -1.66 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4.05 \cdot 10^{-47}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - a}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.6600000000000001e25 or 4.0500000000000002e-47 < a Initial program 77.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6465.8
Applied rewrites65.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6467.6
Applied rewrites67.6%
Taylor expanded in x around inf
lower-*.f6460.9
Applied rewrites60.9%
if -1.6600000000000001e25 < a < 4.0500000000000002e-47Initial program 77.6%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6457.2
Applied rewrites57.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-2negN/A
mul-1-negN/A
remove-double-negN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
associate-/l*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites59.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- y (* -1.0 x)))) (if (<= a -9e+22) t_1 (if (<= a 3.7e-47) (+ x (/ (* y z) t)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y - (-1.0 * x);
double tmp;
if (a <= -9e+22) {
tmp = t_1;
} else if (a <= 3.7e-47) {
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 = y - ((-1.0d0) * x)
if (a <= (-9d+22)) then
tmp = t_1
else if (a <= 3.7d-47) 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 = y - (-1.0 * x);
double tmp;
if (a <= -9e+22) {
tmp = t_1;
} else if (a <= 3.7e-47) {
tmp = x + ((y * z) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y - (-1.0 * x) tmp = 0 if a <= -9e+22: tmp = t_1 elif a <= 3.7e-47: tmp = x + ((y * z) / t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y - Float64(-1.0 * x)) tmp = 0.0 if (a <= -9e+22) tmp = t_1; elseif (a <= 3.7e-47) 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 = y - (-1.0 * x); tmp = 0.0; if (a <= -9e+22) tmp = t_1; elseif (a <= 3.7e-47) 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[(y - N[(-1.0 * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -9e+22], t$95$1, If[LessEqual[a, 3.7e-47], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - -1 \cdot x\\
\mathbf{if}\;a \leq -9 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{-47}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -8.9999999999999996e22 or 3.7e-47 < a Initial program 77.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6465.8
Applied rewrites65.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6467.6
Applied rewrites67.6%
Taylor expanded in x around inf
lower-*.f6460.9
Applied rewrites60.9%
if -8.9999999999999996e22 < a < 3.7e-47Initial program 77.6%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6457.2
Applied rewrites57.2%
Taylor expanded in a around 0
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6460.5
Applied rewrites60.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y (- t a)) z))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t))))
(t_3 (- y (* -1.0 x))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e-146)
t_3
(if (<= t_2 5e-252)
(+ x (+ y (* -1.0 y)))
(if (<= t_2 2e+270) t_3 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (t - a)) * z;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double t_3 = y - (-1.0 * x);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -1e-146) {
tmp = t_3;
} else if (t_2 <= 5e-252) {
tmp = x + (y + (-1.0 * y));
} else if (t_2 <= 2e+270) {
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 = (y / (t - a)) * z;
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double t_3 = y - (-1.0 * x);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -1e-146) {
tmp = t_3;
} else if (t_2 <= 5e-252) {
tmp = x + (y + (-1.0 * y));
} else if (t_2 <= 2e+270) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / (t - a)) * z t_2 = (x + y) - (((z - t) * y) / (a - t)) t_3 = y - (-1.0 * x) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -1e-146: tmp = t_3 elif t_2 <= 5e-252: tmp = x + (y + (-1.0 * y)) elif t_2 <= 2e+270: tmp = t_3 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(t - a)) * z) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) t_3 = Float64(y - Float64(-1.0 * x)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -1e-146) tmp = t_3; elseif (t_2 <= 5e-252) tmp = Float64(x + Float64(y + Float64(-1.0 * y))); elseif (t_2 <= 2e+270) tmp = t_3; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / (t - a)) * z; t_2 = (x + y) - (((z - t) * y) / (a - t)); t_3 = y - (-1.0 * x); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -1e-146) tmp = t_3; elseif (t_2 <= 5e-252) tmp = x + (y + (-1.0 * y)); elseif (t_2 <= 2e+270) tmp = t_3; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] * z), $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[(y - N[(-1.0 * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e-146], t$95$3, If[LessEqual[t$95$2, 5e-252], N[(x + N[(y + N[(-1.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+270], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t - a} \cdot z\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
t_3 := y - -1 \cdot x\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-146}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-252}:\\
\;\;\;\;x + \left(y + -1 \cdot y\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+270}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0 or 2.0000000000000001e270 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 77.6%
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
distribute-neg-outN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
div-addN/A
*-commutativeN/A
remove-double-negN/A
associate-+l+N/A
Applied rewrites87.5%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.4
Applied rewrites26.4%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift--.f64N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f6428.3
Applied rewrites28.3%
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -1.00000000000000003e-146 or 5.00000000000000008e-252 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 2.0000000000000001e270Initial program 77.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6465.8
Applied rewrites65.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6467.6
Applied rewrites67.6%
Taylor expanded in x around inf
lower-*.f6460.9
Applied rewrites60.9%
if -1.00000000000000003e-146 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 5.00000000000000008e-252Initial program 77.6%
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
distribute-neg-outN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
div-addN/A
*-commutativeN/A
remove-double-negN/A
associate-+l+N/A
Applied rewrites87.5%
Taylor expanded in t around inf
lower-+.f64N/A
lower-+.f64N/A
lower-*.f6451.3
Applied rewrites51.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- y (* -1.0 x)))) (if (<= a -6e+21) t_1 (if (<= a 1.4e-43) (+ x (+ y (* -1.0 y))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y - (-1.0 * x);
double tmp;
if (a <= -6e+21) {
tmp = t_1;
} else if (a <= 1.4e-43) {
tmp = x + (y + (-1.0 * y));
} 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 = y - ((-1.0d0) * x)
if (a <= (-6d+21)) then
tmp = t_1
else if (a <= 1.4d-43) then
tmp = x + (y + ((-1.0d0) * y))
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 = y - (-1.0 * x);
double tmp;
if (a <= -6e+21) {
tmp = t_1;
} else if (a <= 1.4e-43) {
tmp = x + (y + (-1.0 * y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y - (-1.0 * x) tmp = 0 if a <= -6e+21: tmp = t_1 elif a <= 1.4e-43: tmp = x + (y + (-1.0 * y)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y - Float64(-1.0 * x)) tmp = 0.0 if (a <= -6e+21) tmp = t_1; elseif (a <= 1.4e-43) tmp = Float64(x + Float64(y + Float64(-1.0 * y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y - (-1.0 * x); tmp = 0.0; if (a <= -6e+21) tmp = t_1; elseif (a <= 1.4e-43) tmp = x + (y + (-1.0 * y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y - N[(-1.0 * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -6e+21], t$95$1, If[LessEqual[a, 1.4e-43], N[(x + N[(y + N[(-1.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - -1 \cdot x\\
\mathbf{if}\;a \leq -6 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.4 \cdot 10^{-43}:\\
\;\;\;\;x + \left(y + -1 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -6e21 or 1.3999999999999999e-43 < a Initial program 77.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6465.8
Applied rewrites65.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6467.6
Applied rewrites67.6%
Taylor expanded in x around inf
lower-*.f6460.9
Applied rewrites60.9%
if -6e21 < a < 1.3999999999999999e-43Initial program 77.6%
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
distribute-neg-outN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
distribute-rgt-inN/A
div-addN/A
*-commutativeN/A
remove-double-negN/A
associate-+l+N/A
Applied rewrites87.5%
Taylor expanded in t around inf
lower-+.f64N/A
lower-+.f64N/A
lower-*.f6451.3
Applied rewrites51.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- y (* -1.0 x)))) (if (<= a -1.36e-49) t_1 (if (<= a 2.05e-210) (/ (* y z) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y - (-1.0 * x);
double tmp;
if (a <= -1.36e-49) {
tmp = t_1;
} else if (a <= 2.05e-210) {
tmp = (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 = y - ((-1.0d0) * x)
if (a <= (-1.36d-49)) then
tmp = t_1
else if (a <= 2.05d-210) then
tmp = (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 = y - (-1.0 * x);
double tmp;
if (a <= -1.36e-49) {
tmp = t_1;
} else if (a <= 2.05e-210) {
tmp = (y * z) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y - (-1.0 * x) tmp = 0 if a <= -1.36e-49: tmp = t_1 elif a <= 2.05e-210: tmp = (y * z) / t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y - Float64(-1.0 * x)) tmp = 0.0 if (a <= -1.36e-49) tmp = t_1; elseif (a <= 2.05e-210) tmp = Float64(Float64(y * z) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y - (-1.0 * x); tmp = 0.0; if (a <= -1.36e-49) tmp = t_1; elseif (a <= 2.05e-210) tmp = (y * z) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y - N[(-1.0 * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.36e-49], t$95$1, If[LessEqual[a, 2.05e-210], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - -1 \cdot x\\
\mathbf{if}\;a \leq -1.36 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.05 \cdot 10^{-210}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.36000000000000006e-49 or 2.04999999999999995e-210 < a Initial program 77.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6465.8
Applied rewrites65.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6467.6
Applied rewrites67.6%
Taylor expanded in x around inf
lower-*.f6460.9
Applied rewrites60.9%
if -1.36000000000000006e-49 < a < 2.04999999999999995e-210Initial program 77.6%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6457.2
Applied rewrites57.2%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f6418.2
Applied rewrites18.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- y (* -1.0 x)))) (if (<= a -1.36e-49) t_1 (if (<= a 5.8e-209) (* (/ y t) z) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y - (-1.0 * x);
double tmp;
if (a <= -1.36e-49) {
tmp = t_1;
} else if (a <= 5.8e-209) {
tmp = (y / t) * z;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = y - ((-1.0d0) * x)
if (a <= (-1.36d-49)) then
tmp = t_1
else if (a <= 5.8d-209) then
tmp = (y / t) * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y - (-1.0 * x);
double tmp;
if (a <= -1.36e-49) {
tmp = t_1;
} else if (a <= 5.8e-209) {
tmp = (y / t) * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y - (-1.0 * x) tmp = 0 if a <= -1.36e-49: tmp = t_1 elif a <= 5.8e-209: tmp = (y / t) * z else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y - Float64(-1.0 * x)) tmp = 0.0 if (a <= -1.36e-49) tmp = t_1; elseif (a <= 5.8e-209) tmp = Float64(Float64(y / t) * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y - (-1.0 * x); tmp = 0.0; if (a <= -1.36e-49) tmp = t_1; elseif (a <= 5.8e-209) tmp = (y / t) * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y - N[(-1.0 * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.36e-49], t$95$1, If[LessEqual[a, 5.8e-209], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - -1 \cdot x\\
\mathbf{if}\;a \leq -1.36 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 5.8 \cdot 10^{-209}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.36000000000000006e-49 or 5.80000000000000052e-209 < a Initial program 77.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6465.8
Applied rewrites65.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6467.6
Applied rewrites67.6%
Taylor expanded in x around inf
lower-*.f6460.9
Applied rewrites60.9%
if -1.36000000000000006e-49 < a < 5.80000000000000052e-209Initial program 77.6%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6457.2
Applied rewrites57.2%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f6418.2
Applied rewrites18.2%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6419.5
Applied rewrites19.5%
(FPCore (x y z t a) :precision binary64 (- y (* -1.0 x)))
double code(double x, double y, double z, double t, double a) {
return y - (-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 = y - ((-1.0d0) * x)
end function
public static double code(double x, double y, double z, double t, double a) {
return y - (-1.0 * x);
}
def code(x, y, z, t, a): return y - (-1.0 * x)
function code(x, y, z, t, a) return Float64(y - Float64(-1.0 * x)) end
function tmp = code(x, y, z, t, a) tmp = y - (-1.0 * x); end
code[x_, y_, z_, t_, a_] := N[(y - N[(-1.0 * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y - -1 \cdot x
\end{array}
Initial program 77.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6465.8
Applied rewrites65.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6467.6
Applied rewrites67.6%
Taylor expanded in x around inf
lower-*.f6460.9
Applied rewrites60.9%
(FPCore (x y z t a) :precision binary64 (- y (- y x)))
double code(double x, double y, double z, double t, double a) {
return y - (y - 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 = y - (y - x)
end function
public static double code(double x, double y, double z, double t, double a) {
return y - (y - x);
}
def code(x, y, z, t, a): return y - (y - x)
function code(x, y, z, t, a) return Float64(y - Float64(y - x)) end
function tmp = code(x, y, z, t, a) tmp = y - (y - x); end
code[x_, y_, z_, t_, a_] := N[(y - N[(y - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y - \left(y - x\right)
\end{array}
Initial program 77.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6465.8
Applied rewrites65.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6467.6
Applied rewrites67.6%
Taylor expanded in t around inf
lower--.f6445.4
Applied rewrites45.4%
herbie shell --seed 2025156
(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))))