
(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(Float64(y - z) * 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[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
Herbie found 18 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(Float64(y - z) * 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[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z))) (t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 (- INFINITY))
(+ (* (- y z) t_1) x)
(if (<= t_2 -1e-290)
t_2
(if (<= t_2 0.0)
(+ (- (* x (fma -1.0 (/ (- y a) z) (/ (* t (- y a)) (* x z))))) t)
(if (<= t_2 2e+278) t_2 (fma (- y z) t_1 x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = ((y - z) * t_1) + x;
} else if (t_2 <= -1e-290) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = -(x * fma(-1.0, ((y - a) / z), ((t * (y - a)) / (x * z)))) + t;
} else if (t_2 <= 2e+278) {
tmp = t_2;
} else {
tmp = fma((y - z), t_1, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(Float64(y - z) * t_1) + x); elseif (t_2 <= -1e-290) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(Float64(-Float64(x * fma(-1.0, Float64(Float64(y - a) / z), Float64(Float64(t * Float64(y - a)) / Float64(x * z))))) + t); elseif (t_2 <= 2e+278) tmp = t_2; else tmp = fma(Float64(y - z), t_1, x); 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[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, -1e-290], t$95$2, If[LessEqual[t$95$2, 0.0], N[((-N[(x * N[(-1.0 * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + N[(N[(t * N[(y - a), $MachinePrecision]), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + t), $MachinePrecision], If[LessEqual[t$95$2, 2e+278], t$95$2, N[(N[(y - z), $MachinePrecision] * t$95$1 + x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\left(y - z\right) \cdot t\_1 + x\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-290}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\left(-x \cdot \mathsf{fma}\left(-1, \frac{y - a}{z}, \frac{t \cdot \left(y - a\right)}{x \cdot z}\right)\right) + t\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+278}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, t\_1, x\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -1.0000000000000001e-290 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.99999999999999993e278Initial program 68.1%
if -1.0000000000000001e-290 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in x around inf
lower-*.f64N/A
sub-divN/A
lower-fma.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f6444.4
Applied rewrites44.4%
if 1.99999999999999993e278 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t x) (- a z))) (t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 (- INFINITY))
(+ (* (- y z) t_1) x)
(if (<= t_2 -1e-290)
t_2
(if (<= t_2 0.0)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(if (<= t_2 2e+278) t_2 (fma (- y z) t_1 x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = ((y - z) * t_1) + x;
} else if (t_2 <= -1e-290) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else if (t_2 <= 2e+278) {
tmp = t_2;
} else {
tmp = fma((y - z), t_1, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(Float64(y - z) * t_1) + x); elseif (t_2 <= -1e-290) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); elseif (t_2 <= 2e+278) tmp = t_2; else tmp = fma(Float64(y - z), t_1, x); 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[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, -1e-290], t$95$2, If[LessEqual[t$95$2, 0.0], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], If[LessEqual[t$95$2, 2e+278], t$95$2, N[(N[(y - z), $MachinePrecision] * t$95$1 + x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\left(y - z\right) \cdot t\_1 + x\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-290}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+278}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, t\_1, x\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -1.0000000000000001e-290 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.99999999999999993e278Initial program 68.1%
if -1.0000000000000001e-290 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
if 1.99999999999999993e278 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ (- t x) (- a z)) x))
(t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e-290)
t_2
(if (<= t_2 0.0)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(if (<= t_2 2e+278) t_2 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), ((t - x) / (a - z)), x);
double t_2 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -1e-290) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else if (t_2 <= 2e+278) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x) t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -1e-290) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); elseif (t_2 <= 2e+278) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e-290], t$95$2, If[LessEqual[t$95$2, 0.0], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], If[LessEqual[t$95$2, 2e+278], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-290}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+278}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0 or 1.99999999999999993e278 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -1.0000000000000001e-290 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.99999999999999993e278Initial program 68.1%
if -1.0000000000000001e-290 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (- (+ 1.0 (+ (/ a z) (/ (* x (- y a)) (* t z)))) (/ y z)))))
(if (<= z -3.8e+262)
t_1
(if (<= z 1.05e+208) (+ (* (- y z) (/ (- t x) (- a z))) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * ((1.0 + ((a / z) + ((x * (y - a)) / (t * z)))) - (y / z));
double tmp;
if (z <= -3.8e+262) {
tmp = t_1;
} else if (z <= 1.05e+208) {
tmp = ((y - z) * ((t - x) / (a - z))) + x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = t * ((1.0d0 + ((a / z) + ((x * (y - a)) / (t * z)))) - (y / z))
if (z <= (-3.8d+262)) then
tmp = t_1
else if (z <= 1.05d+208) then
tmp = ((y - z) * ((t - x) / (a - z))) + x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t * ((1.0 + ((a / z) + ((x * (y - a)) / (t * z)))) - (y / z));
double tmp;
if (z <= -3.8e+262) {
tmp = t_1;
} else if (z <= 1.05e+208) {
tmp = ((y - z) * ((t - x) / (a - z))) + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t * ((1.0 + ((a / z) + ((x * (y - a)) / (t * z)))) - (y / z)) tmp = 0 if z <= -3.8e+262: tmp = t_1 elif z <= 1.05e+208: tmp = ((y - z) * ((t - x) / (a - z))) + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(t * Float64(Float64(1.0 + Float64(Float64(a / z) + Float64(Float64(x * Float64(y - a)) / Float64(t * z)))) - Float64(y / z))) tmp = 0.0 if (z <= -3.8e+262) tmp = t_1; elseif (z <= 1.05e+208) tmp = Float64(Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))) + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t * ((1.0 + ((a / z) + ((x * (y - a)) / (t * z)))) - (y / z)); tmp = 0.0; if (z <= -3.8e+262) tmp = t_1; elseif (z <= 1.05e+208) tmp = ((y - z) * ((t - x) / (a - z))) + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(1.0 + N[(N[(a / z), $MachinePrecision] + N[(N[(x * N[(y - a), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.8e+262], t$95$1, If[LessEqual[z, 1.05e+208], N[(N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(\left(1 + \left(\frac{a}{z} + \frac{x \cdot \left(y - a\right)}{t \cdot z}\right)\right) - \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{+262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+208}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{t - x}{a - z} + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.80000000000000034e262 or 1.0499999999999999e208 < z Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f64N/A
lower-*.f64N/A
lower-/.f6444.2
Applied rewrites44.2%
if -3.80000000000000034e262 < z < 1.0499999999999999e208Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
(FPCore (x y z t a) :precision binary64 (if (<= z 3.2e+187) (fma (- y z) (/ (- t x) (- a z)) x) (- t (/ (* y (- t x)) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 3.2e+187) {
tmp = fma((y - z), ((t - x) / (a - z)), x);
} else {
tmp = t - ((y * (t - x)) / z);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= 3.2e+187) tmp = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x); else tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 3.2e+187], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.2 \cdot 10^{+187}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\end{array}
\end{array}
if z < 3.19999999999999993e187Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
if 3.19999999999999993e187 < z Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.2
Applied rewrites44.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ t (- a z))))
(if (<= a -2.45e-42)
(fma (- y z) t_1 x)
(if (<= a 1.08e-5)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(+ (* (- y z) t_1) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t / (a - z);
double tmp;
if (a <= -2.45e-42) {
tmp = fma((y - z), t_1, x);
} else if (a <= 1.08e-5) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else {
tmp = ((y - z) * t_1) + x;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t / Float64(a - z)) tmp = 0.0 if (a <= -2.45e-42) tmp = fma(Float64(y - z), t_1, x); elseif (a <= 1.08e-5) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); else tmp = Float64(Float64(Float64(y - z) * t_1) + x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.45e-42], N[(N[(y - z), $MachinePrecision] * t$95$1 + x), $MachinePrecision], If[LessEqual[a, 1.08e-5], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{a - z}\\
\mathbf{if}\;a \leq -2.45 \cdot 10^{-42}:\\
\;\;\;\;\mathsf{fma}\left(y - z, t\_1, x\right)\\
\mathbf{elif}\;a \leq 1.08 \cdot 10^{-5}:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\_1 + x\\
\end{array}
\end{array}
if a < -2.45e-42Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
Taylor expanded in x around 0
lower-/.f64N/A
lift--.f6464.1
Applied rewrites64.1%
if -2.45e-42 < a < 1.07999999999999999e-5Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
if 1.07999999999999999e-5 < a Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
Taylor expanded in x around 0
Applied rewrites64.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ t (- a z))))
(if (<= a -2.45e-42)
(fma (- y z) t_1 x)
(if (<= a 3.7e-181)
(- t (/ (* y (- t x)) z))
(if (<= a 3.6e-113)
(+ x (/ (* (- t x) y) (- a z)))
(+ (* (- y z) t_1) x))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t / (a - z);
double tmp;
if (a <= -2.45e-42) {
tmp = fma((y - z), t_1, x);
} else if (a <= 3.7e-181) {
tmp = t - ((y * (t - x)) / z);
} else if (a <= 3.6e-113) {
tmp = x + (((t - x) * y) / (a - z));
} else {
tmp = ((y - z) * t_1) + x;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t / Float64(a - z)) tmp = 0.0 if (a <= -2.45e-42) tmp = fma(Float64(y - z), t_1, x); elseif (a <= 3.7e-181) tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); elseif (a <= 3.6e-113) tmp = Float64(x + Float64(Float64(Float64(t - x) * y) / Float64(a - z))); else tmp = Float64(Float64(Float64(y - z) * t_1) + x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.45e-42], N[(N[(y - z), $MachinePrecision] * t$95$1 + x), $MachinePrecision], If[LessEqual[a, 3.7e-181], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.6e-113], N[(x + N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision] + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{a - z}\\
\mathbf{if}\;a \leq -2.45 \cdot 10^{-42}:\\
\;\;\;\;\mathsf{fma}\left(y - z, t\_1, x\right)\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{-181}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{elif}\;a \leq 3.6 \cdot 10^{-113}:\\
\;\;\;\;x + \frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\_1 + x\\
\end{array}
\end{array}
if a < -2.45e-42Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
Taylor expanded in x around 0
lower-/.f64N/A
lift--.f6464.1
Applied rewrites64.1%
if -2.45e-42 < a < 3.69999999999999984e-181Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.2
Applied rewrites44.2%
if 3.69999999999999984e-181 < a < 3.59999999999999975e-113Initial program 68.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6455.6
Applied rewrites55.6%
if 3.59999999999999975e-113 < a Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
Taylor expanded in x around 0
Applied rewrites64.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ t (- a z)) x)))
(if (<= a -2.45e-42)
t_1
(if (<= a 3.7e-181)
(- t (/ (* y (- t x)) z))
(if (<= a 3.6e-113) (+ x (/ (* (- t x) y) (- a z))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), (t / (a - z)), x);
double tmp;
if (a <= -2.45e-42) {
tmp = t_1;
} else if (a <= 3.7e-181) {
tmp = t - ((y * (t - x)) / z);
} else if (a <= 3.6e-113) {
tmp = x + (((t - x) * y) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(t / Float64(a - z)), x) tmp = 0.0 if (a <= -2.45e-42) tmp = t_1; elseif (a <= 3.7e-181) tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); elseif (a <= 3.6e-113) tmp = Float64(x + Float64(Float64(Float64(t - x) * y) / Float64(a - z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2.45e-42], t$95$1, If[LessEqual[a, 3.7e-181], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.6e-113], N[(x + N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)\\
\mathbf{if}\;a \leq -2.45 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{-181}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{elif}\;a \leq 3.6 \cdot 10^{-113}:\\
\;\;\;\;x + \frac{\left(t - x\right) \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.45e-42 or 3.59999999999999975e-113 < a Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
Taylor expanded in x around 0
lower-/.f64N/A
lift--.f6464.1
Applied rewrites64.1%
if -2.45e-42 < a < 3.69999999999999984e-181Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.2
Applied rewrites44.2%
if 3.69999999999999984e-181 < a < 3.59999999999999975e-113Initial program 68.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lift--.f6455.6
Applied rewrites55.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ t (- a z)) x)))
(if (<= a -2.45e-42)
t_1
(if (<= a 2.3e-115) (- t (/ (* y (- t x)) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), (t / (a - z)), x);
double tmp;
if (a <= -2.45e-42) {
tmp = t_1;
} else if (a <= 2.3e-115) {
tmp = t - ((y * (t - x)) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(t / Float64(a - z)), x) tmp = 0.0 if (a <= -2.45e-42) tmp = t_1; elseif (a <= 2.3e-115) tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2.45e-42], t$95$1, If[LessEqual[a, 2.3e-115], N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)\\
\mathbf{if}\;a \leq -2.45 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{-115}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.45e-42 or 2.29999999999999985e-115 < a Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
Taylor expanded in x around 0
lower-/.f64N/A
lift--.f6464.1
Applied rewrites64.1%
if -2.45e-42 < a < 2.29999999999999985e-115Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.2
Applied rewrites44.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (/ (- y z) (- a z)))))
(if (<= z -4.5e+50)
t_1
(if (<= z 1.5e-69)
(fma (- t x) (/ (- y z) a) x)
(if (<= z 1.8e+187) t_1 (- t (/ (* y (- t x)) z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * ((y - z) / (a - z));
double tmp;
if (z <= -4.5e+50) {
tmp = t_1;
} else if (z <= 1.5e-69) {
tmp = fma((t - x), ((y - z) / a), x);
} else if (z <= 1.8e+187) {
tmp = t_1;
} else {
tmp = t - ((y * (t - x)) / z);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t * Float64(Float64(y - z) / Float64(a - z))) tmp = 0.0 if (z <= -4.5e+50) tmp = t_1; elseif (z <= 1.5e-69) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); elseif (z <= 1.8e+187) tmp = t_1; else tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.5e+50], t$95$1, If[LessEqual[z, 1.5e-69], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.8e+187], t$95$1, N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y - z}{a - z}\\
\mathbf{if}\;z \leq -4.5 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-69}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+187}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\end{array}
\end{array}
if z < -4.50000000000000014e50 or 1.49999999999999995e-69 < z < 1.80000000000000018e187Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.5
Applied rewrites51.5%
if -4.50000000000000014e50 < z < 1.49999999999999995e-69Initial program 68.1%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6453.8
Applied rewrites53.8%
if 1.80000000000000018e187 < z Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.2
Applied rewrites44.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (/ (- y z) (- a z)))))
(if (<= z -1.8e+46)
t_1
(if (<= z 6.4e-103)
(+ (* y (/ (- t x) a)) x)
(if (<= z 1.8e+187) t_1 (- t (/ (* y (- t x)) z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * ((y - z) / (a - z));
double tmp;
if (z <= -1.8e+46) {
tmp = t_1;
} else if (z <= 6.4e-103) {
tmp = (y * ((t - x) / a)) + x;
} else if (z <= 1.8e+187) {
tmp = t_1;
} else {
tmp = t - ((y * (t - x)) / z);
}
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 * ((y - z) / (a - z))
if (z <= (-1.8d+46)) then
tmp = t_1
else if (z <= 6.4d-103) then
tmp = (y * ((t - x) / a)) + x
else if (z <= 1.8d+187) then
tmp = t_1
else
tmp = t - ((y * (t - x)) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t * ((y - z) / (a - z));
double tmp;
if (z <= -1.8e+46) {
tmp = t_1;
} else if (z <= 6.4e-103) {
tmp = (y * ((t - x) / a)) + x;
} else if (z <= 1.8e+187) {
tmp = t_1;
} else {
tmp = t - ((y * (t - x)) / z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t * ((y - z) / (a - z)) tmp = 0 if z <= -1.8e+46: tmp = t_1 elif z <= 6.4e-103: tmp = (y * ((t - x) / a)) + x elif z <= 1.8e+187: tmp = t_1 else: tmp = t - ((y * (t - x)) / z) return tmp
function code(x, y, z, t, a) t_1 = Float64(t * Float64(Float64(y - z) / Float64(a - z))) tmp = 0.0 if (z <= -1.8e+46) tmp = t_1; elseif (z <= 6.4e-103) tmp = Float64(Float64(y * Float64(Float64(t - x) / a)) + x); elseif (z <= 1.8e+187) tmp = t_1; else tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t * ((y - z) / (a - z)); tmp = 0.0; if (z <= -1.8e+46) tmp = t_1; elseif (z <= 6.4e-103) tmp = (y * ((t - x) / a)) + x; elseif (z <= 1.8e+187) tmp = t_1; else tmp = t - ((y * (t - x)) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.8e+46], t$95$1, If[LessEqual[z, 6.4e-103], N[(N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.8e+187], t$95$1, N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y - z}{a - z}\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-103}:\\
\;\;\;\;y \cdot \frac{t - x}{a} + x\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+187}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\end{array}
\end{array}
if z < -1.7999999999999999e46 or 6.39999999999999953e-103 < z < 1.80000000000000018e187Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.5
Applied rewrites51.5%
if -1.7999999999999999e46 < z < 6.39999999999999953e-103Initial program 68.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6448.1
Applied rewrites48.1%
lift-fma.f64N/A
lift--.f64N/A
lift-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6448.1
Applied rewrites48.1%
if 1.80000000000000018e187 < z Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.2
Applied rewrites44.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (/ (- y z) (- a z)))))
(if (<= z -1.8e+46)
t_1
(if (<= z 6.4e-103)
(fma y (/ (- t x) a) x)
(if (<= z 1.8e+187) t_1 (- t (/ (* y (- t x)) z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * ((y - z) / (a - z));
double tmp;
if (z <= -1.8e+46) {
tmp = t_1;
} else if (z <= 6.4e-103) {
tmp = fma(y, ((t - x) / a), x);
} else if (z <= 1.8e+187) {
tmp = t_1;
} else {
tmp = t - ((y * (t - x)) / z);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t * Float64(Float64(y - z) / Float64(a - z))) tmp = 0.0 if (z <= -1.8e+46) tmp = t_1; elseif (z <= 6.4e-103) tmp = fma(y, Float64(Float64(t - x) / a), x); elseif (z <= 1.8e+187) tmp = t_1; else tmp = Float64(t - Float64(Float64(y * Float64(t - x)) / z)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.8e+46], t$95$1, If[LessEqual[z, 6.4e-103], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.8e+187], t$95$1, N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y - z}{a - z}\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-103}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+187}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t - \frac{y \cdot \left(t - x\right)}{z}\\
\end{array}
\end{array}
if z < -1.7999999999999999e46 or 6.39999999999999953e-103 < z < 1.80000000000000018e187Initial program 68.1%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-/l*N/A
sub-divN/A
lower-*.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6480.1
Applied rewrites80.1%
Taylor expanded in t around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6451.5
Applied rewrites51.5%
if -1.7999999999999999e46 < z < 6.39999999999999953e-103Initial program 68.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6448.1
Applied rewrites48.1%
if 1.80000000000000018e187 < z Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.2
Applied rewrites44.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- t (/ (* y (- t x)) z)))) (if (<= z -1.12e+67) t_1 (if (<= z 0.00182) (fma y (/ (- t x) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - ((y * (t - x)) / z);
double tmp;
if (z <= -1.12e+67) {
tmp = t_1;
} else if (z <= 0.00182) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(y * Float64(t - x)) / z)) tmp = 0.0 if (z <= -1.12e+67) tmp = t_1; elseif (z <= 0.00182) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.12e+67], t$95$1, If[LessEqual[z, 0.00182], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{y \cdot \left(t - x\right)}{z}\\
\mathbf{if}\;z \leq -1.12 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.00182:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.12e67 or 0.00182 < z Initial program 68.1%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lower--.f6446.2
Applied rewrites46.2%
Taylor expanded in a around 0
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift--.f6444.2
Applied rewrites44.2%
if -1.12e67 < z < 0.00182Initial program 68.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6448.1
Applied rewrites48.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.65e+53) (* t 1.0) (if (<= z 8.5e+42) (fma y (/ (- t x) a) x) (* t 1.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.65e+53) {
tmp = t * 1.0;
} else if (z <= 8.5e+42) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t * 1.0;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.65e+53) tmp = Float64(t * 1.0); elseif (z <= 8.5e+42) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = Float64(t * 1.0); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.65e+53], N[(t * 1.0), $MachinePrecision], If[LessEqual[z, 8.5e+42], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(t * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+53}:\\
\;\;\;\;t \cdot 1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+42}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot 1\\
\end{array}
\end{array}
if z < -1.6500000000000001e53 or 8.5000000000000003e42 < z Initial program 68.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.1%
Taylor expanded in t around inf
lower-*.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift--.f6442.4
Applied rewrites42.4%
Taylor expanded in z around inf
Applied rewrites25.2%
if -1.6500000000000001e53 < z < 8.5000000000000003e42Initial program 68.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6448.1
Applied rewrites48.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.6e+53) (* t 1.0) (if (<= z 8.5e+42) (fma y (/ t a) x) (* t 1.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e+53) {
tmp = t * 1.0;
} else if (z <= 8.5e+42) {
tmp = fma(y, (t / a), x);
} else {
tmp = t * 1.0;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.6e+53) tmp = Float64(t * 1.0); elseif (z <= 8.5e+42) tmp = fma(y, Float64(t / a), x); else tmp = Float64(t * 1.0); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.6e+53], N[(t * 1.0), $MachinePrecision], If[LessEqual[z, 8.5e+42], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(t * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+53}:\\
\;\;\;\;t \cdot 1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+42}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot 1\\
\end{array}
\end{array}
if z < -1.6e53 or 8.5000000000000003e42 < z Initial program 68.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.1%
Taylor expanded in t around inf
lower-*.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift--.f6442.4
Applied rewrites42.4%
Taylor expanded in z around inf
Applied rewrites25.2%
if -1.6e53 < z < 8.5000000000000003e42Initial program 68.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6448.1
Applied rewrites48.1%
Taylor expanded in x around 0
lower-/.f6439.9
Applied rewrites39.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.65e+36) (* t 1.0) (if (<= z 1.3e-69) (* 1.0 x) (* t 1.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.65e+36) {
tmp = t * 1.0;
} else if (z <= 1.3e-69) {
tmp = 1.0 * x;
} else {
tmp = t * 1.0;
}
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 <= (-2.65d+36)) then
tmp = t * 1.0d0
else if (z <= 1.3d-69) then
tmp = 1.0d0 * x
else
tmp = t * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.65e+36) {
tmp = t * 1.0;
} else if (z <= 1.3e-69) {
tmp = 1.0 * x;
} else {
tmp = t * 1.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.65e+36: tmp = t * 1.0 elif z <= 1.3e-69: tmp = 1.0 * x else: tmp = t * 1.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.65e+36) tmp = Float64(t * 1.0); elseif (z <= 1.3e-69) tmp = Float64(1.0 * x); else tmp = Float64(t * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.65e+36) tmp = t * 1.0; elseif (z <= 1.3e-69) tmp = 1.0 * x; else tmp = t * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.65e+36], N[(t * 1.0), $MachinePrecision], If[LessEqual[z, 1.3e-69], N[(1.0 * x), $MachinePrecision], N[(t * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+36}:\\
\;\;\;\;t \cdot 1\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-69}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t \cdot 1\\
\end{array}
\end{array}
if z < -2.65e36 or 1.3000000000000001e-69 < z Initial program 68.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.1%
Taylor expanded in t around inf
lower-*.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift--.f6442.4
Applied rewrites42.4%
Taylor expanded in z around inf
Applied rewrites25.2%
if -2.65e36 < z < 1.3000000000000001e-69Initial program 68.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.1%
Taylor expanded in a around inf
Applied rewrites25.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.62e+16) (+ x t) (if (<= a 1.4e-167) (* t 1.0) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.62e+16) {
tmp = x + t;
} else if (a <= 1.4e-167) {
tmp = t * 1.0;
} else {
tmp = x + 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 (a <= (-1.62d+16)) then
tmp = x + t
else if (a <= 1.4d-167) then
tmp = t * 1.0d0
else
tmp = x + t
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.62e+16) {
tmp = x + t;
} else if (a <= 1.4e-167) {
tmp = t * 1.0;
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.62e+16: tmp = x + t elif a <= 1.4e-167: tmp = t * 1.0 else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.62e+16) tmp = Float64(x + t); elseif (a <= 1.4e-167) tmp = Float64(t * 1.0); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.62e+16) tmp = x + t; elseif (a <= 1.4e-167) tmp = t * 1.0; else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.62e+16], N[(x + t), $MachinePrecision], If[LessEqual[a, 1.4e-167], N[(t * 1.0), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.62 \cdot 10^{+16}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;a \leq 1.4 \cdot 10^{-167}:\\
\;\;\;\;t \cdot 1\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if a < -1.62e16 or 1.39999999999999993e-167 < a Initial program 68.1%
Taylor expanded in z around inf
lift--.f6419.3
Applied rewrites19.3%
Taylor expanded in x around 0
Applied rewrites34.1%
if -1.62e16 < a < 1.39999999999999993e-167Initial program 68.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.1%
Taylor expanded in t around inf
lower-*.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lower-*.f64N/A
lift--.f6442.4
Applied rewrites42.4%
Taylor expanded in z around inf
Applied rewrites25.2%
(FPCore (x y z t a) :precision binary64 (+ x t))
double code(double x, double y, double z, double t, double a) {
return x + 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 + t
end function
public static double code(double x, double y, double z, double t, double a) {
return x + t;
}
def code(x, y, z, t, a): return x + t
function code(x, y, z, t, a) return Float64(x + t) end
function tmp = code(x, y, z, t, a) tmp = x + t; end
code[x_, y_, z_, t_, a_] := N[(x + t), $MachinePrecision]
\begin{array}{l}
\\
x + t
\end{array}
Initial program 68.1%
Taylor expanded in z around inf
lift--.f6419.3
Applied rewrites19.3%
Taylor expanded in x around 0
Applied rewrites34.1%
herbie shell --seed 2025139
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
(+ x (/ (* (- y z) (- t x)) (- a z))))