
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (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) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (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) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 2e+171)
(+ x (* y t_1))
(+ x (/ 1.0 (/ (- t a) (* (- t z) y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= 2e+171) {
tmp = x + (y * t_1);
} else {
tmp = x + (1.0 / ((t - a) / ((t - z) * 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) / (a - t)
if (t_1 <= 2d+171) then
tmp = x + (y * t_1)
else
tmp = x + (1.0d0 / ((t - a) / ((t - z) * 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) / (a - t);
double tmp;
if (t_1 <= 2e+171) {
tmp = x + (y * t_1);
} else {
tmp = x + (1.0 / ((t - a) / ((t - z) * y)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) tmp = 0 if t_1 <= 2e+171: tmp = x + (y * t_1) else: tmp = x + (1.0 / ((t - a) / ((t - z) * y))) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= 2e+171) tmp = Float64(x + Float64(y * t_1)); else tmp = Float64(x + Float64(1.0 / Float64(Float64(t - a) / Float64(Float64(t - z) * y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (a - t); tmp = 0.0; if (t_1 <= 2e+171) tmp = x + (y * t_1); else tmp = x + (1.0 / ((t - a) / ((t - z) * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+171], N[(x + N[(y * t$95$1), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / N[(N[(t - a), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+171}:\\
\;\;\;\;x + y \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{\frac{t - a}{\left(t - z\right) \cdot y}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 1.99999999999999991e171Initial program 97.9%
if 1.99999999999999991e171 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-2negN/A
div-flipN/A
lower-special-/.f64N/A
lower-special-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
*-commutativeN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6485.6
Applied rewrites85.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- a t)))) (if (<= t_1 4e+188) (+ x (* y t_1)) (fma (/ y (- t a)) (- t z) x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= 4e+188) {
tmp = x + (y * t_1);
} else {
tmp = fma((y / (t - a)), (t - z), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= 4e+188) tmp = Float64(x + Float64(y * t_1)); else tmp = fma(Float64(y / Float64(t - a)), Float64(t - z), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 4e+188], N[(x + N[(y * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{+188}:\\
\;\;\;\;x + y \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t - a}, t - z, x\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 4.0000000000000001e188Initial program 97.9%
if 4.0000000000000001e188 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6495.8
Applied rewrites95.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- a t))) (t_2 (fma (/ y (- t a)) (- t z) x))) (if (<= t_1 0.4) t_2 (if (<= t_1 1.0) (fma (/ (- t z) t) y x) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = fma((y / (t - a)), (t - z), x);
double tmp;
if (t_1 <= 0.4) {
tmp = t_2;
} else if (t_1 <= 1.0) {
tmp = fma(((t - z) / t), y, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = fma(Float64(y / Float64(t - a)), Float64(t - z), x) tmp = 0.0 if (t_1 <= 0.4) tmp = t_2; elseif (t_1 <= 1.0) tmp = fma(Float64(Float64(t - z) / t), 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$1, 0.4], t$95$2, If[LessEqual[t$95$1, 1.0], N[(N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := \mathsf{fma}\left(\frac{y}{t - a}, t - z, x\right)\\
\mathbf{if}\;t\_1 \leq 0.4:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 0.40000000000000002 or 1 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6495.8
Applied rewrites95.8%
if 0.40000000000000002 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6495.8
Applied rewrites95.8%
Taylor expanded in z around 0
Applied rewrites70.3%
lift-fma.f64N/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-frac-neg2N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
remove-double-negN/A
Applied rewrites71.7%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6465.9
Applied rewrites65.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (+ x (* y (/ z (- a t))))))
(if (<= t_1 -2e+38)
t_2
(if (<= t_1 0.4)
(fma (/ (- z t) a) y x)
(if (<= t_1 2.0) (fma (/ (- t z) t) y x) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = x + (y * (z / (a - t)));
double tmp;
if (t_1 <= -2e+38) {
tmp = t_2;
} else if (t_1 <= 0.4) {
tmp = fma(((z - t) / a), y, x);
} else if (t_1 <= 2.0) {
tmp = fma(((t - z) / t), y, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(x + Float64(y * Float64(z / Float64(a - t)))) tmp = 0.0 if (t_1 <= -2e+38) tmp = t_2; elseif (t_1 <= 0.4) tmp = fma(Float64(Float64(z - t) / a), y, x); elseif (t_1 <= 2.0) tmp = fma(Float64(Float64(t - z) / t), 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+38], t$95$2, If[LessEqual[t$95$1, 0.4], N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[(N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := x + y \cdot \frac{z}{a - t}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+38}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.4:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -1.99999999999999995e38 or 2 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f6476.2
Applied rewrites76.2%
if -1.99999999999999995e38 < (/.f64 (-.f64 z t) (-.f64 a t)) < 0.40000000000000002Initial program 97.9%
Taylor expanded in t around 0
Applied rewrites60.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6460.6
Applied rewrites60.6%
if 0.40000000000000002 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6495.8
Applied rewrites95.8%
Taylor expanded in z around 0
Applied rewrites70.3%
lift-fma.f64N/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-frac-neg2N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
remove-double-negN/A
Applied rewrites71.7%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6465.9
Applied rewrites65.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 -2e+38)
(fma (/ y t) (- t z) x)
(if (<= t_1 0.0005)
(fma (/ (- z t) a) y x)
(if (<= t_1 100000000000.0) (+ x y) (* (/ y (- a t)) z))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -2e+38) {
tmp = fma((y / t), (t - z), x);
} else if (t_1 <= 0.0005) {
tmp = fma(((z - t) / a), y, x);
} else if (t_1 <= 100000000000.0) {
tmp = x + y;
} else {
tmp = (y / (a - t)) * z;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= -2e+38) tmp = fma(Float64(y / t), Float64(t - z), x); elseif (t_1 <= 0.0005) tmp = fma(Float64(Float64(z - t) / a), y, x); elseif (t_1 <= 100000000000.0) tmp = Float64(x + y); else tmp = Float64(Float64(y / Float64(a - t)) * z); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+38], N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0005], N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 100000000000.0], N[(x + y), $MachinePrecision], N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, t - z, x\right)\\
\mathbf{elif}\;t\_1 \leq 0.0005:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 100000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - t} \cdot z\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -1.99999999999999995e38Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6495.8
Applied rewrites95.8%
Taylor expanded in t around inf
lower-/.f6464.5
Applied rewrites64.5%
if -1.99999999999999995e38 < (/.f64 (-.f64 z t) (-.f64 a t)) < 5.0000000000000001e-4Initial program 97.9%
Taylor expanded in t around 0
Applied rewrites60.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6460.6
Applied rewrites60.6%
if 5.0000000000000001e-4 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e11Initial program 97.9%
Taylor expanded in t around inf
lower-+.f6460.4
Applied rewrites60.4%
if 1e11 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6428.7
Applied rewrites28.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 -2e+38)
(fma (/ y t) (- t z) x)
(if (<= t_1 0.0005)
(+ x (* y (/ z a)))
(if (<= t_1 100000000000.0) (+ x y) (* (/ y (- a t)) z))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -2e+38) {
tmp = fma((y / t), (t - z), x);
} else if (t_1 <= 0.0005) {
tmp = x + (y * (z / a));
} else if (t_1 <= 100000000000.0) {
tmp = x + y;
} else {
tmp = (y / (a - t)) * z;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= -2e+38) tmp = fma(Float64(y / t), Float64(t - z), x); elseif (t_1 <= 0.0005) tmp = Float64(x + Float64(y * Float64(z / a))); elseif (t_1 <= 100000000000.0) tmp = Float64(x + y); else tmp = Float64(Float64(y / Float64(a - t)) * z); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+38], N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0005], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 100000000000.0], N[(x + y), $MachinePrecision], N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, t - z, x\right)\\
\mathbf{elif}\;t\_1 \leq 0.0005:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{elif}\;t\_1 \leq 100000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - t} \cdot z\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -1.99999999999999995e38Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6495.8
Applied rewrites95.8%
Taylor expanded in t around inf
lower-/.f6464.5
Applied rewrites64.5%
if -1.99999999999999995e38 < (/.f64 (-.f64 z t) (-.f64 a t)) < 5.0000000000000001e-4Initial program 97.9%
Taylor expanded in t around 0
lower-/.f6462.1
Applied rewrites62.1%
if 5.0000000000000001e-4 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e11Initial program 97.9%
Taylor expanded in t around inf
lower-+.f6460.4
Applied rewrites60.4%
if 1e11 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6428.7
Applied rewrites28.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (* (/ y (- a t)) z)))
(if (<= t_1 -2e+65)
t_2
(if (<= t_1 0.0005)
(+ x (* y (/ z a)))
(if (<= t_1 100000000000.0) (+ x y) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = (y / (a - t)) * z;
double tmp;
if (t_1 <= -2e+65) {
tmp = t_2;
} else if (t_1 <= 0.0005) {
tmp = x + (y * (z / a));
} else if (t_1 <= 100000000000.0) {
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) / (a - t)
t_2 = (y / (a - t)) * z
if (t_1 <= (-2d+65)) then
tmp = t_2
else if (t_1 <= 0.0005d0) then
tmp = x + (y * (z / a))
else if (t_1 <= 100000000000.0d0) 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) / (a - t);
double t_2 = (y / (a - t)) * z;
double tmp;
if (t_1 <= -2e+65) {
tmp = t_2;
} else if (t_1 <= 0.0005) {
tmp = x + (y * (z / a));
} else if (t_1 <= 100000000000.0) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) t_2 = (y / (a - t)) * z tmp = 0 if t_1 <= -2e+65: tmp = t_2 elif t_1 <= 0.0005: tmp = x + (y * (z / a)) elif t_1 <= 100000000000.0: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(Float64(y / Float64(a - t)) * z) tmp = 0.0 if (t_1 <= -2e+65) tmp = t_2; elseif (t_1 <= 0.0005) tmp = Float64(x + Float64(y * Float64(z / a))); elseif (t_1 <= 100000000000.0) 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) / (a - t); t_2 = (y / (a - t)) * z; tmp = 0.0; if (t_1 <= -2e+65) tmp = t_2; elseif (t_1 <= 0.0005) tmp = x + (y * (z / a)); elseif (t_1 <= 100000000000.0) 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+65], t$95$2, If[LessEqual[t$95$1, 0.0005], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 100000000000.0], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := \frac{y}{a - t} \cdot z\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+65}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.0005:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{elif}\;t\_1 \leq 100000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -2e65 or 1e11 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6428.7
Applied rewrites28.7%
if -2e65 < (/.f64 (-.f64 z t) (-.f64 a t)) < 5.0000000000000001e-4Initial program 97.9%
Taylor expanded in t around 0
lower-/.f6462.1
Applied rewrites62.1%
if 5.0000000000000001e-4 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e11Initial program 97.9%
Taylor expanded in t around inf
lower-+.f6460.4
Applied rewrites60.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (* (/ y (- a t)) z)))
(if (<= t_1 -2e+65)
t_2
(if (<= t_1 0.0005)
(+ x (* (/ y a) z))
(if (<= t_1 100000000000.0) (+ x y) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = (y / (a - t)) * z;
double tmp;
if (t_1 <= -2e+65) {
tmp = t_2;
} else if (t_1 <= 0.0005) {
tmp = x + ((y / a) * z);
} else if (t_1 <= 100000000000.0) {
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) / (a - t)
t_2 = (y / (a - t)) * z
if (t_1 <= (-2d+65)) then
tmp = t_2
else if (t_1 <= 0.0005d0) then
tmp = x + ((y / a) * z)
else if (t_1 <= 100000000000.0d0) 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) / (a - t);
double t_2 = (y / (a - t)) * z;
double tmp;
if (t_1 <= -2e+65) {
tmp = t_2;
} else if (t_1 <= 0.0005) {
tmp = x + ((y / a) * z);
} else if (t_1 <= 100000000000.0) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) t_2 = (y / (a - t)) * z tmp = 0 if t_1 <= -2e+65: tmp = t_2 elif t_1 <= 0.0005: tmp = x + ((y / a) * z) elif t_1 <= 100000000000.0: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(Float64(y / Float64(a - t)) * z) tmp = 0.0 if (t_1 <= -2e+65) tmp = t_2; elseif (t_1 <= 0.0005) tmp = Float64(x + Float64(Float64(y / a) * z)); elseif (t_1 <= 100000000000.0) 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) / (a - t); t_2 = (y / (a - t)) * z; tmp = 0.0; if (t_1 <= -2e+65) tmp = t_2; elseif (t_1 <= 0.0005) tmp = x + ((y / a) * z); elseif (t_1 <= 100000000000.0) 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+65], t$95$2, If[LessEqual[t$95$1, 0.0005], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 100000000000.0], N[(x + y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := \frac{y}{a - t} \cdot z\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+65}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.0005:\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\mathbf{elif}\;t\_1 \leq 100000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -2e65 or 1e11 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6428.7
Applied rewrites28.7%
if -2e65 < (/.f64 (-.f64 z t) (-.f64 a t)) < 5.0000000000000001e-4Initial program 97.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6460.5
Applied rewrites60.5%
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-/.f6462.2
Applied rewrites62.2%
if 5.0000000000000001e-4 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e11Initial program 97.9%
Taylor expanded in t around inf
lower-+.f6460.4
Applied rewrites60.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (* (/ y (- a t)) z)))
(if (<= t_1 -2e+65)
t_2
(if (<= t_1 100000000000.0) (fma (/ t (- t a)) y x) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = (y / (a - t)) * z;
double tmp;
if (t_1 <= -2e+65) {
tmp = t_2;
} else if (t_1 <= 100000000000.0) {
tmp = fma((t / (t - a)), y, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(Float64(y / Float64(a - t)) * z) tmp = 0.0 if (t_1 <= -2e+65) tmp = t_2; elseif (t_1 <= 100000000000.0) tmp = fma(Float64(t / Float64(t - 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+65], t$95$2, If[LessEqual[t$95$1, 100000000000.0], N[(N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := \frac{y}{a - t} \cdot z\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+65}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 100000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{t - a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -2e65 or 1e11 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6428.7
Applied rewrites28.7%
if -2e65 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e11Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6495.8
Applied rewrites95.8%
Taylor expanded in z around 0
Applied rewrites70.3%
lift-fma.f64N/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-frac-neg2N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
remove-double-negN/A
Applied rewrites71.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- a t))) (t_2 (* (/ y (- a t)) z))) (if (<= t_1 -2e+65) t_2 (if (<= t_1 100000000000.0) (+ x y) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = (y / (a - t)) * z;
double tmp;
if (t_1 <= -2e+65) {
tmp = t_2;
} else if (t_1 <= 100000000000.0) {
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) / (a - t)
t_2 = (y / (a - t)) * z
if (t_1 <= (-2d+65)) then
tmp = t_2
else if (t_1 <= 100000000000.0d0) 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) / (a - t);
double t_2 = (y / (a - t)) * z;
double tmp;
if (t_1 <= -2e+65) {
tmp = t_2;
} else if (t_1 <= 100000000000.0) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) t_2 = (y / (a - t)) * z tmp = 0 if t_1 <= -2e+65: tmp = t_2 elif t_1 <= 100000000000.0: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(Float64(y / Float64(a - t)) * z) tmp = 0.0 if (t_1 <= -2e+65) tmp = t_2; elseif (t_1 <= 100000000000.0) 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) / (a - t); t_2 = (y / (a - t)) * z; tmp = 0.0; if (t_1 <= -2e+65) tmp = t_2; elseif (t_1 <= 100000000000.0) 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+65], t$95$2, If[LessEqual[t$95$1, 100000000000.0], N[(x + y), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := \frac{y}{a - t} \cdot z\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+65}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 100000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -2e65 or 1e11 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6428.7
Applied rewrites28.7%
if -2e65 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e11Initial program 97.9%
Taylor expanded in t around inf
lower-+.f6460.4
Applied rewrites60.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- a t))) (t_2 (* (/ z (- a t)) y))) (if (<= t_1 -2e+65) t_2 (if (<= t_1 100000000000.0) (+ x y) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = (z / (a - t)) * y;
double tmp;
if (t_1 <= -2e+65) {
tmp = t_2;
} else if (t_1 <= 100000000000.0) {
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) / (a - t)
t_2 = (z / (a - t)) * y
if (t_1 <= (-2d+65)) then
tmp = t_2
else if (t_1 <= 100000000000.0d0) 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) / (a - t);
double t_2 = (z / (a - t)) * y;
double tmp;
if (t_1 <= -2e+65) {
tmp = t_2;
} else if (t_1 <= 100000000000.0) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) t_2 = (z / (a - t)) * y tmp = 0 if t_1 <= -2e+65: tmp = t_2 elif t_1 <= 100000000000.0: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(Float64(z / Float64(a - t)) * y) tmp = 0.0 if (t_1 <= -2e+65) tmp = t_2; elseif (t_1 <= 100000000000.0) 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) / (a - t); t_2 = (z / (a - t)) * y; tmp = 0.0; if (t_1 <= -2e+65) tmp = t_2; elseif (t_1 <= 100000000000.0) 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+65], t$95$2, If[LessEqual[t$95$1, 100000000000.0], N[(x + y), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := \frac{z}{a - t} \cdot y\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+65}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 100000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -2e65 or 1e11 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.7
Applied rewrites39.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6449.5
Applied rewrites49.5%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f6428.6
Applied rewrites28.6%
if -2e65 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e11Initial program 97.9%
Taylor expanded in t around inf
lower-+.f6460.4
Applied rewrites60.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 -5e+211)
(/ (* y z) a)
(if (<= t_1 100000000000.0) (+ x y) (* (/ z a) y)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -5e+211) {
tmp = (y * z) / a;
} else if (t_1 <= 100000000000.0) {
tmp = x + y;
} else {
tmp = (z / 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) / (a - t)
if (t_1 <= (-5d+211)) then
tmp = (y * z) / a
else if (t_1 <= 100000000000.0d0) then
tmp = x + y
else
tmp = (z / 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) / (a - t);
double tmp;
if (t_1 <= -5e+211) {
tmp = (y * z) / a;
} else if (t_1 <= 100000000000.0) {
tmp = x + y;
} else {
tmp = (z / a) * y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) tmp = 0 if t_1 <= -5e+211: tmp = (y * z) / a elif t_1 <= 100000000000.0: tmp = x + y else: tmp = (z / a) * y return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= -5e+211) tmp = Float64(Float64(y * z) / a); elseif (t_1 <= 100000000000.0) tmp = Float64(x + y); else tmp = Float64(Float64(z / a) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (a - t); tmp = 0.0; if (t_1 <= -5e+211) tmp = (y * z) / a; elseif (t_1 <= 100000000000.0) tmp = x + y; else tmp = (z / a) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+211], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t$95$1, 100000000000.0], N[(x + y), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+211}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;t\_1 \leq 100000000000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{a} \cdot y\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -4.9999999999999995e211Initial program 97.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.7
Applied rewrites39.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6449.5
Applied rewrites49.5%
Taylor expanded in t around 0
lower-/.f6420.8
Applied rewrites20.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6418.9
Applied rewrites18.9%
if -4.9999999999999995e211 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e11Initial program 97.9%
Taylor expanded in t around inf
lower-+.f6460.4
Applied rewrites60.4%
if 1e11 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.7
Applied rewrites39.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6449.5
Applied rewrites49.5%
Taylor expanded in t around 0
lower-/.f6420.8
Applied rewrites20.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- a t))) (t_2 (/ (* y z) a))) (if (<= t_1 -5e+211) t_2 (if (<= t_1 1e+14) (+ x y) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = (y * z) / a;
double tmp;
if (t_1 <= -5e+211) {
tmp = t_2;
} else if (t_1 <= 1e+14) {
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) / (a - t)
t_2 = (y * z) / a
if (t_1 <= (-5d+211)) then
tmp = t_2
else if (t_1 <= 1d+14) 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) / (a - t);
double t_2 = (y * z) / a;
double tmp;
if (t_1 <= -5e+211) {
tmp = t_2;
} else if (t_1 <= 1e+14) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) t_2 = (y * z) / a tmp = 0 if t_1 <= -5e+211: tmp = t_2 elif t_1 <= 1e+14: tmp = x + y else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(Float64(y * z) / a) tmp = 0.0 if (t_1 <= -5e+211) tmp = t_2; elseif (t_1 <= 1e+14) 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) / (a - t); t_2 = (y * z) / a; tmp = 0.0; if (t_1 <= -5e+211) tmp = t_2; elseif (t_1 <= 1e+14) 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[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+211], t$95$2, If[LessEqual[t$95$1, 1e+14], N[(x + y), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := \frac{y \cdot z}{a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+211}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+14}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -4.9999999999999995e211 or 1e14 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 97.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.7
Applied rewrites39.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6449.5
Applied rewrites49.5%
Taylor expanded in t around 0
lower-/.f6420.8
Applied rewrites20.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6418.9
Applied rewrites18.9%
if -4.9999999999999995e211 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e14Initial program 97.9%
Taylor expanded in t around inf
lower-+.f6460.4
Applied rewrites60.4%
(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]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 97.9%
Taylor expanded in t around inf
lower-+.f6460.4
Applied rewrites60.4%
(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
\begin{array}{l}
\\
y
\end{array}
Initial program 97.9%
Taylor expanded in t around inf
lower-+.f6460.4
Applied rewrites60.4%
Taylor expanded in x around 0
Applied rewrites19.0%
herbie shell --seed 2025154
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
(+ x (* y (/ (- z t) (- a t)))))