
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x / y) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x / y) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z)))))
(if (<= t_1 2e+276)
t_1
(/ (fma (- (+ (/ 2.0 t) (/ 2.0 (* t z))) 2.0) y x) y))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
double tmp;
if (t_1 <= 2e+276) {
tmp = t_1;
} else {
tmp = fma((((2.0 / t) + (2.0 / (t * z))) - 2.0), y, x) / y;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) tmp = 0.0 if (t_1 <= 2e+276) tmp = t_1; else tmp = Float64(fma(Float64(Float64(Float64(2.0 / t) + Float64(2.0 / Float64(t * z))) - 2.0), y, x) / y); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+276], t$95$1, N[(N[(N[(N[(N[(2.0 / t), $MachinePrecision] + N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * y + x), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+276}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\frac{2}{t} + \frac{2}{t \cdot z}\right) - 2, y, x\right)}{y}\\
\end{array}
\end{array}
if (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) < 2.0000000000000001e276Initial program 99.8%
if 2.0000000000000001e276 < (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) Initial program 49.5%
Taylor expanded in t around 0
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6487.3
Applied rewrites87.3%
Taylor expanded in y around 0
lower-/.f64N/A
Applied rewrites94.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- (fma (- (/ x y) 2.0) t (/ 2.0 z)) -2.0) t)))
(if (<= y -3e+23)
t_1
(if (<= y 9.6e+61)
(/ (fma (- (+ (/ 2.0 t) (/ 2.0 (* t z))) 2.0) y x) y)
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (fma(((x / y) - 2.0), t, (2.0 / z)) - -2.0) / t;
double tmp;
if (y <= -3e+23) {
tmp = t_1;
} else if (y <= 9.6e+61) {
tmp = fma((((2.0 / t) + (2.0 / (t * z))) - 2.0), y, x) / y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(fma(Float64(Float64(x / y) - 2.0), t, Float64(2.0 / z)) - -2.0) / t) tmp = 0.0 if (y <= -3e+23) tmp = t_1; elseif (y <= 9.6e+61) tmp = Float64(fma(Float64(Float64(Float64(2.0 / t) + Float64(2.0 / Float64(t * z))) - 2.0), y, x) / y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision] * t + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] - -2.0), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[y, -3e+23], t$95$1, If[LessEqual[y, 9.6e+61], N[(N[(N[(N[(N[(2.0 / t), $MachinePrecision] + N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * y + x), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(\frac{x}{y} - 2, t, \frac{2}{z}\right) - -2}{t}\\
\mathbf{if}\;y \leq -3 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 9.6 \cdot 10^{+61}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\frac{2}{t} + \frac{2}{t \cdot z}\right) - 2, y, x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.0000000000000001e23 or 9.5999999999999995e61 < y Initial program 86.1%
Taylor expanded in t around 0
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6497.0
Applied rewrites97.0%
if -3.0000000000000001e23 < y < 9.5999999999999995e61Initial program 85.5%
Taylor expanded in t around 0
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6487.4
Applied rewrites87.4%
Taylor expanded in y around 0
lower-/.f64N/A
Applied rewrites98.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (+ (/ 2.0 t) (/ x y)) 2.0)))
(if (<= z -3.5e+43)
t_1
(if (<= z 250000000.0)
(+ (/ x y) (/ (/ (fma (+ z z) (- 1.0 t) 2.0) t) z))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((2.0 / t) + (x / y)) - 2.0;
double tmp;
if (z <= -3.5e+43) {
tmp = t_1;
} else if (z <= 250000000.0) {
tmp = (x / y) + ((fma((z + z), (1.0 - t), 2.0) / t) / z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(2.0 / t) + Float64(x / y)) - 2.0) tmp = 0.0 if (z <= -3.5e+43) tmp = t_1; elseif (z <= 250000000.0) tmp = Float64(Float64(x / y) + Float64(Float64(fma(Float64(z + z), Float64(1.0 - t), 2.0) / t) / z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(2.0 / t), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[z, -3.5e+43], t$95$1, If[LessEqual[z, 250000000.0], N[(N[(x / y), $MachinePrecision] + N[(N[(N[(N[(z + z), $MachinePrecision] * N[(1.0 - t), $MachinePrecision] + 2.0), $MachinePrecision] / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\frac{2}{t} + \frac{x}{y}\right) - 2\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 250000000:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{\mathsf{fma}\left(z + z, 1 - t, 2\right)}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.5000000000000001e43 or 2.5e8 < z Initial program 71.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-/.f6499.9
Applied rewrites99.9%
Taylor expanded in t around inf
lower--.f64N/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f64N/A
lift-/.f6499.9
Applied rewrites99.9%
if -3.5000000000000001e43 < z < 2.5e8Initial program 98.1%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f64N/A
lift--.f6497.9
Applied rewrites97.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- (fma (/ x y) t (/ 2.0 z)) -2.0) t))
(t_2 (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
(if (<= t_2 -5e+16)
t_1
(if (<= t_2 5.0)
(- (+ (/ 2.0 t) (/ x y)) 2.0)
(if (<= t_2 INFINITY) t_1 (- (/ x y) 2.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (fma((x / y), t, (2.0 / z)) - -2.0) / t;
double t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z);
double tmp;
if (t_2 <= -5e+16) {
tmp = t_1;
} else if (t_2 <= 5.0) {
tmp = ((2.0 / t) + (x / y)) - 2.0;
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(fma(Float64(x / y), t, Float64(2.0 / z)) - -2.0) / t) t_2 = Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z)) tmp = 0.0 if (t_2 <= -5e+16) tmp = t_1; elseif (t_2 <= 5.0) tmp = Float64(Float64(Float64(2.0 / t) + Float64(x / y)) - 2.0); elseif (t_2 <= Inf) tmp = t_1; else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(x / y), $MachinePrecision] * t + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] - -2.0), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+16], t$95$1, If[LessEqual[t$95$2, 5.0], N[(N[(N[(2.0 / t), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision], If[LessEqual[t$95$2, Infinity], t$95$1, N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\mathsf{fma}\left(\frac{x}{y}, t, \frac{2}{z}\right) - -2}{t}\\
t_2 := \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5:\\
\;\;\;\;\left(\frac{2}{t} + \frac{x}{y}\right) - 2\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < -5e16 or 5 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < +inf.0Initial program 98.3%
Taylor expanded in t around 0
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6497.2
Applied rewrites97.2%
Taylor expanded in x around inf
lift-/.f6496.7
Applied rewrites96.7%
if -5e16 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < 5Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-/.f6497.9
Applied rewrites97.9%
Taylor expanded in t around inf
lower--.f64N/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f64N/A
lift-/.f6497.9
Applied rewrites97.9%
if +inf.0 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) Initial program 0.0%
Taylor expanded in t around inf
lower--.f64N/A
lift-/.f64100.0
Applied rewrites100.0%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+168) (fma (/ 1.0 t) 2.0 (/ x y)) (/ (- (fma (- (/ x y) 2.0) t (/ 2.0 z)) -2.0) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+168) {
tmp = fma((1.0 / t), 2.0, (x / y));
} else {
tmp = (fma(((x / y) - 2.0), t, (2.0 / z)) - -2.0) / t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+168) tmp = fma(Float64(1.0 / t), 2.0, Float64(x / y)); else tmp = Float64(Float64(fma(Float64(Float64(x / y) - 2.0), t, Float64(2.0 / z)) - -2.0) / t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+168], N[(N[(1.0 / t), $MachinePrecision] * 2.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision] * t + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] - -2.0), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+168}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{t}, 2, \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y} - 2, t, \frac{2}{z}\right) - -2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -4.99999999999999967e168Initial program 83.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-/.f6487.7
Applied rewrites87.7%
Taylor expanded in t around 0
Applied rewrites87.7%
if -4.99999999999999967e168 < (/.f64 x y) Initial program 86.1%
Taylor expanded in t around 0
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6493.3
Applied rewrites93.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (+ (/ 2.0 t) (/ x y)) 2.0)))
(if (<= z -1.92e-90)
t_1
(if (<= z 3.6e-29) (+ (/ x y) (/ 2.0 (* t z))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((2.0 / t) + (x / y)) - 2.0;
double tmp;
if (z <= -1.92e-90) {
tmp = t_1;
} else if (z <= 3.6e-29) {
tmp = (x / y) + (2.0 / (t * z));
} 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)
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) :: t_1
real(8) :: tmp
t_1 = ((2.0d0 / t) + (x / y)) - 2.0d0
if (z <= (-1.92d-90)) then
tmp = t_1
else if (z <= 3.6d-29) then
tmp = (x / y) + (2.0d0 / (t * z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((2.0 / t) + (x / y)) - 2.0;
double tmp;
if (z <= -1.92e-90) {
tmp = t_1;
} else if (z <= 3.6e-29) {
tmp = (x / y) + (2.0 / (t * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((2.0 / t) + (x / y)) - 2.0 tmp = 0 if z <= -1.92e-90: tmp = t_1 elif z <= 3.6e-29: tmp = (x / y) + (2.0 / (t * z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(2.0 / t) + Float64(x / y)) - 2.0) tmp = 0.0 if (z <= -1.92e-90) tmp = t_1; elseif (z <= 3.6e-29) tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(t * z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((2.0 / t) + (x / y)) - 2.0; tmp = 0.0; if (z <= -1.92e-90) tmp = t_1; elseif (z <= 3.6e-29) tmp = (x / y) + (2.0 / (t * z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(2.0 / t), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[z, -1.92e-90], t$95$1, If[LessEqual[z, 3.6e-29], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\frac{2}{t} + \frac{x}{y}\right) - 2\\
\mathbf{if}\;z \leq -1.92 \cdot 10^{-90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-29}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.92000000000000009e-90 or 3.59999999999999974e-29 < z Initial program 77.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-/.f6493.1
Applied rewrites93.1%
Taylor expanded in t around inf
lower--.f64N/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f64N/A
lift-/.f6493.2
Applied rewrites93.2%
if -1.92000000000000009e-90 < z < 3.59999999999999974e-29Initial program 97.8%
Taylor expanded in z around 0
Applied rewrites87.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- (/ 2.0 z) -2.0) t))
(t_2 (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
(if (<= t_2 -2e+108)
t_1
(if (<= t_2 1e+117)
(- (+ (/ 2.0 t) (/ x y)) 2.0)
(if (<= t_2 INFINITY) t_1 (- (/ x y) 2.0))))))
double code(double x, double y, double z, double t) {
double t_1 = ((2.0 / z) - -2.0) / t;
double t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z);
double tmp;
if (t_2 <= -2e+108) {
tmp = t_1;
} else if (t_2 <= 1e+117) {
tmp = ((2.0 / t) + (x / y)) - 2.0;
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = ((2.0 / z) - -2.0) / t;
double t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z);
double tmp;
if (t_2 <= -2e+108) {
tmp = t_1;
} else if (t_2 <= 1e+117) {
tmp = ((2.0 / t) + (x / y)) - 2.0;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((2.0 / z) - -2.0) / t t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z) tmp = 0 if t_2 <= -2e+108: tmp = t_1 elif t_2 <= 1e+117: tmp = ((2.0 / t) + (x / y)) - 2.0 elif t_2 <= math.inf: tmp = t_1 else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(2.0 / z) - -2.0) / t) t_2 = Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z)) tmp = 0.0 if (t_2 <= -2e+108) tmp = t_1; elseif (t_2 <= 1e+117) tmp = Float64(Float64(Float64(2.0 / t) + Float64(x / y)) - 2.0); elseif (t_2 <= Inf) tmp = t_1; else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((2.0 / z) - -2.0) / t; t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z); tmp = 0.0; if (t_2 <= -2e+108) tmp = t_1; elseif (t_2 <= 1e+117) tmp = ((2.0 / t) + (x / y)) - 2.0; elseif (t_2 <= Inf) tmp = t_1; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(2.0 / z), $MachinePrecision] - -2.0), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+108], t$95$1, If[LessEqual[t$95$2, 1e+117], N[(N[(N[(2.0 / t), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision], If[LessEqual[t$95$2, Infinity], t$95$1, N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{2}{z} - -2}{t}\\
t_2 := \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+117}:\\
\;\;\;\;\left(\frac{2}{t} + \frac{x}{y}\right) - 2\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < -2.0000000000000001e108 or 1.00000000000000005e117 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < +inf.0Initial program 97.7%
Taylor expanded in t around 0
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6483.4
Applied rewrites83.4%
if -2.0000000000000001e108 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < 1.00000000000000005e117Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-/.f6487.1
Applied rewrites87.1%
Taylor expanded in t around inf
lower--.f64N/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f64N/A
lift-/.f6487.1
Applied rewrites87.1%
if +inf.0 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) Initial program 0.0%
Taylor expanded in t around inf
lower--.f64N/A
lift-/.f64100.0
Applied rewrites100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- (/ 2.0 z) -2.0) t))
(t_2 (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z)))
(t_3 (- (/ x y) 2.0)))
(if (<= t_2 -5e+101)
t_1
(if (<= t_2 -1.0)
t_3
(if (<= t_2 1e+117)
(fma (/ 1.0 t) 2.0 (/ x y))
(if (<= t_2 INFINITY) t_1 t_3))))))
double code(double x, double y, double z, double t) {
double t_1 = ((2.0 / z) - -2.0) / t;
double t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z);
double t_3 = (x / y) - 2.0;
double tmp;
if (t_2 <= -5e+101) {
tmp = t_1;
} else if (t_2 <= -1.0) {
tmp = t_3;
} else if (t_2 <= 1e+117) {
tmp = fma((1.0 / t), 2.0, (x / y));
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(2.0 / z) - -2.0) / t) t_2 = Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z)) t_3 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t_2 <= -5e+101) tmp = t_1; elseif (t_2 <= -1.0) tmp = t_3; elseif (t_2 <= 1e+117) tmp = fma(Float64(1.0 / t), 2.0, Float64(x / y)); elseif (t_2 <= Inf) tmp = t_1; else tmp = t_3; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(2.0 / z), $MachinePrecision] - -2.0), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+101], t$95$1, If[LessEqual[t$95$2, -1.0], t$95$3, If[LessEqual[t$95$2, 1e+117], N[(N[(1.0 / t), $MachinePrecision] * 2.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], t$95$1, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{2}{z} - -2}{t}\\
t_2 := \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}\\
t_3 := \frac{x}{y} - 2\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{t}, 2, \frac{x}{y}\right)\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < -4.99999999999999989e101 or 1.00000000000000005e117 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < +inf.0Initial program 97.7%
Taylor expanded in t around 0
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6483.3
Applied rewrites83.3%
if -4.99999999999999989e101 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < -1 or +inf.0 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) Initial program 71.3%
Taylor expanded in t around inf
lower--.f64N/A
lift-/.f6489.1
Applied rewrites89.1%
if -1 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < 1.00000000000000005e117Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-/.f6471.6
Applied rewrites71.6%
Taylor expanded in t around 0
Applied rewrites70.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- (/ 2.0 z) -2.0) t))
(t_2 (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z)))
(t_3 (- (/ x y) 2.0)))
(if (<= t_2 -5e+101)
t_1
(if (<= t_2 10.0) t_3 (if (<= t_2 INFINITY) t_1 t_3)))))
double code(double x, double y, double z, double t) {
double t_1 = ((2.0 / z) - -2.0) / t;
double t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z);
double t_3 = (x / y) - 2.0;
double tmp;
if (t_2 <= -5e+101) {
tmp = t_1;
} else if (t_2 <= 10.0) {
tmp = t_3;
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = ((2.0 / z) - -2.0) / t;
double t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z);
double t_3 = (x / y) - 2.0;
double tmp;
if (t_2 <= -5e+101) {
tmp = t_1;
} else if (t_2 <= 10.0) {
tmp = t_3;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((2.0 / z) - -2.0) / t t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z) t_3 = (x / y) - 2.0 tmp = 0 if t_2 <= -5e+101: tmp = t_1 elif t_2 <= 10.0: tmp = t_3 elif t_2 <= math.inf: tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(2.0 / z) - -2.0) / t) t_2 = Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z)) t_3 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t_2 <= -5e+101) tmp = t_1; elseif (t_2 <= 10.0) tmp = t_3; elseif (t_2 <= Inf) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((2.0 / z) - -2.0) / t; t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z); t_3 = (x / y) - 2.0; tmp = 0.0; if (t_2 <= -5e+101) tmp = t_1; elseif (t_2 <= 10.0) tmp = t_3; elseif (t_2 <= Inf) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(2.0 / z), $MachinePrecision] - -2.0), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+101], t$95$1, If[LessEqual[t$95$2, 10.0], t$95$3, If[LessEqual[t$95$2, Infinity], t$95$1, t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{2}{z} - -2}{t}\\
t_2 := \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}\\
t_3 := \frac{x}{y} - 2\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < -4.99999999999999989e101 or 10 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < +inf.0Initial program 98.1%
Taylor expanded in t around 0
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6478.2
Applied rewrites78.2%
if -4.99999999999999989e101 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < 10 or +inf.0 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) Initial program 71.3%
Taylor expanded in t around inf
lower--.f64N/A
lift-/.f6489.1
Applied rewrites89.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (/ 2.0 z) t))
(t_2 (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z)))
(t_3 (- (/ x y) 2.0)))
(if (<= t_2 -5e+101)
t_1
(if (<= t_2 1e+117) t_3 (if (<= t_2 INFINITY) t_1 t_3)))))
double code(double x, double y, double z, double t) {
double t_1 = (2.0 / z) / t;
double t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z);
double t_3 = (x / y) - 2.0;
double tmp;
if (t_2 <= -5e+101) {
tmp = t_1;
} else if (t_2 <= 1e+117) {
tmp = t_3;
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (2.0 / z) / t;
double t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z);
double t_3 = (x / y) - 2.0;
double tmp;
if (t_2 <= -5e+101) {
tmp = t_1;
} else if (t_2 <= 1e+117) {
tmp = t_3;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 / z) / t t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z) t_3 = (x / y) - 2.0 tmp = 0 if t_2 <= -5e+101: tmp = t_1 elif t_2 <= 1e+117: tmp = t_3 elif t_2 <= math.inf: tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(2.0 / z) / t) t_2 = Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z)) t_3 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t_2 <= -5e+101) tmp = t_1; elseif (t_2 <= 1e+117) tmp = t_3; elseif (t_2 <= Inf) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (2.0 / z) / t; t_2 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z); t_3 = (x / y) - 2.0; tmp = 0.0; if (t_2 <= -5e+101) tmp = t_1; elseif (t_2 <= 1e+117) tmp = t_3; elseif (t_2 <= Inf) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+101], t$95$1, If[LessEqual[t$95$2, 1e+117], t$95$3, If[LessEqual[t$95$2, Infinity], t$95$1, t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{2}{z}}{t}\\
t_2 := \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}\\
t_3 := \frac{x}{y} - 2\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+117}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < -4.99999999999999989e101 or 1.00000000000000005e117 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < +inf.0Initial program 97.7%
Taylor expanded in t around 0
lower-/.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6498.4
Applied rewrites98.4%
Taylor expanded in z around 0
lift-/.f6455.6
Applied rewrites55.6%
if -4.99999999999999989e101 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < 1.00000000000000005e117 or +inf.0 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) Initial program 76.2%
Taylor expanded in t around inf
lower--.f64N/A
lift-/.f6481.2
Applied rewrites81.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ 2.0 (* t z)))
(t_2 (- (/ x y) 2.0))
(t_3 (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
(if (<= t_3 -5e+101)
t_1
(if (<= t_3 1e+117) t_2 (if (<= t_3 INFINITY) t_1 t_2)))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 / (t * z);
double t_2 = (x / y) - 2.0;
double t_3 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z);
double tmp;
if (t_3 <= -5e+101) {
tmp = t_1;
} else if (t_3 <= 1e+117) {
tmp = t_2;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 / (t * z);
double t_2 = (x / y) - 2.0;
double t_3 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z);
double tmp;
if (t_3 <= -5e+101) {
tmp = t_1;
} else if (t_3 <= 1e+117) {
tmp = t_2;
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 / (t * z) t_2 = (x / y) - 2.0 t_3 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z) tmp = 0 if t_3 <= -5e+101: tmp = t_1 elif t_3 <= 1e+117: tmp = t_2 elif t_3 <= math.inf: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 / Float64(t * z)) t_2 = Float64(Float64(x / y) - 2.0) t_3 = Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z)) tmp = 0.0 if (t_3 <= -5e+101) tmp = t_1; elseif (t_3 <= 1e+117) tmp = t_2; elseif (t_3 <= Inf) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 / (t * z); t_2 = (x / y) - 2.0; t_3 = (2.0 + ((z * 2.0) * (1.0 - t))) / (t * z); tmp = 0.0; if (t_3 <= -5e+101) tmp = t_1; elseif (t_3 <= 1e+117) tmp = t_2; elseif (t_3 <= Inf) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+101], t$95$1, If[LessEqual[t$95$3, 1e+117], t$95$2, If[LessEqual[t$95$3, Infinity], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2}{t \cdot z}\\
t_2 := \frac{x}{y} - 2\\
t_3 := \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 10^{+117}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < -4.99999999999999989e101 or 1.00000000000000005e117 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < +inf.0Initial program 97.7%
Taylor expanded in z around 0
lower-/.f64N/A
lift-*.f6455.6
Applied rewrites55.6%
if -4.99999999999999989e101 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) < 1.00000000000000005e117 or +inf.0 < (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z)) Initial program 76.2%
Taylor expanded in t around inf
lower--.f64N/A
lift-/.f6481.2
Applied rewrites81.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= (/ x y) -28000000000.0)
t_1
(if (<= (/ x y) 0.7) (- (/ 2.0 t) 2.0) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if ((x / y) <= -28000000000.0) {
tmp = t_1;
} else if ((x / y) <= 0.7) {
tmp = (2.0 / t) - 2.0;
} 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)
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) :: t_1
real(8) :: tmp
t_1 = (x / y) - 2.0d0
if ((x / y) <= (-28000000000.0d0)) then
tmp = t_1
else if ((x / y) <= 0.7d0) then
tmp = (2.0d0 / t) - 2.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if ((x / y) <= -28000000000.0) {
tmp = t_1;
} else if ((x / y) <= 0.7) {
tmp = (2.0 / t) - 2.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if (x / y) <= -28000000000.0: tmp = t_1 elif (x / y) <= 0.7: tmp = (2.0 / t) - 2.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (Float64(x / y) <= -28000000000.0) tmp = t_1; elseif (Float64(x / y) <= 0.7) tmp = Float64(Float64(2.0 / t) - 2.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if ((x / y) <= -28000000000.0) tmp = t_1; elseif ((x / y) <= 0.7) tmp = (2.0 / t) - 2.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -28000000000.0], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 0.7], N[(N[(2.0 / t), $MachinePrecision] - 2.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;\frac{x}{y} \leq -28000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 0.7:\\
\;\;\;\;\frac{2}{t} - 2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -2.8e10 or 0.69999999999999996 < (/.f64 x y) Initial program 85.0%
Taylor expanded in t around inf
lower--.f64N/A
lift-/.f6470.6
Applied rewrites70.6%
if -2.8e10 < (/.f64 x y) < 0.69999999999999996Initial program 86.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-/.f6462.9
Applied rewrites62.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6461.8
Applied rewrites61.8%
Taylor expanded in t around inf
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6461.8
Applied rewrites61.8%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -31000000000.0) (/ x y) (if (<= (/ x y) 42.0) (- (/ 2.0 t) 2.0) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -31000000000.0) {
tmp = x / y;
} else if ((x / y) <= 42.0) {
tmp = (2.0 / t) - 2.0;
} else {
tmp = x / y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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) :: tmp
if ((x / y) <= (-31000000000.0d0)) then
tmp = x / y
else if ((x / y) <= 42.0d0) then
tmp = (2.0d0 / t) - 2.0d0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -31000000000.0) {
tmp = x / y;
} else if ((x / y) <= 42.0) {
tmp = (2.0 / t) - 2.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -31000000000.0: tmp = x / y elif (x / y) <= 42.0: tmp = (2.0 / t) - 2.0 else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -31000000000.0) tmp = Float64(x / y); elseif (Float64(x / y) <= 42.0) tmp = Float64(Float64(2.0 / t) - 2.0); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -31000000000.0) tmp = x / y; elseif ((x / y) <= 42.0) tmp = (2.0 / t) - 2.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -31000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 42.0], N[(N[(2.0 / t), $MachinePrecision] - 2.0), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -31000000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 42:\\
\;\;\;\;\frac{2}{t} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -3.1e10 or 42 < (/.f64 x y) Initial program 85.0%
Taylor expanded in x around inf
lift-/.f6470.5
Applied rewrites70.5%
if -3.1e10 < (/.f64 x y) < 42Initial program 86.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-/.f6463.0
Applied rewrites63.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f6461.7
Applied rewrites61.7%
Taylor expanded in t around inf
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6461.7
Applied rewrites61.7%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -31000000000.0) (/ x y) (if (<= (/ x y) -4.4e-169) (/ 2.0 t) (if (<= (/ x y) 0.1) -2.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -31000000000.0) {
tmp = x / y;
} else if ((x / y) <= -4.4e-169) {
tmp = 2.0 / t;
} else if ((x / y) <= 0.1) {
tmp = -2.0;
} else {
tmp = x / y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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) :: tmp
if ((x / y) <= (-31000000000.0d0)) then
tmp = x / y
else if ((x / y) <= (-4.4d-169)) then
tmp = 2.0d0 / t
else if ((x / y) <= 0.1d0) then
tmp = -2.0d0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -31000000000.0) {
tmp = x / y;
} else if ((x / y) <= -4.4e-169) {
tmp = 2.0 / t;
} else if ((x / y) <= 0.1) {
tmp = -2.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -31000000000.0: tmp = x / y elif (x / y) <= -4.4e-169: tmp = 2.0 / t elif (x / y) <= 0.1: tmp = -2.0 else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -31000000000.0) tmp = Float64(x / y); elseif (Float64(x / y) <= -4.4e-169) tmp = Float64(2.0 / t); elseif (Float64(x / y) <= 0.1) tmp = -2.0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -31000000000.0) tmp = x / y; elseif ((x / y) <= -4.4e-169) tmp = 2.0 / t; elseif ((x / y) <= 0.1) tmp = -2.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -31000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -4.4e-169], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 0.1], -2.0, N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -31000000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -4.4 \cdot 10^{-169}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 0.1:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -3.1e10 or 0.10000000000000001 < (/.f64 x y) Initial program 85.0%
Taylor expanded in x around inf
lift-/.f6470.2
Applied rewrites70.2%
if -3.1e10 < (/.f64 x y) < -4.40000000000000015e-169Initial program 87.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-/.f6463.3
Applied rewrites63.3%
Taylor expanded in t around 0
lift-/.f6426.6
Applied rewrites26.6%
if -4.40000000000000015e-169 < (/.f64 x y) < 0.10000000000000001Initial program 86.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f6499.4
Applied rewrites99.4%
Taylor expanded in t around inf
Applied rewrites37.7%
(FPCore (x y z t) :precision binary64 (if (<= t -1.0) -2.0 (if (<= t 4.8e+64) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.0) {
tmp = -2.0;
} else if (t <= 4.8e+64) {
tmp = 2.0 / t;
} else {
tmp = -2.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)
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) :: tmp
if (t <= (-1.0d0)) then
tmp = -2.0d0
else if (t <= 4.8d+64) then
tmp = 2.0d0 / t
else
tmp = -2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.0) {
tmp = -2.0;
} else if (t <= 4.8e+64) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.0: tmp = -2.0 elif t <= 4.8e+64: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.0) tmp = -2.0; elseif (t <= 4.8e+64) tmp = Float64(2.0 / t); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.0) tmp = -2.0; elseif (t <= 4.8e+64) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.0], -2.0, If[LessEqual[t, 4.8e+64], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{+64}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -1 or 4.79999999999999999e64 < t Initial program 71.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f6453.8
Applied rewrites53.8%
Taylor expanded in t around inf
Applied rewrites39.2%
if -1 < t < 4.79999999999999999e64Initial program 97.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-/.f6459.9
Applied rewrites59.9%
Taylor expanded in t around 0
lift-/.f6433.4
Applied rewrites33.4%
(FPCore (x y z t) :precision binary64 -2.0)
double code(double x, double y, double z, double t) {
return -2.0;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -2.0d0
end function
public static double code(double x, double y, double z, double t) {
return -2.0;
}
def code(x, y, z, t): return -2.0
function code(x, y, z, t) return -2.0 end
function tmp = code(x, y, z, t) tmp = -2.0; end
code[x_, y_, z_, t_] := -2.0
\begin{array}{l}
\\
-2
\end{array}
Initial program 85.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f6466.4
Applied rewrites66.4%
Taylor expanded in t around inf
Applied rewrites20.3%
herbie shell --seed 2025110
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))