
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
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 - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
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 - x) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z)))
(t_2 (fma t_1 (- y z) x))
(t_3 (+ x (* (- y z) t_1))))
(if (<= t_3 -5e-300)
t_2
(if (<= t_3 5e-262) (+ (- (/ (* (- t x) (- y a)) z)) t) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = fma(t_1, (y - z), x);
double t_3 = x + ((y - z) * t_1);
double tmp;
if (t_3 <= -5e-300) {
tmp = t_2;
} else if (t_3 <= 5e-262) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = fma(t_1, Float64(y - z), x) t_3 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if (t_3 <= -5e-300) tmp = t_2; elseif (t_3 <= 5e-262) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-300], t$95$2, If[LessEqual[t$95$3, 5e-262], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := \mathsf{fma}\left(t\_1, y - z, x\right)\\
t_3 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-300}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{-262}:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999996e-300 or 4.99999999999999992e-262 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 90.6%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6490.6
Applied rewrites90.6%
if -4.99999999999999996e-300 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.99999999999999992e-262Initial program 7.7%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites77.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ t (- a z)) (- y z) x))
(t_2 (/ (- t x) (- a z)))
(t_3 (+ x (* (- y z) t_2))))
(if (<= t_3 -5e+238)
(+ x (* y t_2))
(if (<= t_3 -5e-300)
t_1
(if (<= t_3 5e-262)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(if (<= t_3 1e+303) t_1 (* (- t x) (/ y (- a z)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t / (a - z)), (y - z), x);
double t_2 = (t - x) / (a - z);
double t_3 = x + ((y - z) * t_2);
double tmp;
if (t_3 <= -5e+238) {
tmp = x + (y * t_2);
} else if (t_3 <= -5e-300) {
tmp = t_1;
} else if (t_3 <= 5e-262) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else if (t_3 <= 1e+303) {
tmp = t_1;
} else {
tmp = (t - x) * (y / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t / Float64(a - z)), Float64(y - z), x) t_2 = Float64(Float64(t - x) / Float64(a - z)) t_3 = Float64(x + Float64(Float64(y - z) * t_2)) tmp = 0.0 if (t_3 <= -5e+238) tmp = Float64(x + Float64(y * t_2)); elseif (t_3 <= -5e-300) tmp = t_1; elseif (t_3 <= 5e-262) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); elseif (t_3 <= 1e+303) tmp = t_1; else tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+238], N[(x + N[(y * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -5e-300], t$95$1, If[LessEqual[t$95$3, 5e-262], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], If[LessEqual[t$95$3, 1e+303], t$95$1, N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t}{a - z}, y - z, x\right)\\
t_2 := \frac{t - x}{a - z}\\
t_3 := x + \left(y - z\right) \cdot t\_2\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{+238}:\\
\;\;\;\;x + y \cdot t\_2\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-300}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{-262}:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{elif}\;t\_3 \leq 10^{+303}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999995e238Initial program 90.7%
Taylor expanded in y around inf
Applied rewrites78.1%
if -4.99999999999999995e238 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999996e-300 or 4.99999999999999992e-262 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e303Initial program 91.4%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.4
Applied rewrites91.4%
Taylor expanded in x around 0
Applied rewrites76.9%
if -4.99999999999999996e-300 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.99999999999999992e-262Initial program 7.7%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites77.9%
if 1e303 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 83.7%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6487.8
Applied rewrites87.8%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6488.2
Applied rewrites88.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ t (- a z)) (- y z) x))
(t_2 (/ (- t x) (- a z)))
(t_3 (+ x (* (- y z) t_2))))
(if (<= t_3 -5e+238)
(+ x (* y t_2))
(if (<= t_3 -5e-300)
t_1
(if (<= t_3 5e-262)
t
(if (<= t_3 1e+303) t_1 (* (- t x) (/ y (- a z)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t / (a - z)), (y - z), x);
double t_2 = (t - x) / (a - z);
double t_3 = x + ((y - z) * t_2);
double tmp;
if (t_3 <= -5e+238) {
tmp = x + (y * t_2);
} else if (t_3 <= -5e-300) {
tmp = t_1;
} else if (t_3 <= 5e-262) {
tmp = t;
} else if (t_3 <= 1e+303) {
tmp = t_1;
} else {
tmp = (t - x) * (y / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t / Float64(a - z)), Float64(y - z), x) t_2 = Float64(Float64(t - x) / Float64(a - z)) t_3 = Float64(x + Float64(Float64(y - z) * t_2)) tmp = 0.0 if (t_3 <= -5e+238) tmp = Float64(x + Float64(y * t_2)); elseif (t_3 <= -5e-300) tmp = t_1; elseif (t_3 <= 5e-262) tmp = t; elseif (t_3 <= 1e+303) tmp = t_1; else tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+238], N[(x + N[(y * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -5e-300], t$95$1, If[LessEqual[t$95$3, 5e-262], t, If[LessEqual[t$95$3, 1e+303], t$95$1, N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t}{a - z}, y - z, x\right)\\
t_2 := \frac{t - x}{a - z}\\
t_3 := x + \left(y - z\right) \cdot t\_2\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{+238}:\\
\;\;\;\;x + y \cdot t\_2\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-300}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{-262}:\\
\;\;\;\;t\\
\mathbf{elif}\;t\_3 \leq 10^{+303}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999995e238Initial program 90.7%
Taylor expanded in y around inf
Applied rewrites78.1%
if -4.99999999999999995e238 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999996e-300 or 4.99999999999999992e-262 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1e303Initial program 91.4%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6491.4
Applied rewrites91.4%
Taylor expanded in x around 0
Applied rewrites76.9%
if -4.99999999999999996e-300 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 4.99999999999999992e-262Initial program 7.7%
Taylor expanded in z around inf
Applied rewrites37.5%
if 1e303 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 83.7%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6487.8
Applied rewrites87.8%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6488.2
Applied rewrites88.2%
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.6e+96)
(* (/ (- t x) (- a z)) y)
(if (<= y 9.2e+98)
(fma (/ t (- a z)) (- y z) x)
(* (- t x) (/ y (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.6e+96) {
tmp = ((t - x) / (a - z)) * y;
} else if (y <= 9.2e+98) {
tmp = fma((t / (a - z)), (y - z), x);
} else {
tmp = (t - x) * (y / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.6e+96) tmp = Float64(Float64(Float64(t - x) / Float64(a - z)) * y); elseif (y <= 9.2e+98) tmp = fma(Float64(t / Float64(a - z)), Float64(y - z), x); else tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.6e+96], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 9.2e+98], N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+96}:\\
\;\;\;\;\frac{t - x}{a - z} \cdot y\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{+98}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a - z}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if y < -1.60000000000000003e96Initial program 88.9%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6464.2
Applied rewrites64.2%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6477.9
Applied rewrites77.9%
if -1.60000000000000003e96 < y < 9.20000000000000053e98Initial program 75.2%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6475.3
Applied rewrites75.3%
Taylor expanded in x around 0
Applied rewrites67.8%
if 9.20000000000000053e98 < y Initial program 89.4%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6464.9
Applied rewrites64.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6480.4
Applied rewrites80.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (- t x) (/ (- y z) a) x))) (if (<= a -5.5e-92) t_1 (if (<= a 4.4e-34) (* (- t x) (/ y (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t - x), ((y - z) / a), x);
double tmp;
if (a <= -5.5e-92) {
tmp = t_1;
} else if (a <= 4.4e-34) {
tmp = (t - x) * (y / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t - x), Float64(Float64(y - z) / a), x) tmp = 0.0 if (a <= -5.5e-92) tmp = t_1; elseif (a <= 4.4e-34) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -5.5e-92], t$95$1, If[LessEqual[a, 4.4e-34], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{if}\;a \leq -5.5 \cdot 10^{-92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4.4 \cdot 10^{-34}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.5000000000000002e-92 or 4.3999999999999998e-34 < a Initial program 86.0%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6469.0
Applied rewrites69.0%
if -5.5000000000000002e-92 < a < 4.3999999999999998e-34Initial program 71.1%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6453.9
Applied rewrites53.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6457.4
Applied rewrites57.4%
(FPCore (x y z t a) :precision binary64 (if (<= y -8e+95) (* (/ (- t x) (- a z)) y) (if (<= y 1.8e+98) (fma (/ t (- a z)) (- z) x) (* (- t x) (/ y (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -8e+95) {
tmp = ((t - x) / (a - z)) * y;
} else if (y <= 1.8e+98) {
tmp = fma((t / (a - z)), -z, x);
} else {
tmp = (t - x) * (y / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (y <= -8e+95) tmp = Float64(Float64(Float64(t - x) / Float64(a - z)) * y); elseif (y <= 1.8e+98) tmp = fma(Float64(t / Float64(a - z)), Float64(-z), x); else tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -8e+95], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 1.8e+98], N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * (-z) + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+95}:\\
\;\;\;\;\frac{t - x}{a - z} \cdot y\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+98}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a - z}, -z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if y < -8.00000000000000016e95Initial program 88.9%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6464.2
Applied rewrites64.2%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6477.9
Applied rewrites77.9%
if -8.00000000000000016e95 < y < 1.7999999999999999e98Initial program 75.2%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f6475.3
Applied rewrites75.3%
Taylor expanded in x around 0
Applied rewrites67.8%
Taylor expanded in y around 0
mul-1-negN/A
lift-neg.f6457.6
Applied rewrites57.6%
if 1.7999999999999999e98 < y Initial program 89.4%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6464.9
Applied rewrites64.9%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6480.4
Applied rewrites80.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.65e+173)
t
(if (<= z -1.02e-60)
(* (/ (- t x) (- a z)) y)
(if (<= z 1.76e+31) (fma (- t x) (/ y a) x) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.65e+173) {
tmp = t;
} else if (z <= -1.02e-60) {
tmp = ((t - x) / (a - z)) * y;
} else if (z <= 1.76e+31) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.65e+173) tmp = t; elseif (z <= -1.02e-60) tmp = Float64(Float64(Float64(t - x) / Float64(a - z)) * y); elseif (z <= 1.76e+31) tmp = fma(Float64(t - x), Float64(y / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.65e+173], t, If[LessEqual[z, -1.02e-60], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 1.76e+31], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+173}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-60}:\\
\;\;\;\;\frac{t - x}{a - z} \cdot y\\
\mathbf{elif}\;z \leq 1.76 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -1.64999999999999998e173 or 1.76e31 < z Initial program 62.6%
Taylor expanded in z around inf
Applied rewrites48.6%
if -1.64999999999999998e173 < z < -1.01999999999999994e-60Initial program 81.7%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6437.1
Applied rewrites37.1%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6442.8
Applied rewrites42.8%
if -1.01999999999999994e-60 < z < 1.76e31Initial program 91.6%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6478.5
Applied rewrites78.5%
Taylor expanded in y around inf
Applied rewrites75.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.65e+173)
t
(if (<= z -1.02e-60)
(* (- t x) (/ y (- a z)))
(if (<= z 1.76e+31) (fma (- t x) (/ y a) x) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.65e+173) {
tmp = t;
} else if (z <= -1.02e-60) {
tmp = (t - x) * (y / (a - z));
} else if (z <= 1.76e+31) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.65e+173) tmp = t; elseif (z <= -1.02e-60) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); elseif (z <= 1.76e+31) tmp = fma(Float64(t - x), Float64(y / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.65e+173], t, If[LessEqual[z, -1.02e-60], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.76e+31], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+173}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-60}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{elif}\;z \leq 1.76 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -1.64999999999999998e173 or 1.76e31 < z Initial program 62.6%
Taylor expanded in z around inf
Applied rewrites48.6%
if -1.64999999999999998e173 < z < -1.01999999999999994e-60Initial program 81.7%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6437.1
Applied rewrites37.1%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6443.3
Applied rewrites43.3%
if -1.01999999999999994e-60 < z < 1.76e31Initial program 91.6%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6478.5
Applied rewrites78.5%
Taylor expanded in y around inf
Applied rewrites75.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.2e+115)
t
(if (<= z -1.7e-60)
(* (- t x) (/ (- y) z))
(if (<= z 1.76e+31) (fma (- t x) (/ y a) x) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.2e+115) {
tmp = t;
} else if (z <= -1.7e-60) {
tmp = (t - x) * (-y / z);
} else if (z <= 1.76e+31) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.2e+115) tmp = t; elseif (z <= -1.7e-60) tmp = Float64(Float64(t - x) * Float64(Float64(-y) / z)); elseif (z <= 1.76e+31) tmp = fma(Float64(t - x), Float64(y / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.2e+115], t, If[LessEqual[z, -1.7e-60], N[(N[(t - x), $MachinePrecision] * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.76e+31], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+115}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{-60}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{-y}{z}\\
\mathbf{elif}\;z \leq 1.76 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.2e115 or 1.76e31 < z Initial program 64.0%
Taylor expanded in z around inf
Applied rewrites47.6%
if -3.2e115 < z < -1.70000000000000003e-60Initial program 84.6%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6441.0
Applied rewrites41.0%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6446.2
Applied rewrites46.2%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6433.4
Applied rewrites33.4%
if -1.70000000000000003e-60 < z < 1.76e31Initial program 91.6%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6478.5
Applied rewrites78.5%
Taylor expanded in y around inf
Applied rewrites75.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.2e+115)
t
(if (<= z -1.7e-60)
(* (- t x) (/ (- y) z))
(if (<= z 1.76e+31) (fma y (/ (- t x) a) x) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.2e+115) {
tmp = t;
} else if (z <= -1.7e-60) {
tmp = (t - x) * (-y / z);
} else if (z <= 1.76e+31) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.2e+115) tmp = t; elseif (z <= -1.7e-60) tmp = Float64(Float64(t - x) * Float64(Float64(-y) / z)); elseif (z <= 1.76e+31) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.2e+115], t, If[LessEqual[z, -1.7e-60], N[(N[(t - x), $MachinePrecision] * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.76e+31], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+115}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{-60}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{-y}{z}\\
\mathbf{elif}\;z \leq 1.76 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.2e115 or 1.76e31 < z Initial program 64.0%
Taylor expanded in z around inf
Applied rewrites47.6%
if -3.2e115 < z < -1.70000000000000003e-60Initial program 84.6%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6441.0
Applied rewrites41.0%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6446.2
Applied rewrites46.2%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6433.4
Applied rewrites33.4%
if -1.70000000000000003e-60 < z < 1.76e31Initial program 91.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.6
Applied rewrites73.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- t x) (/ (- y) z))))
(if (<= z -3.2e+115)
t
(if (<= z -1.02e-60)
t_1
(if (<= z -6.2e-200)
x
(if (<= z 4.2e-181)
(* (- t x) (/ y a))
(if (<= z 5.2e-98) x (if (<= z 8.5e+20) t_1 t))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) * (-y / z);
double tmp;
if (z <= -3.2e+115) {
tmp = t;
} else if (z <= -1.02e-60) {
tmp = t_1;
} else if (z <= -6.2e-200) {
tmp = x;
} else if (z <= 4.2e-181) {
tmp = (t - x) * (y / a);
} else if (z <= 5.2e-98) {
tmp = x;
} else if (z <= 8.5e+20) {
tmp = t_1;
} else {
tmp = 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 = (t - x) * (-y / z)
if (z <= (-3.2d+115)) then
tmp = t
else if (z <= (-1.02d-60)) then
tmp = t_1
else if (z <= (-6.2d-200)) then
tmp = x
else if (z <= 4.2d-181) then
tmp = (t - x) * (y / a)
else if (z <= 5.2d-98) then
tmp = x
else if (z <= 8.5d+20) then
tmp = t_1
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) * (-y / z);
double tmp;
if (z <= -3.2e+115) {
tmp = t;
} else if (z <= -1.02e-60) {
tmp = t_1;
} else if (z <= -6.2e-200) {
tmp = x;
} else if (z <= 4.2e-181) {
tmp = (t - x) * (y / a);
} else if (z <= 5.2e-98) {
tmp = x;
} else if (z <= 8.5e+20) {
tmp = t_1;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t - x) * (-y / z) tmp = 0 if z <= -3.2e+115: tmp = t elif z <= -1.02e-60: tmp = t_1 elif z <= -6.2e-200: tmp = x elif z <= 4.2e-181: tmp = (t - x) * (y / a) elif z <= 5.2e-98: tmp = x elif z <= 8.5e+20: tmp = t_1 else: tmp = t return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) * Float64(Float64(-y) / z)) tmp = 0.0 if (z <= -3.2e+115) tmp = t; elseif (z <= -1.02e-60) tmp = t_1; elseif (z <= -6.2e-200) tmp = x; elseif (z <= 4.2e-181) tmp = Float64(Float64(t - x) * Float64(y / a)); elseif (z <= 5.2e-98) tmp = x; elseif (z <= 8.5e+20) tmp = t_1; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t - x) * (-y / z); tmp = 0.0; if (z <= -3.2e+115) tmp = t; elseif (z <= -1.02e-60) tmp = t_1; elseif (z <= -6.2e-200) tmp = x; elseif (z <= 4.2e-181) tmp = (t - x) * (y / a); elseif (z <= 5.2e-98) tmp = x; elseif (z <= 8.5e+20) tmp = t_1; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * N[((-y) / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e+115], t, If[LessEqual[z, -1.02e-60], t$95$1, If[LessEqual[z, -6.2e-200], x, If[LessEqual[z, 4.2e-181], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e-98], x, If[LessEqual[z, 8.5e+20], t$95$1, t]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot \frac{-y}{z}\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+115}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{-200}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-181}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a}\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-98}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.2e115 or 8.5e20 < z Initial program 64.3%
Taylor expanded in z around inf
Applied rewrites47.0%
if -3.2e115 < z < -1.01999999999999994e-60 or 5.20000000000000027e-98 < z < 8.5e20Initial program 87.0%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6443.4
Applied rewrites43.4%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6447.5
Applied rewrites47.5%
Taylor expanded in z around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6432.9
Applied rewrites32.9%
if -1.01999999999999994e-60 < z < -6.1999999999999998e-200 or 4.20000000000000006e-181 < z < 5.20000000000000027e-98Initial program 90.7%
Taylor expanded in a around inf
Applied rewrites34.3%
if -6.1999999999999998e-200 < z < 4.20000000000000006e-181Initial program 93.5%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in z around 0
Applied rewrites50.8%
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f6453.5
Applied rewrites53.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -8.5e-49)
t
(if (<= z -6.2e-200)
x
(if (<= z 4.2e-181)
(* (- t x) (/ y a))
(if (<= z 8.5e-46) x (if (<= z 5e+27) (* (/ (- y z) a) t) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.5e-49) {
tmp = t;
} else if (z <= -6.2e-200) {
tmp = x;
} else if (z <= 4.2e-181) {
tmp = (t - x) * (y / a);
} else if (z <= 8.5e-46) {
tmp = x;
} else if (z <= 5e+27) {
tmp = ((y - z) / a) * t;
} else {
tmp = 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) :: tmp
if (z <= (-8.5d-49)) then
tmp = t
else if (z <= (-6.2d-200)) then
tmp = x
else if (z <= 4.2d-181) then
tmp = (t - x) * (y / a)
else if (z <= 8.5d-46) then
tmp = x
else if (z <= 5d+27) then
tmp = ((y - z) / a) * t
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.5e-49) {
tmp = t;
} else if (z <= -6.2e-200) {
tmp = x;
} else if (z <= 4.2e-181) {
tmp = (t - x) * (y / a);
} else if (z <= 8.5e-46) {
tmp = x;
} else if (z <= 5e+27) {
tmp = ((y - z) / a) * t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8.5e-49: tmp = t elif z <= -6.2e-200: tmp = x elif z <= 4.2e-181: tmp = (t - x) * (y / a) elif z <= 8.5e-46: tmp = x elif z <= 5e+27: tmp = ((y - z) / a) * t else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8.5e-49) tmp = t; elseif (z <= -6.2e-200) tmp = x; elseif (z <= 4.2e-181) tmp = Float64(Float64(t - x) * Float64(y / a)); elseif (z <= 8.5e-46) tmp = x; elseif (z <= 5e+27) tmp = Float64(Float64(Float64(y - z) / a) * t); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -8.5e-49) tmp = t; elseif (z <= -6.2e-200) tmp = x; elseif (z <= 4.2e-181) tmp = (t - x) * (y / a); elseif (z <= 8.5e-46) tmp = x; elseif (z <= 5e+27) tmp = ((y - z) / a) * t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8.5e-49], t, If[LessEqual[z, -6.2e-200], x, If[LessEqual[z, 4.2e-181], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e-46], x, If[LessEqual[z, 5e+27], N[(N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] * t), $MachinePrecision], t]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-49}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{-200}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-181}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a}\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-46}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+27}:\\
\;\;\;\;\frac{y - z}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -8.50000000000000069e-49 or 4.99999999999999979e27 < z Initial program 69.2%
Taylor expanded in z around inf
Applied rewrites41.3%
if -8.50000000000000069e-49 < z < -6.1999999999999998e-200 or 4.20000000000000006e-181 < z < 8.5000000000000001e-46Initial program 90.9%
Taylor expanded in a around inf
Applied rewrites34.2%
if -6.1999999999999998e-200 < z < 4.20000000000000006e-181Initial program 93.5%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6455.7
Applied rewrites55.7%
Taylor expanded in z around 0
Applied rewrites50.8%
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f6453.5
Applied rewrites53.5%
if 8.5000000000000001e-46 < z < 4.99999999999999979e27Initial program 88.7%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6453.4
Applied rewrites53.4%
Taylor expanded in x around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6422.8
Applied rewrites22.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- y z) a) t)))
(if (<= z -8.5e-49)
t
(if (<= z -2.05e-206)
x
(if (<= z 1.86e-190)
t_1
(if (<= z 8.5e-46) x (if (<= z 5e+27) t_1 t)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y - z) / a) * t;
double tmp;
if (z <= -8.5e-49) {
tmp = t;
} else if (z <= -2.05e-206) {
tmp = x;
} else if (z <= 1.86e-190) {
tmp = t_1;
} else if (z <= 8.5e-46) {
tmp = x;
} else if (z <= 5e+27) {
tmp = t_1;
} else {
tmp = 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 = ((y - z) / a) * t
if (z <= (-8.5d-49)) then
tmp = t
else if (z <= (-2.05d-206)) then
tmp = x
else if (z <= 1.86d-190) then
tmp = t_1
else if (z <= 8.5d-46) then
tmp = x
else if (z <= 5d+27) then
tmp = t_1
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y - z) / a) * t;
double tmp;
if (z <= -8.5e-49) {
tmp = t;
} else if (z <= -2.05e-206) {
tmp = x;
} else if (z <= 1.86e-190) {
tmp = t_1;
} else if (z <= 8.5e-46) {
tmp = x;
} else if (z <= 5e+27) {
tmp = t_1;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y - z) / a) * t tmp = 0 if z <= -8.5e-49: tmp = t elif z <= -2.05e-206: tmp = x elif z <= 1.86e-190: tmp = t_1 elif z <= 8.5e-46: tmp = x elif z <= 5e+27: tmp = t_1 else: tmp = t return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y - z) / a) * t) tmp = 0.0 if (z <= -8.5e-49) tmp = t; elseif (z <= -2.05e-206) tmp = x; elseif (z <= 1.86e-190) tmp = t_1; elseif (z <= 8.5e-46) tmp = x; elseif (z <= 5e+27) tmp = t_1; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y - z) / a) * t; tmp = 0.0; if (z <= -8.5e-49) tmp = t; elseif (z <= -2.05e-206) tmp = x; elseif (z <= 1.86e-190) tmp = t_1; elseif (z <= 8.5e-46) tmp = x; elseif (z <= 5e+27) tmp = t_1; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -8.5e-49], t, If[LessEqual[z, -2.05e-206], x, If[LessEqual[z, 1.86e-190], t$95$1, If[LessEqual[z, 8.5e-46], x, If[LessEqual[z, 5e+27], t$95$1, t]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{a} \cdot t\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{-49}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -2.05 \cdot 10^{-206}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.86 \cdot 10^{-190}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-46}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -8.50000000000000069e-49 or 4.99999999999999979e27 < z Initial program 69.2%
Taylor expanded in z around inf
Applied rewrites41.3%
if -8.50000000000000069e-49 < z < -2.05000000000000008e-206 or 1.86000000000000011e-190 < z < 8.5000000000000001e-46Initial program 91.1%
Taylor expanded in a around inf
Applied rewrites34.6%
if -2.05000000000000008e-206 < z < 1.86000000000000011e-190 or 8.5000000000000001e-46 < z < 4.99999999999999979e27Initial program 92.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6482.0
Applied rewrites82.0%
Taylor expanded in x around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6433.1
Applied rewrites33.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.25e+87) x (if (<= a 3.3e-83) t (if (<= a 1.75e+79) (/ (* (- x) y) a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.25e+87) {
tmp = x;
} else if (a <= 3.3e-83) {
tmp = t;
} else if (a <= 1.75e+79) {
tmp = (-x * y) / a;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-1.25d+87)) then
tmp = x
else if (a <= 3.3d-83) then
tmp = t
else if (a <= 1.75d+79) then
tmp = (-x * y) / a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.25e+87) {
tmp = x;
} else if (a <= 3.3e-83) {
tmp = t;
} else if (a <= 1.75e+79) {
tmp = (-x * y) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.25e+87: tmp = x elif a <= 3.3e-83: tmp = t elif a <= 1.75e+79: tmp = (-x * y) / a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.25e+87) tmp = x; elseif (a <= 3.3e-83) tmp = t; elseif (a <= 1.75e+79) tmp = Float64(Float64(Float64(-x) * y) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.25e+87) tmp = x; elseif (a <= 3.3e-83) tmp = t; elseif (a <= 1.75e+79) tmp = (-x * y) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.25e+87], x, If[LessEqual[a, 3.3e-83], t, If[LessEqual[a, 1.75e+79], N[(N[((-x) * y), $MachinePrecision] / a), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.25 \cdot 10^{+87}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 3.3 \cdot 10^{-83}:\\
\;\;\;\;t\\
\mathbf{elif}\;a \leq 1.75 \cdot 10^{+79}:\\
\;\;\;\;\frac{\left(-x\right) \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.24999999999999995e87 or 1.7499999999999999e79 < a Initial program 89.5%
Taylor expanded in a around inf
Applied rewrites49.1%
if -1.24999999999999995e87 < a < 3.2999999999999999e-83Initial program 73.3%
Taylor expanded in z around inf
Applied rewrites33.6%
if 3.2999999999999999e-83 < a < 1.7499999999999999e79Initial program 80.7%
Taylor expanded in y around inf
sub-divN/A
associate-/l*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6444.5
Applied rewrites44.5%
Taylor expanded in z around 0
Applied rewrites32.8%
Taylor expanded in x around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6417.3
Applied rewrites17.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.25e+87) x (if (<= a 1.9e-11) t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.25e+87) {
tmp = x;
} else if (a <= 1.9e-11) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-1.25d+87)) then
tmp = x
else if (a <= 1.9d-11) then
tmp = t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.25e+87) {
tmp = x;
} else if (a <= 1.9e-11) {
tmp = t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.25e+87: tmp = x elif a <= 1.9e-11: tmp = t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.25e+87) tmp = x; elseif (a <= 1.9e-11) tmp = t; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.25e+87) tmp = x; elseif (a <= 1.9e-11) tmp = t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.25e+87], x, If[LessEqual[a, 1.9e-11], t, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.25 \cdot 10^{+87}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.9 \cdot 10^{-11}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.24999999999999995e87 or 1.8999999999999999e-11 < a Initial program 88.2%
Taylor expanded in a around inf
Applied rewrites43.9%
if -1.24999999999999995e87 < a < 1.8999999999999999e-11Initial program 73.8%
Taylor expanded in z around inf
Applied rewrites32.9%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return 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 = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 80.1%
Taylor expanded in z around inf
Applied rewrites25.0%
herbie shell --seed 2025106
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:precision binary64
(+ x (* (- y z) (/ (- t x) (- a z)))))