
(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x)))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}
\end{array}
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x)))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}
\end{array}
(FPCore (x y z) :precision binary64 (fma (fma z (- y -0.0007936500793651) -0.0027777777777778) (/ z x) (- (/ 0.083333333333333 x) (fma (- 0.5 x) (log x) (- x 0.91893853320467)))))
double code(double x, double y, double z) {
return fma(fma(z, (y - -0.0007936500793651), -0.0027777777777778), (z / x), ((0.083333333333333 / x) - fma((0.5 - x), log(x), (x - 0.91893853320467))));
}
function code(x, y, z) return fma(fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778), Float64(z / x), Float64(Float64(0.083333333333333 / x) - fma(Float64(0.5 - x), log(x), Float64(x - 0.91893853320467)))) end
code[x_, y_, z_] := N[(N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] - N[(N[(0.5 - x), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), \frac{z}{x}, \frac{0.083333333333333}{x} - \mathsf{fma}\left(0.5 - x, \log x, x - 0.91893853320467\right)\right)
\end{array}
Initial program 94.0%
Applied rewrites98.8%
(FPCore (x y z) :precision binary64 (fma (/ (fma z (- y -0.0007936500793651) -0.0027777777777778) x) z (- (/ 0.083333333333333 x) (fma (- 0.5 x) (log x) (- x 0.91893853320467)))))
double code(double x, double y, double z) {
return fma((fma(z, (y - -0.0007936500793651), -0.0027777777777778) / x), z, ((0.083333333333333 / x) - fma((0.5 - x), log(x), (x - 0.91893853320467))));
}
function code(x, y, z) return fma(Float64(fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778) / x), z, Float64(Float64(0.083333333333333 / x) - fma(Float64(0.5 - x), log(x), Float64(x - 0.91893853320467)))) end
code[x_, y_, z_] := N[(N[(N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] / x), $MachinePrecision] * z + N[(N[(0.083333333333333 / x), $MachinePrecision] - N[(N[(0.5 - x), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right)}{x}, z, \frac{0.083333333333333}{x} - \mathsf{fma}\left(0.5 - x, \log x, x - 0.91893853320467\right)\right)
\end{array}
Initial program 94.0%
Applied rewrites97.9%
(FPCore (x y z)
:precision binary64
(if (<= x 1.35e+155)
(fma
(- x 0.5)
(log x)
(-
(- 0.91893853320467 x)
(/
(fma
(fma (- -0.0007936500793651 y) z 0.0027777777777778)
z
-0.083333333333333)
x)))
(fma
(/ (fma z 0.0007936500793651 -0.0027777777777778) x)
z
(-
(/ 0.083333333333333 x)
(fma (- 0.5 x) (log x) (- x 0.91893853320467))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.35e+155) {
tmp = fma((x - 0.5), log(x), ((0.91893853320467 - x) - (fma(fma((-0.0007936500793651 - y), z, 0.0027777777777778), z, -0.083333333333333) / x)));
} else {
tmp = fma((fma(z, 0.0007936500793651, -0.0027777777777778) / x), z, ((0.083333333333333 / x) - fma((0.5 - x), log(x), (x - 0.91893853320467))));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1.35e+155) tmp = fma(Float64(x - 0.5), log(x), Float64(Float64(0.91893853320467 - x) - Float64(fma(fma(Float64(-0.0007936500793651 - y), z, 0.0027777777777778), z, -0.083333333333333) / x))); else tmp = fma(Float64(fma(z, 0.0007936500793651, -0.0027777777777778) / x), z, Float64(Float64(0.083333333333333 / x) - fma(Float64(0.5 - x), log(x), Float64(x - 0.91893853320467)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1.35e+155], N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(N[(0.91893853320467 - x), $MachinePrecision] - N[(N[(N[(N[(-0.0007936500793651 - y), $MachinePrecision] * z + 0.0027777777777778), $MachinePrecision] * z + -0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * 0.0007936500793651 + -0.0027777777777778), $MachinePrecision] / x), $MachinePrecision] * z + N[(N[(0.083333333333333 / x), $MachinePrecision] - N[(N[(0.5 - x), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+155}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \left(0.91893853320467 - x\right) - \frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.0007936500793651 - y, z, 0.0027777777777778\right), z, -0.083333333333333\right)}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(z, 0.0007936500793651, -0.0027777777777778\right)}{x}, z, \frac{0.083333333333333}{x} - \mathsf{fma}\left(0.5 - x, \log x, x - 0.91893853320467\right)\right)\\
\end{array}
\end{array}
if x < 1.34999999999999997e155Initial program 94.0%
Applied rewrites94.1%
if 1.34999999999999997e155 < x Initial program 94.0%
Applied rewrites97.9%
Taylor expanded in y around 0
Applied rewrites80.7%
(FPCore (x y z)
:precision binary64
(if (<=
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
5e+286)
(fma
(- x 0.5)
(log x)
(-
(- 0.91893853320467 x)
(/
(fma
(fma (- -0.0007936500793651 y) z 0.0027777777777778)
z
-0.083333333333333)
x)))
(fma
z
(-
(* z (fma 0.0007936500793651 (/ 1.0 x) (/ y x)))
(* 0.0027777777777778 (/ 1.0 x)))
(* 0.083333333333333 (/ 1.0 x)))))
double code(double x, double y, double z) {
double tmp;
if ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) <= 5e+286) {
tmp = fma((x - 0.5), log(x), ((0.91893853320467 - x) - (fma(fma((-0.0007936500793651 - y), z, 0.0027777777777778), z, -0.083333333333333) / x)));
} else {
tmp = fma(z, ((z * fma(0.0007936500793651, (1.0 / x), (y / x))) - (0.0027777777777778 * (1.0 / x))), (0.083333333333333 * (1.0 / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) <= 5e+286) tmp = fma(Float64(x - 0.5), log(x), Float64(Float64(0.91893853320467 - x) - Float64(fma(fma(Float64(-0.0007936500793651 - y), z, 0.0027777777777778), z, -0.083333333333333) / x))); else tmp = fma(z, Float64(Float64(z * fma(0.0007936500793651, Float64(1.0 / x), Float64(y / x))) - Float64(0.0027777777777778 * Float64(1.0 / x))), Float64(0.083333333333333 * Float64(1.0 / x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision], 5e+286], N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(N[(0.91893853320467 - x), $MachinePrecision] - N[(N[(N[(N[(-0.0007936500793651 - y), $MachinePrecision] * z + 0.0027777777777778), $MachinePrecision] * z + -0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(z * N[(0.0007936500793651 * N[(1.0 / x), $MachinePrecision] + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.0027777777777778 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \left(0.91893853320467 - x\right) - \frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.0007936500793651 - y, z, 0.0027777777777778\right), z, -0.083333333333333\right)}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, z \cdot \mathsf{fma}\left(0.0007936500793651, \frac{1}{x}, \frac{y}{x}\right) - 0.0027777777777778 \cdot \frac{1}{x}, 0.083333333333333 \cdot \frac{1}{x}\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5.0000000000000004e286Initial program 94.0%
Applied rewrites94.1%
if 5.0000000000000004e286 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6460.3
Applied rewrites60.3%
(FPCore (x y z)
:precision binary64
(if (<=
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
5e+286)
(fma
(- x 0.5)
(log x)
(-
(- 0.91893853320467 x)
(/
(fma
(fma (- -0.0007936500793651 y) z 0.0027777777777778)
z
-0.083333333333333)
x)))
(* (* (/ (- y -0.0007936500793651) x) z) z)))
double code(double x, double y, double z) {
double tmp;
if ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) <= 5e+286) {
tmp = fma((x - 0.5), log(x), ((0.91893853320467 - x) - (fma(fma((-0.0007936500793651 - y), z, 0.0027777777777778), z, -0.083333333333333) / x)));
} else {
tmp = (((y - -0.0007936500793651) / x) * z) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) <= 5e+286) tmp = fma(Float64(x - 0.5), log(x), Float64(Float64(0.91893853320467 - x) - Float64(fma(fma(Float64(-0.0007936500793651 - y), z, 0.0027777777777778), z, -0.083333333333333) / x))); else tmp = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision], 5e+286], N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(N[(0.91893853320467 - x), $MachinePrecision] - N[(N[(N[(N[(-0.0007936500793651 - y), $MachinePrecision] * z + 0.0027777777777778), $MachinePrecision] * z + -0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \left(0.91893853320467 - x\right) - \frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.0007936500793651 - y, z, 0.0027777777777778\right), z, -0.083333333333333\right)}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5.0000000000000004e286Initial program 94.0%
Applied rewrites94.1%
if 5.0000000000000004e286 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 94.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6443.6
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6443.6
Applied rewrites43.6%
(FPCore (x y z)
:precision binary64
(if (<=
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
5e+286)
(-
(fma
(log x)
(- x 0.5)
(/
(fma
(fma z (- y -0.0007936500793651) -0.0027777777777778)
z
0.083333333333333)
x))
(- x 0.91893853320467))
(* (* (/ (- y -0.0007936500793651) x) z) z)))
double code(double x, double y, double z) {
double tmp;
if ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) <= 5e+286) {
tmp = fma(log(x), (x - 0.5), (fma(fma(z, (y - -0.0007936500793651), -0.0027777777777778), z, 0.083333333333333) / x)) - (x - 0.91893853320467);
} else {
tmp = (((y - -0.0007936500793651) / x) * z) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) <= 5e+286) tmp = Float64(fma(log(x), Float64(x - 0.5), Float64(fma(fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778), z, 0.083333333333333) / x)) - Float64(x - 0.91893853320467)); else tmp = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision], 5e+286], N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + N[(N[(N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;\mathsf{fma}\left(\log x, x - 0.5, \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\right) - \left(x - 0.91893853320467\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5.0000000000000004e286Initial program 94.0%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites94.0%
if 5.0000000000000004e286 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 94.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6443.6
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6443.6
Applied rewrites43.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(-
(/ (fma (* z y) z 0.083333333333333) x)
(fma (- 0.5 x) (log x) (- x 0.91893853320467)))))
(if (<= y -0.0008)
t_0
(if (<= y 0.00088)
(fma
(- x 0.5)
(log x)
(-
(- 0.91893853320467 x)
(/
(fma
(fma -0.0007936500793651 z 0.0027777777777778)
z
-0.083333333333333)
x)))
t_0))))
double code(double x, double y, double z) {
double t_0 = (fma((z * y), z, 0.083333333333333) / x) - fma((0.5 - x), log(x), (x - 0.91893853320467));
double tmp;
if (y <= -0.0008) {
tmp = t_0;
} else if (y <= 0.00088) {
tmp = fma((x - 0.5), log(x), ((0.91893853320467 - x) - (fma(fma(-0.0007936500793651, z, 0.0027777777777778), z, -0.083333333333333) / x)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(fma(Float64(z * y), z, 0.083333333333333) / x) - fma(Float64(0.5 - x), log(x), Float64(x - 0.91893853320467))) tmp = 0.0 if (y <= -0.0008) tmp = t_0; elseif (y <= 0.00088) tmp = fma(Float64(x - 0.5), log(x), Float64(Float64(0.91893853320467 - x) - Float64(fma(fma(-0.0007936500793651, z, 0.0027777777777778), z, -0.083333333333333) / x))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(z * y), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision] - N[(N[(0.5 - x), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.0008], t$95$0, If[LessEqual[y, 0.00088], N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(N[(0.91893853320467 - x), $MachinePrecision] - N[(N[(N[(-0.0007936500793651 * z + 0.0027777777777778), $MachinePrecision] * z + -0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(z \cdot y, z, 0.083333333333333\right)}{x} - \mathsf{fma}\left(0.5 - x, \log x, x - 0.91893853320467\right)\\
\mathbf{if}\;y \leq -0.0008:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.00088:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \left(0.91893853320467 - x\right) - \frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.0007936500793651, z, 0.0027777777777778\right), z, -0.083333333333333\right)}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -8.00000000000000038e-4 or 8.80000000000000031e-4 < y Initial program 94.0%
Taylor expanded in y around inf
lower-*.f6482.3
Applied rewrites82.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
sub-flip-reverseN/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift--.f64N/A
sub-negate-revN/A
lift-log.f64N/A
+-commutativeN/A
Applied rewrites82.4%
if -8.00000000000000038e-4 < y < 8.80000000000000031e-4Initial program 94.0%
Applied rewrites94.1%
Taylor expanded in y around 0
Applied rewrites78.3%
(FPCore (x y z)
:precision binary64
(if (<= x 1.85)
(/
1.0
(/
x
(fma
(fma (- y -0.0007936500793651) z -0.0027777777777778)
z
0.083333333333333)))
(-
(/ (fma (* z y) z 0.083333333333333) x)
(fma (- 0.5 x) (log x) (- x 0.91893853320467)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.85) {
tmp = 1.0 / (x / fma(fma((y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333));
} else {
tmp = (fma((z * y), z, 0.083333333333333) / x) - fma((0.5 - x), log(x), (x - 0.91893853320467));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1.85) tmp = Float64(1.0 / Float64(x / fma(fma(Float64(y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333))); else tmp = Float64(Float64(fma(Float64(z * y), z, 0.083333333333333) / x) - fma(Float64(0.5 - x), log(x), Float64(x - 0.91893853320467))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1.85], N[(1.0 / N[(x / N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(z * y), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision] - N[(N[(0.5 - x), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.85:\\
\;\;\;\;\frac{1}{\frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z \cdot y, z, 0.083333333333333\right)}{x} - \mathsf{fma}\left(0.5 - x, \log x, x - 0.91893853320467\right)\\
\end{array}
\end{array}
if x < 1.8500000000000001Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
lift-fma.f64N/A
lift-fma.f64N/A
lower-unsound-/.f6462.4
Applied rewrites62.4%
if 1.8500000000000001 < x Initial program 94.0%
Taylor expanded in y around inf
lower-*.f6482.3
Applied rewrites82.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
sub-flip-reverseN/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift--.f64N/A
sub-negate-revN/A
lift-log.f64N/A
+-commutativeN/A
Applied rewrites82.4%
(FPCore (x y z)
:precision binary64
(if (<= x 6.6e+33)
(/
1.0
(/
x
(fma
(fma (- y -0.0007936500793651) z -0.0027777777777778)
z
0.083333333333333)))
(* x (- (* -1.0 (log (/ 1.0 x))) 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 6.6e+33) {
tmp = 1.0 / (x / fma(fma((y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333));
} else {
tmp = x * ((-1.0 * log((1.0 / x))) - 1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 6.6e+33) tmp = Float64(1.0 / Float64(x / fma(fma(Float64(y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333))); else tmp = Float64(x * Float64(Float64(-1.0 * log(Float64(1.0 / x))) - 1.0)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 6.6e+33], N[(1.0 / N[(x / N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(-1.0 * N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.6 \cdot 10^{+33}:\\
\;\;\;\;\frac{1}{\frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right)\\
\end{array}
\end{array}
if x < 6.59999999999999953e33Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
lift-fma.f64N/A
lift-fma.f64N/A
lower-unsound-/.f6462.4
Applied rewrites62.4%
if 6.59999999999999953e33 < x Initial program 94.0%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6435.6
Applied rewrites35.6%
(FPCore (x y z)
:precision binary64
(if (<= x 6.6e+33)
(/
(fma
(fma (- y -0.0007936500793651) z -0.0027777777777778)
z
0.083333333333333)
x)
(* x (- (* -1.0 (log (/ 1.0 x))) 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 6.6e+33) {
tmp = fma(fma((y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = x * ((-1.0 * log((1.0 / x))) - 1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 6.6e+33) tmp = Float64(fma(fma(Float64(y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(x * Float64(Float64(-1.0 * log(Float64(1.0 / x))) - 1.0)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 6.6e+33], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(x * N[(N[(-1.0 * N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.6 \cdot 10^{+33}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right)\\
\end{array}
\end{array}
if x < 6.59999999999999953e33Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Applied rewrites62.4%
if 6.59999999999999953e33 < x Initial program 94.0%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6435.6
Applied rewrites35.6%
(FPCore (x y z)
:precision binary64
(if (<= x 1.22e+120)
(/
(fma
(fma (- y -0.0007936500793651) z -0.0027777777777778)
z
0.083333333333333)
x)
(* (* (/ (- y -0.0007936500793651) x) z) z)))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.22e+120) {
tmp = fma(fma((y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = (((y - -0.0007936500793651) / x) * z) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1.22e+120) tmp = Float64(fma(fma(Float64(y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1.22e+120], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.22 \cdot 10^{+120}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
\end{array}
\end{array}
if x < 1.22e120Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Applied rewrites62.4%
if 1.22e120 < x Initial program 94.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6443.6
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6443.6
Applied rewrites43.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)))
(if (<= t_0 -50.0)
(* (- y -0.0007936500793651) (/ (* z z) x))
(if (<= t_0 5e+25)
(/
(+
0.083333333333333
(* z (- (* 0.0007936500793651 z) 0.0027777777777778)))
x)
(* (* (/ (- y -0.0007936500793651) x) z) z)))))
double code(double x, double y, double z) {
double t_0 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_0 <= -50.0) {
tmp = (y - -0.0007936500793651) * ((z * z) / x);
} else if (t_0 <= 5e+25) {
tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / x;
} else {
tmp = (((y - -0.0007936500793651) / x) * z) * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0
if (t_0 <= (-50.0d0)) then
tmp = (y - (-0.0007936500793651d0)) * ((z * z) / x)
else if (t_0 <= 5d+25) then
tmp = (0.083333333333333d0 + (z * ((0.0007936500793651d0 * z) - 0.0027777777777778d0))) / x
else
tmp = (((y - (-0.0007936500793651d0)) / x) * z) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_0 <= -50.0) {
tmp = (y - -0.0007936500793651) * ((z * z) / x);
} else if (t_0 <= 5e+25) {
tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / x;
} else {
tmp = (((y - -0.0007936500793651) / x) * z) * z;
}
return tmp;
}
def code(x, y, z): t_0 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333 tmp = 0 if t_0 <= -50.0: tmp = (y - -0.0007936500793651) * ((z * z) / x) elif t_0 <= 5e+25: tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / x else: tmp = (((y - -0.0007936500793651) / x) * z) * z return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) tmp = 0.0 if (t_0 <= -50.0) tmp = Float64(Float64(y - -0.0007936500793651) * Float64(Float64(z * z) / x)); elseif (t_0 <= 5e+25) tmp = Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(0.0007936500793651 * z) - 0.0027777777777778))) / x); else tmp = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333; tmp = 0.0; if (t_0 <= -50.0) tmp = (y - -0.0007936500793651) * ((z * z) / x); elseif (t_0 <= 5e+25) tmp = (0.083333333333333 + (z * ((0.0007936500793651 * z) - 0.0027777777777778))) / x; else tmp = (((y - -0.0007936500793651) / x) * z) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision]}, If[LessEqual[t$95$0, -50.0], N[(N[(y - -0.0007936500793651), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+25], N[(N[(0.083333333333333 + N[(z * N[(N[(0.0007936500793651 * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_0 \leq -50:\\
\;\;\;\;\left(y - -0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+25}:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(0.0007936500793651 \cdot z - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -50Initial program 94.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6441.7
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6441.7
lift-pow.f64N/A
unpow2N/A
lower-*.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6442.6
Applied rewrites42.6%
if -50 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5.00000000000000024e25Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in y around 0
lower-*.f6446.0
Applied rewrites46.0%
if 5.00000000000000024e25 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 94.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6443.6
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6443.6
Applied rewrites43.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)))
(if (<= t_0 -50.0)
(* (- y -0.0007936500793651) (/ (* z z) x))
(if (<= t_0 0.1)
(/ 1.0 (/ x 0.083333333333333))
(* (* (/ (- y -0.0007936500793651) x) z) z)))))
double code(double x, double y, double z) {
double t_0 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_0 <= -50.0) {
tmp = (y - -0.0007936500793651) * ((z * z) / x);
} else if (t_0 <= 0.1) {
tmp = 1.0 / (x / 0.083333333333333);
} else {
tmp = (((y - -0.0007936500793651) / x) * z) * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0
if (t_0 <= (-50.0d0)) then
tmp = (y - (-0.0007936500793651d0)) * ((z * z) / x)
else if (t_0 <= 0.1d0) then
tmp = 1.0d0 / (x / 0.083333333333333d0)
else
tmp = (((y - (-0.0007936500793651d0)) / x) * z) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_0 <= -50.0) {
tmp = (y - -0.0007936500793651) * ((z * z) / x);
} else if (t_0 <= 0.1) {
tmp = 1.0 / (x / 0.083333333333333);
} else {
tmp = (((y - -0.0007936500793651) / x) * z) * z;
}
return tmp;
}
def code(x, y, z): t_0 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333 tmp = 0 if t_0 <= -50.0: tmp = (y - -0.0007936500793651) * ((z * z) / x) elif t_0 <= 0.1: tmp = 1.0 / (x / 0.083333333333333) else: tmp = (((y - -0.0007936500793651) / x) * z) * z return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) tmp = 0.0 if (t_0 <= -50.0) tmp = Float64(Float64(y - -0.0007936500793651) * Float64(Float64(z * z) / x)); elseif (t_0 <= 0.1) tmp = Float64(1.0 / Float64(x / 0.083333333333333)); else tmp = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333; tmp = 0.0; if (t_0 <= -50.0) tmp = (y - -0.0007936500793651) * ((z * z) / x); elseif (t_0 <= 0.1) tmp = 1.0 / (x / 0.083333333333333); else tmp = (((y - -0.0007936500793651) / x) * z) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision]}, If[LessEqual[t$95$0, -50.0], N[(N[(y - -0.0007936500793651), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.1], N[(1.0 / N[(x / 0.083333333333333), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_0 \leq -50:\\
\;\;\;\;\left(y - -0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\
\mathbf{elif}\;t\_0 \leq 0.1:\\
\;\;\;\;\frac{1}{\frac{x}{0.083333333333333}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -50Initial program 94.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6441.7
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6441.7
lift-pow.f64N/A
unpow2N/A
lower-*.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6442.6
Applied rewrites42.6%
if -50 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 0.10000000000000001Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites23.1%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6423.1
Applied rewrites23.1%
if 0.10000000000000001 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 94.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6443.6
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6443.6
Applied rewrites43.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* (/ (- y -0.0007936500793651) x) z) z))
(t_1
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)))
(if (<= t_1 -50.0)
t_0
(if (<= t_1 0.1) (/ 1.0 (/ x 0.083333333333333)) t_0))))
double code(double x, double y, double z) {
double t_0 = (((y - -0.0007936500793651) / x) * z) * z;
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 0.1) {
tmp = 1.0 / (x / 0.083333333333333);
} else {
tmp = t_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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((y - (-0.0007936500793651d0)) / x) * z) * z
t_1 = ((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0
if (t_1 <= (-50.0d0)) then
tmp = t_0
else if (t_1 <= 0.1d0) then
tmp = 1.0d0 / (x / 0.083333333333333d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (((y - -0.0007936500793651) / x) * z) * z;
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -50.0) {
tmp = t_0;
} else if (t_1 <= 0.1) {
tmp = 1.0 / (x / 0.083333333333333);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (((y - -0.0007936500793651) / x) * z) * z t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333 tmp = 0 if t_1 <= -50.0: tmp = t_0 elif t_1 <= 0.1: tmp = 1.0 / (x / 0.083333333333333) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(y - -0.0007936500793651) / x) * z) * z) t_1 = Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) tmp = 0.0 if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 0.1) tmp = Float64(1.0 / Float64(x / 0.083333333333333)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (((y - -0.0007936500793651) / x) * z) * z; t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333; tmp = 0.0; if (t_1 <= -50.0) tmp = t_0; elseif (t_1 <= 0.1) tmp = 1.0 / (x / 0.083333333333333); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 0.1], N[(1.0 / N[(x / 0.083333333333333), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\frac{y - -0.0007936500793651}{x} \cdot z\right) \cdot z\\
t_1 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_1 \leq -50:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\frac{1}{\frac{x}{0.083333333333333}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -50 or 0.10000000000000001 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 94.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6443.6
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6443.6
Applied rewrites43.6%
if -50 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 0.10000000000000001Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites23.1%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6423.1
Applied rewrites23.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)))
(if (<= t_0 -50.0)
(* (/ y x) (* z z))
(if (<= t_0 2e-18)
(/ 1.0 (/ x 0.083333333333333))
(* (/ 0.0007936500793651 x) (* z z))))))
double code(double x, double y, double z) {
double t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z;
double tmp;
if (t_0 <= -50.0) {
tmp = (y / x) * (z * z);
} else if (t_0 <= 2e-18) {
tmp = 1.0 / (x / 0.083333333333333);
} else {
tmp = (0.0007936500793651 / x) * (z * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z
if (t_0 <= (-50.0d0)) then
tmp = (y / x) * (z * z)
else if (t_0 <= 2d-18) then
tmp = 1.0d0 / (x / 0.083333333333333d0)
else
tmp = (0.0007936500793651d0 / x) * (z * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z;
double tmp;
if (t_0 <= -50.0) {
tmp = (y / x) * (z * z);
} else if (t_0 <= 2e-18) {
tmp = 1.0 / (x / 0.083333333333333);
} else {
tmp = (0.0007936500793651 / x) * (z * z);
}
return tmp;
}
def code(x, y, z): t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z tmp = 0 if t_0 <= -50.0: tmp = (y / x) * (z * z) elif t_0 <= 2e-18: tmp = 1.0 / (x / 0.083333333333333) else: tmp = (0.0007936500793651 / x) * (z * z) return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) tmp = 0.0 if (t_0 <= -50.0) tmp = Float64(Float64(y / x) * Float64(z * z)); elseif (t_0 <= 2e-18) tmp = Float64(1.0 / Float64(x / 0.083333333333333)); else tmp = Float64(Float64(0.0007936500793651 / x) * Float64(z * z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z; tmp = 0.0; if (t_0 <= -50.0) tmp = (y / x) * (z * z); elseif (t_0 <= 2e-18) tmp = 1.0 / (x / 0.083333333333333); else tmp = (0.0007936500793651 / x) * (z * z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$0, -50.0], N[(N[(y / x), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-18], N[(1.0 / N[(x / 0.083333333333333), $MachinePrecision]), $MachinePrecision], N[(N[(0.0007936500793651 / x), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z\\
\mathbf{if}\;t\_0 \leq -50:\\
\;\;\;\;\frac{y}{x} \cdot \left(z \cdot z\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-18}:\\
\;\;\;\;\frac{1}{\frac{x}{0.083333333333333}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.0007936500793651}{x} \cdot \left(z \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < -50Initial program 94.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6441.7
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6441.7
lift-pow.f64N/A
unpow2N/A
lower-*.f6441.7
Applied rewrites41.7%
Taylor expanded in y around inf
lower-/.f6429.7
Applied rewrites29.7%
if -50 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 2.0000000000000001e-18Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites23.1%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6423.1
Applied rewrites23.1%
if 2.0000000000000001e-18 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 94.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6441.7
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6441.7
lift-pow.f64N/A
unpow2N/A
lower-*.f6441.7
Applied rewrites41.7%
Taylor expanded in y around 0
Applied rewrites25.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z))
(t_1 (* (/ y x) (* z z))))
(if (<= t_0 -50.0)
t_1
(if (<= t_0 5e+25) (/ 1.0 (/ x 0.083333333333333)) t_1))))
double code(double x, double y, double z) {
double t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z;
double t_1 = (y / x) * (z * z);
double tmp;
if (t_0 <= -50.0) {
tmp = t_1;
} else if (t_0 <= 5e+25) {
tmp = 1.0 / (x / 0.083333333333333);
} 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z
t_1 = (y / x) * (z * z)
if (t_0 <= (-50.0d0)) then
tmp = t_1
else if (t_0 <= 5d+25) then
tmp = 1.0d0 / (x / 0.083333333333333d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z;
double t_1 = (y / x) * (z * z);
double tmp;
if (t_0 <= -50.0) {
tmp = t_1;
} else if (t_0 <= 5e+25) {
tmp = 1.0 / (x / 0.083333333333333);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z t_1 = (y / x) * (z * z) tmp = 0 if t_0 <= -50.0: tmp = t_1 elif t_0 <= 5e+25: tmp = 1.0 / (x / 0.083333333333333) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) t_1 = Float64(Float64(y / x) * Float64(z * z)) tmp = 0.0 if (t_0 <= -50.0) tmp = t_1; elseif (t_0 <= 5e+25) tmp = Float64(1.0 / Float64(x / 0.083333333333333)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z; t_1 = (y / x) * (z * z); tmp = 0.0; if (t_0 <= -50.0) tmp = t_1; elseif (t_0 <= 5e+25) tmp = 1.0 / (x / 0.083333333333333); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y / x), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -50.0], t$95$1, If[LessEqual[t$95$0, 5e+25], N[(1.0 / N[(x / 0.083333333333333), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z\\
t_1 := \frac{y}{x} \cdot \left(z \cdot z\right)\\
\mathbf{if}\;t\_0 \leq -50:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+25}:\\
\;\;\;\;\frac{1}{\frac{x}{0.083333333333333}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < -50 or 5.00000000000000024e25 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 94.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6441.7
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6441.7
lift-pow.f64N/A
unpow2N/A
lower-*.f6441.7
Applied rewrites41.7%
Taylor expanded in y around inf
lower-/.f6429.7
Applied rewrites29.7%
if -50 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 5.00000000000000024e25Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites23.1%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6423.1
Applied rewrites23.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))))
(if (<= t_0 -2e+66)
(* -0.0027777777777778 (/ z x))
(if (<= t_0 5e+299)
(/ 1.0 (/ x 0.083333333333333))
(/ (* -0.0027777777777778 z) x)))))
double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= -2e+66) {
tmp = -0.0027777777777778 * (z / x);
} else if (t_0 <= 5e+299) {
tmp = 1.0 / (x / 0.083333333333333);
} else {
tmp = (-0.0027777777777778 * z) / x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
if (t_0 <= (-2d+66)) then
tmp = (-0.0027777777777778d0) * (z / x)
else if (t_0 <= 5d+299) then
tmp = 1.0d0 / (x / 0.083333333333333d0)
else
tmp = ((-0.0027777777777778d0) * z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= -2e+66) {
tmp = -0.0027777777777778 * (z / x);
} else if (t_0 <= 5e+299) {
tmp = 1.0 / (x / 0.083333333333333);
} else {
tmp = (-0.0027777777777778 * z) / x;
}
return tmp;
}
def code(x, y, z): t_0 = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) tmp = 0 if t_0 <= -2e+66: tmp = -0.0027777777777778 * (z / x) elif t_0 <= 5e+299: tmp = 1.0 / (x / 0.083333333333333) else: tmp = (-0.0027777777777778 * z) / x return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) tmp = 0.0 if (t_0 <= -2e+66) tmp = Float64(-0.0027777777777778 * Float64(z / x)); elseif (t_0 <= 5e+299) tmp = Float64(1.0 / Float64(x / 0.083333333333333)); else tmp = Float64(Float64(-0.0027777777777778 * z) / x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); tmp = 0.0; if (t_0 <= -2e+66) tmp = -0.0027777777777778 * (z / x); elseif (t_0 <= 5e+299) tmp = 1.0 / (x / 0.083333333333333); else tmp = (-0.0027777777777778 * z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+66], N[(-0.0027777777777778 * N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+299], N[(1.0 / N[(x / 0.083333333333333), $MachinePrecision]), $MachinePrecision], N[(N[(-0.0027777777777778 * z), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+66}:\\
\;\;\;\;-0.0027777777777778 \cdot \frac{z}{x}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+299}:\\
\;\;\;\;\frac{1}{\frac{x}{0.083333333333333}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.0027777777777778 \cdot z}{x}\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < -1.99999999999999989e66Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f648.7
Applied rewrites8.7%
if -1.99999999999999989e66 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 5.0000000000000003e299Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites23.1%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6423.1
Applied rewrites23.1%
if 5.0000000000000003e299 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f648.7
Applied rewrites8.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f648.7
Applied rewrites8.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))))
(if (<= t_0 -2e+66)
(* -0.0027777777777778 (/ z x))
(if (<= t_0 5e+299)
(/ 0.083333333333333 x)
(/ (* -0.0027777777777778 z) x)))))
double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= -2e+66) {
tmp = -0.0027777777777778 * (z / x);
} else if (t_0 <= 5e+299) {
tmp = 0.083333333333333 / x;
} else {
tmp = (-0.0027777777777778 * z) / x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
if (t_0 <= (-2d+66)) then
tmp = (-0.0027777777777778d0) * (z / x)
else if (t_0 <= 5d+299) then
tmp = 0.083333333333333d0 / x
else
tmp = ((-0.0027777777777778d0) * z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= -2e+66) {
tmp = -0.0027777777777778 * (z / x);
} else if (t_0 <= 5e+299) {
tmp = 0.083333333333333 / x;
} else {
tmp = (-0.0027777777777778 * z) / x;
}
return tmp;
}
def code(x, y, z): t_0 = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) tmp = 0 if t_0 <= -2e+66: tmp = -0.0027777777777778 * (z / x) elif t_0 <= 5e+299: tmp = 0.083333333333333 / x else: tmp = (-0.0027777777777778 * z) / x return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) tmp = 0.0 if (t_0 <= -2e+66) tmp = Float64(-0.0027777777777778 * Float64(z / x)); elseif (t_0 <= 5e+299) tmp = Float64(0.083333333333333 / x); else tmp = Float64(Float64(-0.0027777777777778 * z) / x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); tmp = 0.0; if (t_0 <= -2e+66) tmp = -0.0027777777777778 * (z / x); elseif (t_0 <= 5e+299) tmp = 0.083333333333333 / x; else tmp = (-0.0027777777777778 * z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+66], N[(-0.0027777777777778 * N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+299], N[(0.083333333333333 / x), $MachinePrecision], N[(N[(-0.0027777777777778 * z), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+66}:\\
\;\;\;\;-0.0027777777777778 \cdot \frac{z}{x}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+299}:\\
\;\;\;\;\frac{0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.0027777777777778 \cdot z}{x}\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < -1.99999999999999989e66Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f648.7
Applied rewrites8.7%
if -1.99999999999999989e66 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 5.0000000000000003e299Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites23.1%
if 5.0000000000000003e299 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f648.7
Applied rewrites8.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f648.7
Applied rewrites8.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x)))
(t_1 (* -0.0027777777777778 (/ z x))))
(if (<= t_0 -2e+66) t_1 (if (<= t_0 5e+299) (/ 0.083333333333333 x) t_1))))
double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double t_1 = -0.0027777777777778 * (z / x);
double tmp;
if (t_0 <= -2e+66) {
tmp = t_1;
} else if (t_0 <= 5e+299) {
tmp = 0.083333333333333 / x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
t_1 = (-0.0027777777777778d0) * (z / x)
if (t_0 <= (-2d+66)) then
tmp = t_1
else if (t_0 <= 5d+299) then
tmp = 0.083333333333333d0 / x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double t_1 = -0.0027777777777778 * (z / x);
double tmp;
if (t_0 <= -2e+66) {
tmp = t_1;
} else if (t_0 <= 5e+299) {
tmp = 0.083333333333333 / x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) t_1 = -0.0027777777777778 * (z / x) tmp = 0 if t_0 <= -2e+66: tmp = t_1 elif t_0 <= 5e+299: tmp = 0.083333333333333 / x else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) t_1 = Float64(-0.0027777777777778 * Float64(z / x)) tmp = 0.0 if (t_0 <= -2e+66) tmp = t_1; elseif (t_0 <= 5e+299) tmp = Float64(0.083333333333333 / x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); t_1 = -0.0027777777777778 * (z / x); tmp = 0.0; if (t_0 <= -2e+66) tmp = t_1; elseif (t_0 <= 5e+299) tmp = 0.083333333333333 / x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.0027777777777778 * N[(z / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+66], t$95$1, If[LessEqual[t$95$0, 5e+299], N[(0.083333333333333 / x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\
t_1 := -0.0027777777777778 \cdot \frac{z}{x}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+299}:\\
\;\;\;\;\frac{0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < -1.99999999999999989e66 or 5.0000000000000003e299 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f648.7
Applied rewrites8.7%
if -1.99999999999999989e66 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 5.0000000000000003e299Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites23.1%
(FPCore (x y z) :precision binary64 (/ (fma -0.0027777777777778 z 0.083333333333333) x))
double code(double x, double y, double z) {
return fma(-0.0027777777777778, z, 0.083333333333333) / x;
}
function code(x, y, z) return Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x) end
code[x_, y_, z_] := N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}
\end{array}
Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f6428.9
Applied rewrites28.9%
(FPCore (x y z) :precision binary64 (/ 0.083333333333333 x))
double code(double x, double y, double z) {
return 0.083333333333333 / x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.083333333333333d0 / x
end function
public static double code(double x, double y, double z) {
return 0.083333333333333 / x;
}
def code(x, y, z): return 0.083333333333333 / x
function code(x, y, z) return Float64(0.083333333333333 / x) end
function tmp = code(x, y, z) tmp = 0.083333333333333 / x; end
code[x_, y_, z_] := N[(0.083333333333333 / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.083333333333333}{x}
\end{array}
Initial program 94.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites23.1%
herbie shell --seed 2025155
(FPCore (x y z)
:name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
:precision binary64
(+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))