
(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 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(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 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_1 -4e-309)
(fma (- y z) (- (/ t (- a z)) (/ x (- a z))) x)
(if (<= t_1 0.0)
(+
(-
(/
(- (fma a (/ (* (- t x) (- y a)) z) (* (- t x) y)) (* (- t x) a))
z))
t)
(if (<= t_1 2e+253) t_1 (fma (- y z) (/ (- t x) (- a z)) x))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_1 <= -4e-309) {
tmp = fma((y - z), ((t / (a - z)) - (x / (a - z))), x);
} else if (t_1 <= 0.0) {
tmp = -((fma(a, (((t - x) * (y - a)) / z), ((t - x) * y)) - ((t - x) * a)) / z) + t;
} else if (t_1 <= 2e+253) {
tmp = t_1;
} else {
tmp = fma((y - z), ((t - x) / (a - z)), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_1 <= -4e-309) tmp = fma(Float64(y - z), Float64(Float64(t / Float64(a - z)) - Float64(x / Float64(a - z))), x); elseif (t_1 <= 0.0) tmp = Float64(Float64(-Float64(Float64(fma(a, Float64(Float64(Float64(t - x) * Float64(y - a)) / z), Float64(Float64(t - x) * y)) - Float64(Float64(t - x) * a)) / z)) + t); elseif (t_1 <= 2e+253) tmp = t_1; else tmp = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-309], N[(N[(y - z), $MachinePrecision] * N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[((-N[(N[(N[(a * N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - N[(N[(t - x), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], If[LessEqual[t$95$1, 2e+253], t$95$1, N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-309}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a - z} - \frac{x}{a - z}, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\left(-\frac{\mathsf{fma}\left(a, \frac{\left(t - x\right) \cdot \left(y - a\right)}{z}, \left(t - x\right) \cdot y\right) - \left(t - x\right) \cdot a}{z}\right) + t\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+253}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -3.9999999999999977e-309Initial program 67.3%
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--.f6479.7
Applied rewrites79.7%
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-divN/A
lower--.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6479.3
Applied rewrites79.3%
if -3.9999999999999977e-309 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 67.3%
Taylor expanded in z around -inf
+-commutativeN/A
lower-+.f64N/A
Applied rewrites39.6%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.9999999999999999e253Initial program 67.3%
if 1.9999999999999999e253 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 67.3%
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--.f6479.7
Applied rewrites79.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_1 -4e-309)
(fma (- y z) (- (/ t (- a z)) (/ x (- a z))) x)
(if (<= t_1 0.0)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(if (<= t_1 2e+253) t_1 (fma (- y z) (/ (- t x) (- a z)) x))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_1 <= -4e-309) {
tmp = fma((y - z), ((t / (a - z)) - (x / (a - z))), x);
} else if (t_1 <= 0.0) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else if (t_1 <= 2e+253) {
tmp = t_1;
} else {
tmp = fma((y - z), ((t - x) / (a - z)), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_1 <= -4e-309) tmp = fma(Float64(y - z), Float64(Float64(t / Float64(a - z)) - Float64(x / Float64(a - z))), x); elseif (t_1 <= 0.0) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); elseif (t_1 <= 2e+253) tmp = t_1; else tmp = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-309], N[(N[(y - z), $MachinePrecision] * N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], If[LessEqual[t$95$1, 2e+253], t$95$1, N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-309}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a - z} - \frac{x}{a - z}, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+253}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -3.9999999999999977e-309Initial program 67.3%
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--.f6479.7
Applied rewrites79.7%
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-divN/A
lower--.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6479.3
Applied rewrites79.3%
if -3.9999999999999977e-309 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 67.3%
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.9
Applied rewrites46.9%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.9999999999999999e253Initial program 67.3%
if 1.9999999999999999e253 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 67.3%
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--.f6479.7
Applied rewrites79.7%
(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 -4e-309)
t_1
(if (<= t_2 0.0)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(if (<= t_2 2e+253) 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 <= -4e-309) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else if (t_2 <= 2e+253) {
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 <= -4e-309) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); elseif (t_2 <= 2e+253) 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, -4e-309], t$95$1, 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+253], 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 -4 \cdot 10^{-309}:\\
\;\;\;\;t\_1\\
\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^{+253}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -3.9999999999999977e-309 or 1.9999999999999999e253 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 67.3%
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--.f6479.7
Applied rewrites79.7%
if -3.9999999999999977e-309 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 67.3%
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.9
Applied rewrites46.9%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.9999999999999999e253Initial program 67.3%
(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 -4e-309)
t_1
(if (<= t_2 0.0)
(+ (- (/ (* (- t x) (- y a)) z)) t)
(if (<= t_2 1e-76) (+ x (/ (* (- y z) t) (- a z))) 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 <= -4e-309) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else if (t_2 <= 1e-76) {
tmp = x + (((y - z) * t) / (a - z));
} 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 <= -4e-309) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - a)) / z)) + t); elseif (t_2 <= 1e-76) tmp = Float64(x + Float64(Float64(Float64(y - z) * t) / 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[(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, -4e-309], t$95$1, 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, 1e-76], N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $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 - 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 -4 \cdot 10^{-309}:\\
\;\;\;\;t\_1\\
\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 10^{-76}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -3.9999999999999977e-309 or 9.99999999999999927e-77 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 67.3%
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--.f6479.7
Applied rewrites79.7%
if -3.9999999999999977e-309 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 67.3%
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.9
Applied rewrites46.9%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 9.99999999999999927e-77Initial program 67.3%
Taylor expanded in x around 0
Applied rewrites55.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* (/ (- t x) z) y))))
(if (<= z -3.2e-44)
t_1
(if (<= z 2.7e-60)
(fma (- t x) (/ (- y z) a) x)
(if (<= z 1.32e+178) (fma (- y z) (/ t (- a z)) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (((t - x) / z) * y);
double tmp;
if (z <= -3.2e-44) {
tmp = t_1;
} else if (z <= 2.7e-60) {
tmp = fma((t - x), ((y - z) / a), x);
} else if (z <= 1.32e+178) {
tmp = fma((y - z), (t / (a - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(Float64(t - x) / z) * y)) tmp = 0.0 if (z <= -3.2e-44) tmp = t_1; elseif (z <= 2.7e-60) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); elseif (z <= 1.32e+178) tmp = fma(Float64(y - z), Float64(t / Float64(a - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e-44], t$95$1, If[LessEqual[z, 2.7e-60], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.32e+178], N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{t - x}{z} \cdot y\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-60}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{elif}\;z \leq 1.32 \cdot 10^{+178}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.19999999999999995e-44 or 1.3200000000000001e178 < z Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in a around 0
lower--.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
if -3.19999999999999995e-44 < z < 2.7e-60Initial program 67.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6453.1
Applied rewrites53.1%
if 2.7e-60 < z < 1.3200000000000001e178Initial program 67.3%
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--.f6479.7
Applied rewrites79.7%
Taylor expanded in x around 0
Applied rewrites63.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* (/ (- t x) z) y))))
(if (<= z -3.2e-44)
t_1
(if (<= z 7.5e+160) (fma (- t x) (/ (- y z) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (((t - x) / z) * y);
double tmp;
if (z <= -3.2e-44) {
tmp = t_1;
} else if (z <= 7.5e+160) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(Float64(t - x) / z) * y)) tmp = 0.0 if (z <= -3.2e-44) tmp = t_1; elseif (z <= 7.5e+160) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e-44], t$95$1, If[LessEqual[z, 7.5e+160], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{t - x}{z} \cdot y\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+160}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.19999999999999995e-44 or 7.50000000000000028e160 < z Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in a around 0
lower--.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
if -3.19999999999999995e-44 < z < 7.50000000000000028e160Initial program 67.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6453.1
Applied rewrites53.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- t (* (/ (- t x) z) y)))) (if (<= z -3.2e-44) t_1 (if (<= z 1.06e-17) (fma (- t x) (/ y a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (((t - x) / z) * y);
double tmp;
if (z <= -3.2e-44) {
tmp = t_1;
} else if (z <= 1.06e-17) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(Float64(t - x) / z) * y)) tmp = 0.0 if (z <= -3.2e-44) tmp = t_1; elseif (z <= 1.06e-17) tmp = fma(Float64(t - x), Float64(y / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e-44], t$95$1, If[LessEqual[z, 1.06e-17], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{t - x}{z} \cdot y\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-17}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.19999999999999995e-44 or 1.06000000000000006e-17 < z Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in a around 0
lower--.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6447.7
Applied rewrites47.7%
if -3.19999999999999995e-44 < z < 1.06000000000000006e-17Initial program 67.3%
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--.f6479.7
Applied rewrites79.7%
Taylor expanded in z around 0
associate-/l*N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f6449.0
Applied rewrites49.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -8e+180)
(+ x (- t x))
(if (<= z -5.5e-14)
(/ (* (- y a) x) z)
(if (<= z 1.7e+185) (fma (- t x) (/ y a) x) (* (- x) (/ (- a y) z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8e+180) {
tmp = x + (t - x);
} else if (z <= -5.5e-14) {
tmp = ((y - a) * x) / z;
} else if (z <= 1.7e+185) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = -x * ((a - y) / z);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8e+180) tmp = Float64(x + Float64(t - x)); elseif (z <= -5.5e-14) tmp = Float64(Float64(Float64(y - a) * x) / z); elseif (z <= 1.7e+185) tmp = fma(Float64(t - x), Float64(y / a), x); else tmp = Float64(Float64(-x) * Float64(Float64(a - y) / z)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8e+180], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5.5e-14], N[(N[(N[(y - a), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.7e+185], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[((-x) * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+180}:\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-14}:\\
\;\;\;\;\frac{\left(y - a\right) \cdot x}{z}\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+185}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \frac{a - y}{z}\\
\end{array}
\end{array}
if z < -8.0000000000000001e180Initial program 67.3%
Taylor expanded in z around inf
lift--.f6419.1
Applied rewrites19.1%
if -8.0000000000000001e180 < z < -5.49999999999999991e-14Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6419.9
Applied rewrites19.9%
if -5.49999999999999991e-14 < z < 1.70000000000000009e185Initial program 67.3%
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--.f6479.7
Applied rewrites79.7%
Taylor expanded in z around 0
associate-/l*N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f6449.0
Applied rewrites49.0%
if 1.70000000000000009e185 < z Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6423.3
Applied rewrites23.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -8e+180)
(+ x (- t x))
(if (<= z -5.5e-14)
(/ (* (- y a) x) z)
(if (<= z 3e+183) (fma y (/ (- t x) a) x) (* (- x) (/ (- a y) z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8e+180) {
tmp = x + (t - x);
} else if (z <= -5.5e-14) {
tmp = ((y - a) * x) / z;
} else if (z <= 3e+183) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = -x * ((a - y) / z);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8e+180) tmp = Float64(x + Float64(t - x)); elseif (z <= -5.5e-14) tmp = Float64(Float64(Float64(y - a) * x) / z); elseif (z <= 3e+183) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = Float64(Float64(-x) * Float64(Float64(a - y) / z)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8e+180], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5.5e-14], N[(N[(N[(y - a), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 3e+183], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[((-x) * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+180}:\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-14}:\\
\;\;\;\;\frac{\left(y - a\right) \cdot x}{z}\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+183}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \frac{a - y}{z}\\
\end{array}
\end{array}
if z < -8.0000000000000001e180Initial program 67.3%
Taylor expanded in z around inf
lift--.f6419.1
Applied rewrites19.1%
if -8.0000000000000001e180 < z < -5.49999999999999991e-14Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6419.9
Applied rewrites19.9%
if -5.49999999999999991e-14 < z < 2.99999999999999996e183Initial program 67.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6447.8
Applied rewrites47.8%
if 2.99999999999999996e183 < z Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6423.3
Applied rewrites23.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.45e+139)
(* t (/ (- y z) a))
(if (<= t -1.4e-232)
(+ x (* (- x) (/ y a)))
(if (<= t 2.25e-147) (* (- x) (/ (- a y) z)) (+ x (/ (* t y) a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.45e+139) {
tmp = t * ((y - z) / a);
} else if (t <= -1.4e-232) {
tmp = x + (-x * (y / a));
} else if (t <= 2.25e-147) {
tmp = -x * ((a - y) / z);
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-1.45d+139)) then
tmp = t * ((y - z) / a)
else if (t <= (-1.4d-232)) then
tmp = x + (-x * (y / a))
else if (t <= 2.25d-147) then
tmp = -x * ((a - y) / z)
else
tmp = x + ((t * y) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.45e+139) {
tmp = t * ((y - z) / a);
} else if (t <= -1.4e-232) {
tmp = x + (-x * (y / a));
} else if (t <= 2.25e-147) {
tmp = -x * ((a - y) / z);
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.45e+139: tmp = t * ((y - z) / a) elif t <= -1.4e-232: tmp = x + (-x * (y / a)) elif t <= 2.25e-147: tmp = -x * ((a - y) / z) else: tmp = x + ((t * y) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.45e+139) tmp = Float64(t * Float64(Float64(y - z) / a)); elseif (t <= -1.4e-232) tmp = Float64(x + Float64(Float64(-x) * Float64(y / a))); elseif (t <= 2.25e-147) tmp = Float64(Float64(-x) * Float64(Float64(a - y) / z)); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.45e+139) tmp = t * ((y - z) / a); elseif (t <= -1.4e-232) tmp = x + (-x * (y / a)); elseif (t <= 2.25e-147) tmp = -x * ((a - y) / z); else tmp = x + ((t * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.45e+139], N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.4e-232], N[(x + N[((-x) * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.25e-147], N[((-x) * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{+139}:\\
\;\;\;\;t \cdot \frac{y - z}{a}\\
\mathbf{elif}\;t \leq -1.4 \cdot 10^{-232}:\\
\;\;\;\;x + \left(-x\right) \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 2.25 \cdot 10^{-147}:\\
\;\;\;\;\left(-x\right) \cdot \frac{a - y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
\end{array}
if t < -1.4499999999999999e139Initial program 67.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6453.1
Applied rewrites53.1%
Taylor expanded in x around 0
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6423.1
Applied rewrites23.1%
if -1.4499999999999999e139 < t < -1.39999999999999996e-232Initial program 67.3%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6443.8
Applied rewrites43.8%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6432.8
Applied rewrites32.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6436.5
Applied rewrites36.5%
if -1.39999999999999996e-232 < t < 2.24999999999999986e-147Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6423.3
Applied rewrites23.3%
if 2.24999999999999986e-147 < t Initial program 67.3%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6443.8
Applied rewrites43.8%
Taylor expanded in x around 0
Applied rewrites37.9%
(FPCore (x y z t a)
:precision binary64
(if (<= a -3.6e+91)
(fma t (/ (- z) a) x)
(if (<= a -2.2e-150)
(* y (/ (- t x) a))
(if (<= a 5.6e-158) (* (/ (- x t) z) y) (+ x (/ (* t y) a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.6e+91) {
tmp = fma(t, (-z / a), x);
} else if (a <= -2.2e-150) {
tmp = y * ((t - x) / a);
} else if (a <= 5.6e-158) {
tmp = ((x - t) / z) * y;
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.6e+91) tmp = fma(t, Float64(Float64(-z) / a), x); elseif (a <= -2.2e-150) tmp = Float64(y * Float64(Float64(t - x) / a)); elseif (a <= 5.6e-158) tmp = Float64(Float64(Float64(x - t) / z) * y); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.6e+91], N[(t * N[((-z) / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, -2.2e-150], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.6e-158], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.6 \cdot 10^{+91}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{-z}{a}, x\right)\\
\mathbf{elif}\;a \leq -2.2 \cdot 10^{-150}:\\
\;\;\;\;y \cdot \frac{t - x}{a}\\
\mathbf{elif}\;a \leq 5.6 \cdot 10^{-158}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
\end{array}
if a < -3.6e91Initial program 67.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6453.1
Applied rewrites53.1%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6430.4
Applied rewrites30.4%
Taylor expanded in x around 0
Applied rewrites29.9%
if -3.6e91 < a < -2.1999999999999999e-150Initial program 67.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6453.1
Applied rewrites53.1%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6426.3
Applied rewrites26.3%
if -2.1999999999999999e-150 < a < 5.60000000000000004e-158Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.9
Applied rewrites25.9%
if 5.60000000000000004e-158 < a Initial program 67.3%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6443.8
Applied rewrites43.8%
Taylor expanded in x around 0
Applied rewrites37.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* t y) a))))
(if (<= a -1.2e+39)
t_1
(if (<= a -2.2e-150)
(* y (/ (- t x) a))
(if (<= a 5.6e-158) (* (/ (- x t) z) y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((t * y) / a);
double tmp;
if (a <= -1.2e+39) {
tmp = t_1;
} else if (a <= -2.2e-150) {
tmp = y * ((t - x) / a);
} else if (a <= 5.6e-158) {
tmp = ((x - t) / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + ((t * y) / a)
if (a <= (-1.2d+39)) then
tmp = t_1
else if (a <= (-2.2d-150)) then
tmp = y * ((t - x) / a)
else if (a <= 5.6d-158) then
tmp = ((x - t) / z) * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((t * y) / a);
double tmp;
if (a <= -1.2e+39) {
tmp = t_1;
} else if (a <= -2.2e-150) {
tmp = y * ((t - x) / a);
} else if (a <= 5.6e-158) {
tmp = ((x - t) / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((t * y) / a) tmp = 0 if a <= -1.2e+39: tmp = t_1 elif a <= -2.2e-150: tmp = y * ((t - x) / a) elif a <= 5.6e-158: tmp = ((x - t) / z) * y else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(t * y) / a)) tmp = 0.0 if (a <= -1.2e+39) tmp = t_1; elseif (a <= -2.2e-150) tmp = Float64(y * Float64(Float64(t - x) / a)); elseif (a <= 5.6e-158) tmp = Float64(Float64(Float64(x - t) / z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((t * y) / a); tmp = 0.0; if (a <= -1.2e+39) tmp = t_1; elseif (a <= -2.2e-150) tmp = y * ((t - x) / a); elseif (a <= 5.6e-158) tmp = ((x - t) / z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.2e+39], t$95$1, If[LessEqual[a, -2.2e-150], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.6e-158], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{t \cdot y}{a}\\
\mathbf{if}\;a \leq -1.2 \cdot 10^{+39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -2.2 \cdot 10^{-150}:\\
\;\;\;\;y \cdot \frac{t - x}{a}\\
\mathbf{elif}\;a \leq 5.6 \cdot 10^{-158}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.2e39 or 5.60000000000000004e-158 < a Initial program 67.3%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6443.8
Applied rewrites43.8%
Taylor expanded in x around 0
Applied rewrites37.9%
if -1.2e39 < a < -2.1999999999999999e-150Initial program 67.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6453.1
Applied rewrites53.1%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6426.3
Applied rewrites26.3%
if -2.1999999999999999e-150 < a < 5.60000000000000004e-158Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.9
Applied rewrites25.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- t x) a))))
(if (<= y -3.1e+199)
t_1
(if (<= y -1.02e+86)
(* (/ (- x t) z) y)
(if (<= y 6e+214) (+ x t) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((t - x) / a);
double tmp;
if (y <= -3.1e+199) {
tmp = t_1;
} else if (y <= -1.02e+86) {
tmp = ((x - t) / z) * y;
} else if (y <= 6e+214) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = y * ((t - x) / a)
if (y <= (-3.1d+199)) then
tmp = t_1
else if (y <= (-1.02d+86)) then
tmp = ((x - t) / z) * y
else if (y <= 6d+214) then
tmp = x + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((t - x) / a);
double tmp;
if (y <= -3.1e+199) {
tmp = t_1;
} else if (y <= -1.02e+86) {
tmp = ((x - t) / z) * y;
} else if (y <= 6e+214) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * ((t - x) / a) tmp = 0 if y <= -3.1e+199: tmp = t_1 elif y <= -1.02e+86: tmp = ((x - t) / z) * y elif y <= 6e+214: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(t - x) / a)) tmp = 0.0 if (y <= -3.1e+199) tmp = t_1; elseif (y <= -1.02e+86) tmp = Float64(Float64(Float64(x - t) / z) * y); elseif (y <= 6e+214) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * ((t - x) / a); tmp = 0.0; if (y <= -3.1e+199) tmp = t_1; elseif (y <= -1.02e+86) tmp = ((x - t) / z) * y; elseif (y <= 6e+214) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.1e+199], t$95$1, If[LessEqual[y, -1.02e+86], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 6e+214], N[(x + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{t - x}{a}\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{+199}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.02 \cdot 10^{+86}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+214}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.09999999999999986e199 or 6.0000000000000002e214 < y Initial program 67.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6453.1
Applied rewrites53.1%
Taylor expanded in y around inf
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6426.3
Applied rewrites26.3%
if -3.09999999999999986e199 < y < -1.01999999999999996e86Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.9
Applied rewrites25.9%
if -1.01999999999999996e86 < y < 6.0000000000000002e214Initial program 67.3%
Taylor expanded in z around inf
lift--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites33.6%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.02e+86) (* (/ (- x t) z) y) (if (<= y 6e+204) (+ x t) (* x (/ y z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.02e+86) {
tmp = ((x - t) / z) * y;
} else if (y <= 6e+204) {
tmp = x + t;
} else {
tmp = x * (y / 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) :: tmp
if (y <= (-1.02d+86)) then
tmp = ((x - t) / z) * y
else if (y <= 6d+204) then
tmp = x + t
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.02e+86) {
tmp = ((x - t) / z) * y;
} else if (y <= 6e+204) {
tmp = x + t;
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.02e+86: tmp = ((x - t) / z) * y elif y <= 6e+204: tmp = x + t else: tmp = x * (y / z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.02e+86) tmp = Float64(Float64(Float64(x - t) / z) * y); elseif (y <= 6e+204) tmp = Float64(x + t); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.02e+86) tmp = ((x - t) / z) * y; elseif (y <= 6e+204) tmp = x + t; else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.02e+86], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 6e+204], N[(x + t), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{+86}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+204}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -1.01999999999999996e86Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.9
Applied rewrites25.9%
if -1.01999999999999996e86 < y < 5.99999999999999965e204Initial program 67.3%
Taylor expanded in z around inf
lift--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites33.6%
if 5.99999999999999965e204 < y Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6423.3
Applied rewrites23.3%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6419.2
Applied rewrites19.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* x (/ y z)))) (if (<= y -1.12e+111) t_1 (if (<= y 6e+204) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x * (y / z);
double tmp;
if (y <= -1.12e+111) {
tmp = t_1;
} else if (y <= 6e+204) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x * (y / z)
if (y <= (-1.12d+111)) then
tmp = t_1
else if (y <= 6d+204) then
tmp = x + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x * (y / z);
double tmp;
if (y <= -1.12e+111) {
tmp = t_1;
} else if (y <= 6e+204) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x * (y / z) tmp = 0 if y <= -1.12e+111: tmp = t_1 elif y <= 6e+204: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x * Float64(y / z)) tmp = 0.0 if (y <= -1.12e+111) tmp = t_1; elseif (y <= 6e+204) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x * (y / z); tmp = 0.0; if (y <= -1.12e+111) tmp = t_1; elseif (y <= 6e+204) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.12e+111], t$95$1, If[LessEqual[y, 6e+204], N[(x + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{z}\\
\mathbf{if}\;y \leq -1.12 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+204}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.11999999999999995e111 or 5.99999999999999965e204 < y Initial program 67.3%
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.9
Applied rewrites46.9%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6423.3
Applied rewrites23.3%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6419.2
Applied rewrites19.2%
if -1.11999999999999995e111 < y < 5.99999999999999965e204Initial program 67.3%
Taylor expanded in z around inf
lift--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites33.6%
(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 67.3%
Taylor expanded in z around inf
lift--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites33.6%
herbie shell --seed 2025127
(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))))