
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + y \cdot \frac{z - t}{z - a}
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + y \cdot \frac{z - t}{z - a}
(FPCore (x y z t a) :precision binary64 (fma (/ (- t z) (- a z)) y x))
double code(double x, double y, double z, double t, double a) {
return fma(((t - z) / (a - z)), y, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(t - z) / Float64(a - z)), y, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\mathsf{fma}\left(\frac{t - z}{a - z}, y, x\right)
Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (fma (/ t (- a z)) y x)))
(if (<= t_1 -4e+16)
t_2
(if (<= t_1 0.4)
(fma (/ (- t z) a) y x)
(if (<= t_1 1.5) (fma (/ z (- z a)) y x) t_2)))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = fma((t / (a - z)), y, x);
double tmp;
if (t_1 <= -4e+16) {
tmp = t_2;
} else if (t_1 <= 0.4) {
tmp = fma(((t - z) / a), y, x);
} else if (t_1 <= 1.5) {
tmp = fma((z / (z - a)), y, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = fma(Float64(t / Float64(a - z)), y, x) tmp = 0.0 if (t_1 <= -4e+16) tmp = t_2; elseif (t_1 <= 0.4) tmp = fma(Float64(Float64(t - z) / a), y, x); elseif (t_1 <= 1.5) tmp = fma(Float64(z / Float64(z - a)), y, x); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+16], t$95$2, If[LessEqual[t$95$1, 0.4], N[(N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 1.5], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \mathsf{fma}\left(\frac{t}{a - z}, y, x\right)\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+16}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.4:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 1.5:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4e16 or 1.5 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in z around 0
Applied rewrites77.0%
if -4e16 < (/.f64 (-.f64 z t) (-.f64 z a)) < 0.40000000000000002Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in z around 0
Applied rewrites60.6%
if 0.40000000000000002 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.5Initial program 97.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6471.7
Applied rewrites71.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6471.7
Applied rewrites71.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (fma (/ t (- a z)) y x)))
(if (<= t_1 -4e+16)
t_2
(if (<= t_1 2e-117)
(fma (/ y a) (- t z) x)
(if (<= t_1 1.5) (fma (/ z (- z a)) y x) t_2)))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = fma((t / (a - z)), y, x);
double tmp;
if (t_1 <= -4e+16) {
tmp = t_2;
} else if (t_1 <= 2e-117) {
tmp = fma((y / a), (t - z), x);
} else if (t_1 <= 1.5) {
tmp = fma((z / (z - a)), y, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = fma(Float64(t / Float64(a - z)), y, x) tmp = 0.0 if (t_1 <= -4e+16) tmp = t_2; elseif (t_1 <= 2e-117) tmp = fma(Float64(y / a), Float64(t - z), x); elseif (t_1 <= 1.5) tmp = fma(Float64(z / Float64(z - a)), y, x); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+16], t$95$2, If[LessEqual[t$95$1, 2e-117], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 1.5], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \mathsf{fma}\left(\frac{t}{a - z}, y, x\right)\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+16}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-117}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - z, x\right)\\
\mathbf{elif}\;t\_1 \leq 1.5:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4e16 or 1.5 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in z around 0
Applied rewrites77.0%
if -4e16 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000006e-117Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in z around 0
Applied rewrites60.6%
lift-fma.f64N/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
*-commutativeN/A
mult-flipN/A
lower-/.f6461.2
Applied rewrites61.2%
if 2.00000000000000006e-117 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.5Initial program 97.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6471.7
Applied rewrites71.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6471.7
Applied rewrites71.7%
(FPCore (x y z t a) :precision binary64 (fma (/ y (- z a)) (- z t) x))
double code(double x, double y, double z, double t, double a) {
return fma((y / (z - a)), (z - t), x);
}
function code(x, y, z, t, a) return fma(Float64(y / Float64(z - a)), Float64(z - t), x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision]
\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)
Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
mult-flip-revN/A
lower-/.f6495.9
Applied rewrites95.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (fma (/ (- z t) z) y x)))
(if (<= t_1 -5e+126)
t_2
(if (<= t_1 0.4)
(fma (/ y a) (- t z) x)
(if (<= t_1 5e+79) t_2 (* (/ y (- a z)) t))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = fma(((z - t) / z), y, x);
double tmp;
if (t_1 <= -5e+126) {
tmp = t_2;
} else if (t_1 <= 0.4) {
tmp = fma((y / a), (t - z), x);
} else if (t_1 <= 5e+79) {
tmp = t_2;
} else {
tmp = (y / (a - z)) * t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = fma(Float64(Float64(z - t) / z), y, x) tmp = 0.0 if (t_1 <= -5e+126) tmp = t_2; elseif (t_1 <= 0.4) tmp = fma(Float64(y / a), Float64(t - z), x); elseif (t_1 <= 5e+79) tmp = t_2; else tmp = Float64(Float64(y / Float64(a - z)) * t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+126], t$95$2, If[LessEqual[t$95$1, 0.4], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 5e+79], t$95$2, N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+126}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.4:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - z, x\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+79}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - z} \cdot t\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999977e126 or 0.40000000000000002 < (/.f64 (-.f64 z t) (-.f64 z a)) < 5e79Initial program 97.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6471.7
Applied rewrites71.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6471.7
Applied rewrites71.7%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6466.9
Applied rewrites66.9%
if -4.99999999999999977e126 < (/.f64 (-.f64 z t) (-.f64 z a)) < 0.40000000000000002Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in z around 0
Applied rewrites60.6%
lift-fma.f64N/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
*-commutativeN/A
mult-flipN/A
lower-/.f6461.2
Applied rewrites61.2%
if 5e79 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.6
Applied rewrites28.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -5e+126)
(fma (/ (- z t) z) y x)
(if (<= t_1 2e-117)
(fma (/ t a) y x)
(if (<= t_1 2e+29) (fma (/ z (- z a)) y x) (* (/ t (- a z)) y))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -5e+126) {
tmp = fma(((z - t) / z), y, x);
} else if (t_1 <= 2e-117) {
tmp = fma((t / a), y, x);
} else if (t_1 <= 2e+29) {
tmp = fma((z / (z - a)), y, x);
} else {
tmp = (t / (a - z)) * y;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -5e+126) tmp = fma(Float64(Float64(z - t) / z), y, x); elseif (t_1 <= 2e-117) tmp = fma(Float64(t / a), y, x); elseif (t_1 <= 2e+29) tmp = fma(Float64(z / Float64(z - a)), y, x); else tmp = Float64(Float64(t / Float64(a - z)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+126], N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 2e-117], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+29], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-117}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a - z} \cdot y\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999977e126Initial program 97.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6471.7
Applied rewrites71.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6471.7
Applied rewrites71.7%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6466.9
Applied rewrites66.9%
if -4.99999999999999977e126 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000006e-117Initial program 97.9%
Taylor expanded in z around 0
lower-/.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6462.2
Applied rewrites62.2%
if 2.00000000000000006e-117 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.99999999999999983e29Initial program 97.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6471.7
Applied rewrites71.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6471.7
Applied rewrites71.7%
if 1.99999999999999983e29 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.6
Applied rewrites28.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -5e+126)
(fma (/ y z) (- z t) x)
(if (<= t_1 2e-117)
(fma (/ t a) y x)
(if (<= t_1 2e+29) (fma (/ z (- z a)) y x) (* (/ t (- a z)) y))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -5e+126) {
tmp = fma((y / z), (z - t), x);
} else if (t_1 <= 2e-117) {
tmp = fma((t / a), y, x);
} else if (t_1 <= 2e+29) {
tmp = fma((z / (z - a)), y, x);
} else {
tmp = (t / (a - z)) * y;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -5e+126) tmp = fma(Float64(y / z), Float64(z - t), x); elseif (t_1 <= 2e-117) tmp = fma(Float64(t / a), y, x); elseif (t_1 <= 2e+29) tmp = fma(Float64(z / Float64(z - a)), y, x); else tmp = Float64(Float64(t / Float64(a - z)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+126], N[(N[(y / z), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2e-117], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+29], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, z - t, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-117}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a - z} \cdot y\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999977e126Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
mult-flip-revN/A
lower-/.f6495.9
Applied rewrites95.9%
Taylor expanded in z around inf
lower-/.f6465.8
Applied rewrites65.8%
if -4.99999999999999977e126 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000006e-117Initial program 97.9%
Taylor expanded in z around 0
lower-/.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6462.2
Applied rewrites62.2%
if 2.00000000000000006e-117 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.99999999999999983e29Initial program 97.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6471.7
Applied rewrites71.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6471.7
Applied rewrites71.7%
if 1.99999999999999983e29 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.6
Applied rewrites28.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -5e+126)
(fma (/ y z) (- z t) x)
(if (<= t_1 0.4)
(fma (/ t a) y x)
(if (<= t_1 2e+29) (+ x y) (* (/ t (- a z)) y))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -5e+126) {
tmp = fma((y / z), (z - t), x);
} else if (t_1 <= 0.4) {
tmp = fma((t / a), y, x);
} else if (t_1 <= 2e+29) {
tmp = x + y;
} else {
tmp = (t / (a - z)) * y;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -5e+126) tmp = fma(Float64(y / z), Float64(z - t), x); elseif (t_1 <= 0.4) tmp = fma(Float64(t / a), y, x); elseif (t_1 <= 2e+29) tmp = Float64(x + y); else tmp = Float64(Float64(t / Float64(a - z)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+126], N[(N[(y / z), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.4], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+29], N[(x + y), $MachinePrecision], N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, z - t, x\right)\\
\mathbf{elif}\;t\_1 \leq 0.4:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+29}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a - z} \cdot y\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999977e126Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
mult-flip-revN/A
lower-/.f6495.9
Applied rewrites95.9%
Taylor expanded in z around inf
lower-/.f6465.8
Applied rewrites65.8%
if -4.99999999999999977e126 < (/.f64 (-.f64 z t) (-.f64 z a)) < 0.40000000000000002Initial program 97.9%
Taylor expanded in z around 0
lower-/.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6462.2
Applied rewrites62.2%
if 0.40000000000000002 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.99999999999999983e29Initial program 97.9%
Taylor expanded in z around inf
lower-+.f6460.9
Applied rewrites60.9%
if 1.99999999999999983e29 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.6
Applied rewrites28.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (* (/ t (- a z)) y)))
(if (<= t_1 -5e+126)
t_2
(if (<= t_1 0.4) (fma (/ t a) y x) (if (<= t_1 2e+29) (+ x y) t_2)))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (t / (a - z)) * y;
double tmp;
if (t_1 <= -5e+126) {
tmp = t_2;
} else if (t_1 <= 0.4) {
tmp = fma((t / a), y, x);
} else if (t_1 <= 2e+29) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(Float64(t / Float64(a - z)) * y) tmp = 0.0 if (t_1 <= -5e+126) tmp = t_2; elseif (t_1 <= 0.4) tmp = fma(Float64(t / a), y, x); elseif (t_1 <= 2e+29) tmp = Float64(x + y); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+126], t$95$2, If[LessEqual[t$95$1, 0.4], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+29], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \frac{t}{a - z} \cdot y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+126}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.4:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+29}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999977e126 or 1.99999999999999983e29 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.6
Applied rewrites28.6%
if -4.99999999999999977e126 < (/.f64 (-.f64 z t) (-.f64 z a)) < 0.40000000000000002Initial program 97.9%
Taylor expanded in z around 0
lower-/.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6462.2
Applied rewrites62.2%
if 0.40000000000000002 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.99999999999999983e29Initial program 97.9%
Taylor expanded in z around inf
lower-+.f6460.9
Applied rewrites60.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -5e+126)
(* (/ t (- z)) y)
(if (<= t_1 0.4)
(fma (/ t a) y x)
(if (<= t_1 5e+79) (+ x y) (* (/ y (- z)) t))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -5e+126) {
tmp = (t / -z) * y;
} else if (t_1 <= 0.4) {
tmp = fma((t / a), y, x);
} else if (t_1 <= 5e+79) {
tmp = x + y;
} else {
tmp = (y / -z) * t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -5e+126) tmp = Float64(Float64(t / Float64(-z)) * y); elseif (t_1 <= 0.4) tmp = fma(Float64(t / a), y, x); elseif (t_1 <= 5e+79) tmp = Float64(x + y); else tmp = Float64(Float64(y / Float64(-z)) * t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+126], N[(N[(t / (-z)), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 0.4], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 5e+79], N[(x + y), $MachinePrecision], N[(N[(y / (-z)), $MachinePrecision] * t), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+126}:\\
\;\;\;\;\frac{t}{-z} \cdot y\\
\mathbf{elif}\;t\_1 \leq 0.4:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+79}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{-z} \cdot t\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999977e126Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
Taylor expanded in z around inf
lower-*.f6414.7
Applied rewrites14.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6415.2
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
metadata-evalN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity15.2
Applied rewrites15.2%
if -4.99999999999999977e126 < (/.f64 (-.f64 z t) (-.f64 z a)) < 0.40000000000000002Initial program 97.9%
Taylor expanded in z around 0
lower-/.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6462.2
Applied rewrites62.2%
if 0.40000000000000002 < (/.f64 (-.f64 z t) (-.f64 z a)) < 5e79Initial program 97.9%
Taylor expanded in z around inf
lower-+.f6460.9
Applied rewrites60.9%
if 5e79 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
Taylor expanded in z around inf
lower-*.f6414.7
Applied rewrites14.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6415.4
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
metadata-evalN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity15.4
Applied rewrites15.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -5e+126)
(* (/ t (- z)) y)
(if (<= t_1 -2e+25)
(* (/ t a) y)
(if (<= t_1 5e+79) (+ x y) (* (/ y (- z)) t))))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -5e+126) {
tmp = (t / -z) * y;
} else if (t_1 <= -2e+25) {
tmp = (t / a) * y;
} else if (t_1 <= 5e+79) {
tmp = x + y;
} else {
tmp = (y / -z) * t;
}
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 = (z - t) / (z - a)
if (t_1 <= (-5d+126)) then
tmp = (t / -z) * y
else if (t_1 <= (-2d+25)) then
tmp = (t / a) * y
else if (t_1 <= 5d+79) then
tmp = x + y
else
tmp = (y / -z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -5e+126) {
tmp = (t / -z) * y;
} else if (t_1 <= -2e+25) {
tmp = (t / a) * y;
} else if (t_1 <= 5e+79) {
tmp = x + y;
} else {
tmp = (y / -z) * t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) tmp = 0 if t_1 <= -5e+126: tmp = (t / -z) * y elif t_1 <= -2e+25: tmp = (t / a) * y elif t_1 <= 5e+79: tmp = x + y else: tmp = (y / -z) * t return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -5e+126) tmp = Float64(Float64(t / Float64(-z)) * y); elseif (t_1 <= -2e+25) tmp = Float64(Float64(t / a) * y); elseif (t_1 <= 5e+79) tmp = Float64(x + y); else tmp = Float64(Float64(y / Float64(-z)) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); tmp = 0.0; if (t_1 <= -5e+126) tmp = (t / -z) * y; elseif (t_1 <= -2e+25) tmp = (t / a) * y; elseif (t_1 <= 5e+79) tmp = x + y; else tmp = (y / -z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+126], N[(N[(t / (-z)), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, -2e+25], N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 5e+79], N[(x + y), $MachinePrecision], N[(N[(y / (-z)), $MachinePrecision] * t), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+126}:\\
\;\;\;\;\frac{t}{-z} \cdot y\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+25}:\\
\;\;\;\;\frac{t}{a} \cdot y\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+79}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{-z} \cdot t\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999977e126Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
Taylor expanded in z around inf
lower-*.f6414.7
Applied rewrites14.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6415.2
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
metadata-evalN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity15.2
Applied rewrites15.2%
if -4.99999999999999977e126 < (/.f64 (-.f64 z t) (-.f64 z a)) < -2.00000000000000018e25Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.6
Applied rewrites28.6%
Taylor expanded in z around 0
lower-/.f6420.3
Applied rewrites20.3%
if -2.00000000000000018e25 < (/.f64 (-.f64 z t) (-.f64 z a)) < 5e79Initial program 97.9%
Taylor expanded in z around inf
lower-+.f6460.9
Applied rewrites60.9%
if 5e79 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
Taylor expanded in z around inf
lower-*.f6414.7
Applied rewrites14.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6415.4
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
metadata-evalN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity15.4
Applied rewrites15.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (* (/ t (- z)) y)))
(if (<= t_1 -5e+126)
t_2
(if (<= t_1 -2e+25) (* (/ t a) y) (if (<= t_1 5e+79) (+ x y) t_2)))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (t / -z) * y;
double tmp;
if (t_1 <= -5e+126) {
tmp = t_2;
} else if (t_1 <= -2e+25) {
tmp = (t / a) * y;
} else if (t_1 <= 5e+79) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z - t) / (z - a)
t_2 = (t / -z) * y
if (t_1 <= (-5d+126)) then
tmp = t_2
else if (t_1 <= (-2d+25)) then
tmp = (t / a) * y
else if (t_1 <= 5d+79) then
tmp = x + y
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (t / -z) * y;
double tmp;
if (t_1 <= -5e+126) {
tmp = t_2;
} else if (t_1 <= -2e+25) {
tmp = (t / a) * y;
} else if (t_1 <= 5e+79) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = (t / -z) * y tmp = 0 if t_1 <= -5e+126: tmp = t_2 elif t_1 <= -2e+25: tmp = (t / a) * y elif t_1 <= 5e+79: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(Float64(t / Float64(-z)) * y) tmp = 0.0 if (t_1 <= -5e+126) tmp = t_2; elseif (t_1 <= -2e+25) tmp = Float64(Float64(t / a) * y); elseif (t_1 <= 5e+79) tmp = Float64(x + y); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = (t / -z) * y; tmp = 0.0; if (t_1 <= -5e+126) tmp = t_2; elseif (t_1 <= -2e+25) tmp = (t / a) * y; elseif (t_1 <= 5e+79) tmp = x + y; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t / (-z)), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+126], t$95$2, If[LessEqual[t$95$1, -2e+25], N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 5e+79], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \frac{t}{-z} \cdot y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+126}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+25}:\\
\;\;\;\;\frac{t}{a} \cdot y\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+79}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999977e126 or 5e79 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
Taylor expanded in z around inf
lower-*.f6414.7
Applied rewrites14.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6415.2
lift-*.f64N/A
metadata-evalN/A
distribute-lft-neg-outN/A
metadata-evalN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity15.2
Applied rewrites15.2%
if -4.99999999999999977e126 < (/.f64 (-.f64 z t) (-.f64 z a)) < -2.00000000000000018e25Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.6
Applied rewrites28.6%
Taylor expanded in z around 0
lower-/.f6420.3
Applied rewrites20.3%
if -2.00000000000000018e25 < (/.f64 (-.f64 z t) (-.f64 z a)) < 5e79Initial program 97.9%
Taylor expanded in z around inf
lower-+.f6460.9
Applied rewrites60.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -2e+76)
(* (/ y a) t)
(if (<= t_1 4e+84) (+ x y) (* (/ t a) y)))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -2e+76) {
tmp = (y / a) * t;
} else if (t_1 <= 4e+84) {
tmp = x + y;
} else {
tmp = (t / a) * y;
}
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 = (z - t) / (z - a)
if (t_1 <= (-2d+76)) then
tmp = (y / a) * t
else if (t_1 <= 4d+84) then
tmp = x + y
else
tmp = (t / a) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -2e+76) {
tmp = (y / a) * t;
} else if (t_1 <= 4e+84) {
tmp = x + y;
} else {
tmp = (t / a) * y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) tmp = 0 if t_1 <= -2e+76: tmp = (y / a) * t elif t_1 <= 4e+84: tmp = x + y else: tmp = (t / a) * y return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -2e+76) tmp = Float64(Float64(y / a) * t); elseif (t_1 <= 4e+84) tmp = Float64(x + y); else tmp = Float64(Float64(t / a) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); tmp = 0.0; if (t_1 <= -2e+76) tmp = (y / a) * t; elseif (t_1 <= 4e+84) tmp = x + y; else tmp = (t / a) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+76], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 4e+84], N[(x + y), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+76}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+84}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot y\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -2.0000000000000001e76Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6418.5
Applied rewrites18.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6420.0
Applied rewrites20.0%
if -2.0000000000000001e76 < (/.f64 (-.f64 z t) (-.f64 z a)) < 4.00000000000000023e84Initial program 97.9%
Taylor expanded in z around inf
lower-+.f6460.9
Applied rewrites60.9%
if 4.00000000000000023e84 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6428.6
Applied rewrites28.6%
Taylor expanded in z around 0
lower-/.f6420.3
Applied rewrites20.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -2e+76)
(* (/ y a) t)
(if (<= t_1 4e+84) (+ x y) (/ (* t y) a)))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -2e+76) {
tmp = (y / a) * t;
} else if (t_1 <= 4e+84) {
tmp = x + y;
} else {
tmp = (t * y) / a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (z - t) / (z - a)
if (t_1 <= (-2d+76)) then
tmp = (y / a) * t
else if (t_1 <= 4d+84) then
tmp = x + y
else
tmp = (t * y) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -2e+76) {
tmp = (y / a) * t;
} else if (t_1 <= 4e+84) {
tmp = x + y;
} else {
tmp = (t * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) tmp = 0 if t_1 <= -2e+76: tmp = (y / a) * t elif t_1 <= 4e+84: tmp = x + y else: tmp = (t * y) / a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -2e+76) tmp = Float64(Float64(y / a) * t); elseif (t_1 <= 4e+84) tmp = Float64(x + y); else tmp = Float64(Float64(t * y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); tmp = 0.0; if (t_1 <= -2e+76) tmp = (y / a) * t; elseif (t_1 <= 4e+84) tmp = x + y; else tmp = (t * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+76], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 4e+84], N[(x + y), $MachinePrecision], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+76}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+84}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -2.0000000000000001e76Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6418.5
Applied rewrites18.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6420.0
Applied rewrites20.0%
if -2.0000000000000001e76 < (/.f64 (-.f64 z t) (-.f64 z a)) < 4.00000000000000023e84Initial program 97.9%
Taylor expanded in z around inf
lower-+.f6460.9
Applied rewrites60.9%
if 4.00000000000000023e84 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6418.5
Applied rewrites18.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- z a))) (t_2 (* (/ y a) t))) (if (<= t_1 -2e+76) t_2 (if (<= t_1 4e+84) (+ x y) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (y / a) * t;
double tmp;
if (t_1 <= -2e+76) {
tmp = t_2;
} else if (t_1 <= 4e+84) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z - t) / (z - a)
t_2 = (y / a) * t
if (t_1 <= (-2d+76)) then
tmp = t_2
else if (t_1 <= 4d+84) then
tmp = x + y
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (y / a) * t;
double tmp;
if (t_1 <= -2e+76) {
tmp = t_2;
} else if (t_1 <= 4e+84) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) t_2 = (y / a) * t tmp = 0 if t_1 <= -2e+76: tmp = t_2 elif t_1 <= 4e+84: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(Float64(y / a) * t) tmp = 0.0 if (t_1 <= -2e+76) tmp = t_2; elseif (t_1 <= 4e+84) tmp = Float64(x + y); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); t_2 = (y / a) * t; tmp = 0.0; if (t_1 <= -2e+76) tmp = t_2; elseif (t_1 <= 4e+84) tmp = x + y; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+76], t$95$2, If[LessEqual[t$95$1, 4e+84], N[(x + y), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \frac{y}{a} \cdot t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+76}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+84}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -2.0000000000000001e76 or 4.00000000000000023e84 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6418.5
Applied rewrites18.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6420.0
Applied rewrites20.0%
if -2.0000000000000001e76 < (/.f64 (-.f64 z t) (-.f64 z a)) < 4.00000000000000023e84Initial program 97.9%
Taylor expanded in z around inf
lower-+.f6460.9
Applied rewrites60.9%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + y;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
x + y
Initial program 97.9%
Taylor expanded in z around inf
lower-+.f6460.9
Applied rewrites60.9%
(FPCore (x y z t a) :precision binary64 y)
double code(double x, double y, double z, double t, double a) {
return y;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return y;
}
def code(x, y, z, t, a): return y
function code(x, y, z, t, a) return y end
function tmp = code(x, y, z, t, a) tmp = y; end
code[x_, y_, z_, t_, a_] := y
y
Initial program 97.9%
Taylor expanded in z around inf
lower-+.f6460.9
Applied rewrites60.9%
Taylor expanded in x around 0
Applied rewrites18.5%
herbie shell --seed 2025166
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
(+ x (* y (/ (- z t) (- z a)))))