
(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}
Sampling outcomes in binary64 precision:
Herbie found 19 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
(if (<= x 2e+66)
(+
(+ (fma (- (log x) 1.0) x (* -0.5 (log x))) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(fma
(- (* (+ (/ y x) (/ 0.0007936500793651 x)) z) (/ 0.0027777777777778 x))
z
(/ 0.083333333333333 x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2e+66) {
tmp = (fma((log(x) - 1.0), x, (-0.5 * log(x))) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + fma(((((y / x) + (0.0007936500793651 / x)) * z) - (0.0027777777777778 / x)), z, (0.083333333333333 / x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 2e+66) tmp = Float64(Float64(fma(Float64(log(x) - 1.0), x, Float64(-0.5 * log(x))) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)); else tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + fma(Float64(Float64(Float64(Float64(y / x) + Float64(0.0007936500793651 / x)) * z) - Float64(0.0027777777777778 / x)), z, Float64(0.083333333333333 / x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 2e+66], N[(N[(N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x + N[(-0.5 * N[Log[x], $MachinePrecision]), $MachinePrecision]), $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], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] - N[(0.0027777777777778 / x), $MachinePrecision]), $MachinePrecision] * z + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+66}:\\
\;\;\;\;\left(\mathsf{fma}\left(\log x - 1, x, -0.5 \cdot \log x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \mathsf{fma}\left(\left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \cdot z - \frac{0.0027777777777778}{x}, z, \frac{0.083333333333333}{x}\right)\\
\end{array}
\end{array}
if x < 1.99999999999999989e66Initial program 99.7%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lift-log.f64N/A
lower-*.f64N/A
lift-log.f6499.7
Applied rewrites99.7%
if 1.99999999999999989e66 < x Initial program 81.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
associate-*r/N/A
Applied rewrites99.6%
(FPCore (x y z)
:precision binary64
(if (<= x 1e-34)
(/
(fma
(- (* (+ 0.0007936500793651 y) z) 0.0027777777777778)
z
0.083333333333333)
x)
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(fma
(- (* (+ (/ y x) (/ 0.0007936500793651 x)) z) (/ 0.0027777777777778 x))
z
(/ 0.083333333333333 x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1e-34) {
tmp = fma((((0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + fma(((((y / x) + (0.0007936500793651 / x)) * z) - (0.0027777777777778 / x)), z, (0.083333333333333 / x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1e-34) tmp = Float64(fma(Float64(Float64(Float64(0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + fma(Float64(Float64(Float64(Float64(y / x) + Float64(0.0007936500793651 / x)) * z) - Float64(0.0027777777777778 / x)), z, Float64(0.083333333333333 / x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1e-34], N[(N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] - N[(0.0027777777777778 / x), $MachinePrecision]), $MachinePrecision] * z + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-34}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(0.0007936500793651 + y\right) \cdot z - 0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \mathsf{fma}\left(\left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \cdot z - \frac{0.0027777777777778}{x}, z, \frac{0.083333333333333}{x}\right)\\
\end{array}
\end{array}
if x < 9.99999999999999928e-35Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
if 9.99999999999999928e-35 < x Initial program 86.1%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
associate-*r/N/A
Applied rewrites99.6%
(FPCore (x y z)
:precision binary64
(if (<=
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))
5e+307)
(/ (fma (* z y) z 0.083333333333333) x)
(* y (* z (/ z x)))))
double code(double x, double y, double z) {
double tmp;
if ((((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) <= 5e+307) {
tmp = fma((z * y), z, 0.083333333333333) / x;
} else {
tmp = y * (z * (z / x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (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)) <= 5e+307) tmp = Float64(fma(Float64(z * y), z, 0.083333333333333) / x); else tmp = Float64(y * Float64(z * Float64(z / x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[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], 5e+307], N[(N[(N[(z * y), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(y * N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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} \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z \cdot y, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot \frac{z}{x}\right)\\
\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)) < 5e307Initial program 97.6%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites97.0%
Taylor expanded in x around 0
div-subN/A
*-commutativeN/A
div-subN/A
associate-/l*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
div-addN/A
lower-/.f64N/A
Applied rewrites58.0%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-*.f6452.6
Applied rewrites52.6%
if 5e307 < (+.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 78.7%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6453.7
Applied rewrites53.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6458.9
Applied rewrites58.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.7
Applied rewrites61.7%
(FPCore (x y z)
:precision binary64
(if (<= x 3.4e+218)
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(fma
z
(/ (- (* (+ 0.0007936500793651 y) z) 0.0027777777777778) x)
(/ 0.083333333333333 x)))
(+ (- (* (log x) (- x 0.5)) (- x 0.91893853320467)) (* z (* y (/ z x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 3.4e+218) {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + fma(z, ((((0.0007936500793651 + y) * z) - 0.0027777777777778) / x), (0.083333333333333 / x));
} else {
tmp = ((log(x) * (x - 0.5)) - (x - 0.91893853320467)) + (z * (y * (z / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 3.4e+218) tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + fma(z, Float64(Float64(Float64(Float64(0.0007936500793651 + y) * z) - 0.0027777777777778) / x), Float64(0.083333333333333 / x))); else tmp = Float64(Float64(Float64(log(x) * Float64(x - 0.5)) - Float64(x - 0.91893853320467)) + Float64(z * Float64(y * Float64(z / x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 3.4e+218], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(z * N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision] + N[(z * N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.4 \cdot 10^{+218}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \mathsf{fma}\left(z, \frac{\left(0.0007936500793651 + y\right) \cdot z - 0.0027777777777778}{x}, \frac{0.083333333333333}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log x \cdot \left(x - 0.5\right) - \left(x - 0.91893853320467\right)\right) + z \cdot \left(y \cdot \frac{z}{x}\right)\\
\end{array}
\end{array}
if x < 3.40000000000000009e218Initial program 95.9%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites98.3%
if 3.40000000000000009e218 < x Initial program 74.7%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6484.5
Applied rewrites84.5%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l-N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower--.f6484.5
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
Applied rewrites87.0%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.5
Applied rewrites99.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (log x) (- x 0.5))))
(if (<= x 1300000.0)
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))
(if (<= x 3.4e+218)
(-
t_0
(- (- x 0.91893853320467) (* (/ (* (+ 0.0007936500793651 y) z) x) z)))
(+ (- t_0 (- x 0.91893853320467)) (* z (* y (/ z x))))))))
double code(double x, double y, double z) {
double t_0 = log(x) * (x - 0.5);
double tmp;
if (x <= 1300000.0) {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else if (x <= 3.4e+218) {
tmp = t_0 - ((x - 0.91893853320467) - ((((0.0007936500793651 + y) * z) / x) * z));
} else {
tmp = (t_0 - (x - 0.91893853320467)) + (z * (y * (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 = log(x) * (x - 0.5d0)
if (x <= 1300000.0d0) then
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
else if (x <= 3.4d+218) then
tmp = t_0 - ((x - 0.91893853320467d0) - ((((0.0007936500793651d0 + y) * z) / x) * z))
else
tmp = (t_0 - (x - 0.91893853320467d0)) + (z * (y * (z / x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.log(x) * (x - 0.5);
double tmp;
if (x <= 1300000.0) {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
} else if (x <= 3.4e+218) {
tmp = t_0 - ((x - 0.91893853320467) - ((((0.0007936500793651 + y) * z) / x) * z));
} else {
tmp = (t_0 - (x - 0.91893853320467)) + (z * (y * (z / x)));
}
return tmp;
}
def code(x, y, z): t_0 = math.log(x) * (x - 0.5) tmp = 0 if x <= 1300000.0: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) elif x <= 3.4e+218: tmp = t_0 - ((x - 0.91893853320467) - ((((0.0007936500793651 + y) * z) / x) * z)) else: tmp = (t_0 - (x - 0.91893853320467)) + (z * (y * (z / x))) return tmp
function code(x, y, z) t_0 = Float64(log(x) * Float64(x - 0.5)) tmp = 0.0 if (x <= 1300000.0) tmp = 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)); elseif (x <= 3.4e+218) tmp = Float64(t_0 - Float64(Float64(x - 0.91893853320467) - Float64(Float64(Float64(Float64(0.0007936500793651 + y) * z) / x) * z))); else tmp = Float64(Float64(t_0 - Float64(x - 0.91893853320467)) + Float64(z * Float64(y * Float64(z / x)))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = log(x) * (x - 0.5); tmp = 0.0; if (x <= 1300000.0) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); elseif (x <= 3.4e+218) tmp = t_0 - ((x - 0.91893853320467) - ((((0.0007936500793651 + y) * z) / x) * z)); else tmp = (t_0 - (x - 0.91893853320467)) + (z * (y * (z / x))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1300000.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[x, 3.4e+218], N[(t$95$0 - N[(N[(x - 0.91893853320467), $MachinePrecision] - N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision] + N[(z * N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log x \cdot \left(x - 0.5\right)\\
\mathbf{if}\;x \leq 1300000:\\
\;\;\;\;\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{elif}\;x \leq 3.4 \cdot 10^{+218}:\\
\;\;\;\;t\_0 - \left(\left(x - 0.91893853320467\right) - \frac{\left(0.0007936500793651 + y\right) \cdot z}{x} \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - \left(x - 0.91893853320467\right)\right) + z \cdot \left(y \cdot \frac{z}{x}\right)\\
\end{array}
\end{array}
if x < 1.3e6Initial program 99.7%
if 1.3e6 < x < 3.40000000000000009e218Initial program 89.4%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6494.0
Applied rewrites94.0%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l-N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower--.f6494.0
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
Applied rewrites99.6%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lower--.f64N/A
Applied rewrites99.6%
if 3.40000000000000009e218 < x Initial program 74.7%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6484.5
Applied rewrites84.5%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l-N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower--.f6484.5
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
Applied rewrites87.0%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.5
Applied rewrites99.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (log x) (- x 0.5))) (t_1 (* (+ 0.0007936500793651 y) z)))
(if (<= x 0.082)
(/ (fma (- t_1 0.0027777777777778) z 0.083333333333333) x)
(if (<= x 3.4e+218)
(- t_0 (- (- x 0.91893853320467) (* (/ t_1 x) z)))
(+ (- t_0 (- x 0.91893853320467)) (* z (* y (/ z x))))))))
double code(double x, double y, double z) {
double t_0 = log(x) * (x - 0.5);
double t_1 = (0.0007936500793651 + y) * z;
double tmp;
if (x <= 0.082) {
tmp = fma((t_1 - 0.0027777777777778), z, 0.083333333333333) / x;
} else if (x <= 3.4e+218) {
tmp = t_0 - ((x - 0.91893853320467) - ((t_1 / x) * z));
} else {
tmp = (t_0 - (x - 0.91893853320467)) + (z * (y * (z / x)));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(log(x) * Float64(x - 0.5)) t_1 = Float64(Float64(0.0007936500793651 + y) * z) tmp = 0.0 if (x <= 0.082) tmp = Float64(fma(Float64(t_1 - 0.0027777777777778), z, 0.083333333333333) / x); elseif (x <= 3.4e+218) tmp = Float64(t_0 - Float64(Float64(x - 0.91893853320467) - Float64(Float64(t_1 / x) * z))); else tmp = Float64(Float64(t_0 - Float64(x - 0.91893853320467)) + Float64(z * Float64(y * Float64(z / x)))); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, 0.082], N[(N[(N[(t$95$1 - 0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 3.4e+218], N[(t$95$0 - N[(N[(x - 0.91893853320467), $MachinePrecision] - N[(N[(t$95$1 / x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision] + N[(z * N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log x \cdot \left(x - 0.5\right)\\
t_1 := \left(0.0007936500793651 + y\right) \cdot z\\
\mathbf{if}\;x \leq 0.082:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1 - 0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+218}:\\
\;\;\;\;t\_0 - \left(\left(x - 0.91893853320467\right) - \frac{t\_1}{x} \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - \left(x - 0.91893853320467\right)\right) + z \cdot \left(y \cdot \frac{z}{x}\right)\\
\end{array}
\end{array}
if x < 0.0820000000000000034Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f6498.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.2
Applied rewrites98.2%
if 0.0820000000000000034 < x < 3.40000000000000009e218Initial program 89.9%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6493.2
Applied rewrites93.2%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l-N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower--.f6493.2
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
Applied rewrites98.5%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift--.f64N/A
lower--.f64N/A
Applied rewrites98.5%
if 3.40000000000000009e218 < x Initial program 74.7%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6484.5
Applied rewrites84.5%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l-N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower--.f6484.5
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
Applied rewrites87.0%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.5
Applied rewrites99.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (log x) (- x 0.5)) (- x 0.91893853320467))))
(if (<= x 0.082)
(/
(fma
(- (* (+ 0.0007936500793651 y) z) 0.0027777777777778)
z
0.083333333333333)
x)
(if (<= x 3.4e+218)
(+ t_0 (* z (/ (* (+ y 0.0007936500793651) z) x)))
(+ t_0 (* z (* y (/ z x))))))))
double code(double x, double y, double z) {
double t_0 = (log(x) * (x - 0.5)) - (x - 0.91893853320467);
double tmp;
if (x <= 0.082) {
tmp = fma((((0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x;
} else if (x <= 3.4e+218) {
tmp = t_0 + (z * (((y + 0.0007936500793651) * z) / x));
} else {
tmp = t_0 + (z * (y * (z / x)));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(log(x) * Float64(x - 0.5)) - Float64(x - 0.91893853320467)) tmp = 0.0 if (x <= 0.082) tmp = Float64(fma(Float64(Float64(Float64(0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x); elseif (x <= 3.4e+218) tmp = Float64(t_0 + Float64(z * Float64(Float64(Float64(y + 0.0007936500793651) * z) / x))); else tmp = Float64(t_0 + Float64(z * Float64(y * Float64(z / x)))); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.082], N[(N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 3.4e+218], N[(t$95$0 + N[(z * N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(z * N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log x \cdot \left(x - 0.5\right) - \left(x - 0.91893853320467\right)\\
\mathbf{if}\;x \leq 0.082:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(0.0007936500793651 + y\right) \cdot z - 0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+218}:\\
\;\;\;\;t\_0 + z \cdot \frac{\left(y + 0.0007936500793651\right) \cdot z}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + z \cdot \left(y \cdot \frac{z}{x}\right)\\
\end{array}
\end{array}
if x < 0.0820000000000000034Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f6498.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.2
Applied rewrites98.2%
if 0.0820000000000000034 < x < 3.40000000000000009e218Initial program 89.9%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6493.2
Applied rewrites93.2%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l-N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower--.f6493.2
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
Applied rewrites98.5%
if 3.40000000000000009e218 < x Initial program 74.7%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6484.5
Applied rewrites84.5%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l-N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower--.f6484.5
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
Applied rewrites87.0%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.5
Applied rewrites99.5%
(FPCore (x y z)
:precision binary64
(if (<= x 0.082)
(/
(fma
(- (* (+ 0.0007936500793651 y) z) 0.0027777777777778)
z
0.083333333333333)
x)
(if (<= x 7e+163)
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(* (* z z) (/ (+ 0.0007936500793651 y) x)))
(+
(- (* (log x) (- x 0.5)) (- x 0.91893853320467))
(* z (* y (/ z x)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 0.082) {
tmp = fma((((0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x;
} else if (x <= 7e+163) {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((z * z) * ((0.0007936500793651 + y) / x));
} else {
tmp = ((log(x) * (x - 0.5)) - (x - 0.91893853320467)) + (z * (y * (z / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 0.082) tmp = Float64(fma(Float64(Float64(Float64(0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x); elseif (x <= 7e+163) tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(z * z) * Float64(Float64(0.0007936500793651 + y) / x))); else tmp = Float64(Float64(Float64(log(x) * Float64(x - 0.5)) - Float64(x - 0.91893853320467)) + Float64(z * Float64(y * Float64(z / x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 0.082], N[(N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 7e+163], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] * N[(N[(0.0007936500793651 + y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision] + N[(z * N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.082:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(0.0007936500793651 + y\right) \cdot z - 0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+163}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(z \cdot z\right) \cdot \frac{0.0007936500793651 + y}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\log x \cdot \left(x - 0.5\right) - \left(x - 0.91893853320467\right)\right) + z \cdot \left(y \cdot \frac{z}{x}\right)\\
\end{array}
\end{array}
if x < 0.0820000000000000034Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f6498.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.2
Applied rewrites98.2%
if 0.0820000000000000034 < x < 7.0000000000000005e163Initial program 92.7%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6494.1
Applied rewrites94.1%
if 7.0000000000000005e163 < x Initial program 76.5%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6486.4
Applied rewrites86.4%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l-N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower--.f6486.4
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
Applied rewrites91.3%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
(FPCore (x y z)
:precision binary64
(if (<= x 1.0)
(/
(fma
(- (* (+ 0.0007936500793651 y) z) 0.0027777777777778)
z
0.083333333333333)
x)
(if (<= x 7e+163)
(+ (* (- (log x) 1.0) x) (* (* z z) (/ (+ 0.0007936500793651 y) x)))
(+
(- (* (log x) (- x 0.5)) (- x 0.91893853320467))
(* z (* y (/ z x)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.0) {
tmp = fma((((0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x;
} else if (x <= 7e+163) {
tmp = ((log(x) - 1.0) * x) + ((z * z) * ((0.0007936500793651 + y) / x));
} else {
tmp = ((log(x) * (x - 0.5)) - (x - 0.91893853320467)) + (z * (y * (z / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1.0) tmp = Float64(fma(Float64(Float64(Float64(0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x); elseif (x <= 7e+163) tmp = Float64(Float64(Float64(log(x) - 1.0) * x) + Float64(Float64(z * z) * Float64(Float64(0.0007936500793651 + y) / x))); else tmp = Float64(Float64(Float64(log(x) * Float64(x - 0.5)) - Float64(x - 0.91893853320467)) + Float64(z * Float64(y * Float64(z / x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1.0], N[(N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 7e+163], N[(N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] * N[(N[(0.0007936500793651 + y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision] + N[(z * N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(0.0007936500793651 + y\right) \cdot z - 0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+163}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x + \left(z \cdot z\right) \cdot \frac{0.0007936500793651 + y}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\log x \cdot \left(x - 0.5\right) - \left(x - 0.91893853320467\right)\right) + z \cdot \left(y \cdot \frac{z}{x}\right)\\
\end{array}
\end{array}
if x < 1Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f6497.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.6
Applied rewrites97.6%
if 1 < x < 7.0000000000000005e163Initial program 92.6%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6495.2
Applied rewrites95.2%
Taylor expanded in x around inf
*-commutativeN/A
log-pow-revN/A
inv-powN/A
pow-powN/A
metadata-evalN/A
unpow1N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6494.1
Applied rewrites94.1%
if 7.0000000000000005e163 < x Initial program 76.5%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6486.4
Applied rewrites86.4%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
associate-+l-N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f64N/A
lower--.f6486.4
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
Applied rewrites91.3%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
(FPCore (x y z)
:precision binary64
(if (<= x 1.0)
(/
(fma
(- (* (+ 0.0007936500793651 y) z) 0.0027777777777778)
z
0.083333333333333)
x)
(+ (* (- (log x) 1.0) x) (* (* z z) (/ (+ 0.0007936500793651 y) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.0) {
tmp = fma((((0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = ((log(x) - 1.0) * x) + ((z * z) * ((0.0007936500793651 + y) / x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1.0) tmp = Float64(fma(Float64(Float64(Float64(0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(log(x) - 1.0) * x) + Float64(Float64(z * z) * Float64(Float64(0.0007936500793651 + y) / x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1.0], N[(N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] * N[(N[(0.0007936500793651 + y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(0.0007936500793651 + y\right) \cdot z - 0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x + \left(z \cdot z\right) \cdot \frac{0.0007936500793651 + y}{x}\\
\end{array}
\end{array}
if x < 1Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f6497.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.6
Applied rewrites97.6%
if 1 < x Initial program 85.2%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6491.1
Applied rewrites91.1%
Taylor expanded in x around inf
*-commutativeN/A
log-pow-revN/A
inv-powN/A
pow-powN/A
metadata-evalN/A
unpow1N/A
lower-*.f64N/A
lift-log.f64N/A
lift--.f6490.7
Applied rewrites90.7%
(FPCore (x y z)
:precision binary64
(if (<= x 4.2e+42)
(/
(fma
(- (* (+ 0.0007936500793651 y) z) 0.0027777777777778)
z
0.083333333333333)
x)
(* (- (log x) 1.0) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.2e+42) {
tmp = fma((((0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = (log(x) - 1.0) * x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 4.2e+42) tmp = Float64(fma(Float64(Float64(Float64(0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(Float64(log(x) - 1.0) * x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 4.2e+42], N[(N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.2 \cdot 10^{+42}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(0.0007936500793651 + y\right) \cdot z - 0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x\\
\end{array}
\end{array}
if x < 4.19999999999999991e42Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f6494.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6494.1
Applied rewrites94.1%
if 4.19999999999999991e42 < x Initial program 83.0%
Taylor expanded in x around inf
*-commutativeN/A
log-pow-revN/A
inv-powN/A
pow-powN/A
metadata-evalN/A
unpow1N/A
lower-*.f64N/A
lower--.f64N/A
lift-log.f6477.9
Applied rewrites77.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)))
(if (<= t_0 -2000000000000.0)
(* y (/ (* z z) x))
(if (<= t_0 5e+35) (/ 0.083333333333333 x) (* y (* z (/ z x)))))))
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 <= -2000000000000.0) {
tmp = y * ((z * z) / x);
} else if (t_0 <= 5e+35) {
tmp = 0.083333333333333 / x;
} else {
tmp = y * (z * (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 = ((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0
if (t_0 <= (-2000000000000.0d0)) then
tmp = y * ((z * z) / x)
else if (t_0 <= 5d+35) then
tmp = 0.083333333333333d0 / x
else
tmp = y * (z * (z / x))
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 <= -2000000000000.0) {
tmp = y * ((z * z) / x);
} else if (t_0 <= 5e+35) {
tmp = 0.083333333333333 / x;
} else {
tmp = y * (z * (z / x));
}
return tmp;
}
def code(x, y, z): t_0 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333 tmp = 0 if t_0 <= -2000000000000.0: tmp = y * ((z * z) / x) elif t_0 <= 5e+35: tmp = 0.083333333333333 / x else: tmp = y * (z * (z / x)) 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 <= -2000000000000.0) tmp = Float64(y * Float64(Float64(z * z) / x)); elseif (t_0 <= 5e+35) tmp = Float64(0.083333333333333 / x); else tmp = Float64(y * Float64(z * Float64(z / x))); 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 <= -2000000000000.0) tmp = y * ((z * z) / x); elseif (t_0 <= 5e+35) tmp = 0.083333333333333 / x; else tmp = y * (z * (z / x)); 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, -2000000000000.0], N[(y * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+35], N[(0.083333333333333 / x), $MachinePrecision], N[(y * N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $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 -2000000000000:\\
\;\;\;\;y \cdot \frac{z \cdot z}{x}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+35}:\\
\;\;\;\;\frac{0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot \frac{z}{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)) < -2e12Initial program 91.2%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.3
Applied rewrites77.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6483.6
Applied rewrites83.6%
if -2e12 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5.00000000000000021e35Initial program 99.4%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites97.8%
Taylor expanded in x around 0
div-subN/A
*-commutativeN/A
div-subN/A
associate-/l*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
div-addN/A
lower-/.f64N/A
Applied rewrites52.4%
Taylor expanded in z around 0
Applied rewrites49.5%
if 5.00000000000000021e35 < (+.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 84.4%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6444.5
Applied rewrites44.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.2
Applied rewrites48.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.2
Applied rewrites50.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)))
(if (or (<= t_0 -2000000000000.0) (not (<= t_0 5e+35)))
(* y (* z (/ z x)))
(/ 0.083333333333333 x))))
double code(double x, double y, double z) {
double t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z;
double tmp;
if ((t_0 <= -2000000000000.0) || !(t_0 <= 5e+35)) {
tmp = y * (z * (z / x));
} else {
tmp = 0.083333333333333 / 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 = (((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z
if ((t_0 <= (-2000000000000.0d0)) .or. (.not. (t_0 <= 5d+35))) then
tmp = y * (z * (z / x))
else
tmp = 0.083333333333333d0 / x
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 <= -2000000000000.0) || !(t_0 <= 5e+35)) {
tmp = y * (z * (z / x));
} else {
tmp = 0.083333333333333 / x;
}
return tmp;
}
def code(x, y, z): t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z tmp = 0 if (t_0 <= -2000000000000.0) or not (t_0 <= 5e+35): tmp = y * (z * (z / x)) else: tmp = 0.083333333333333 / x 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 <= -2000000000000.0) || !(t_0 <= 5e+35)) tmp = Float64(y * Float64(z * Float64(z / x))); else tmp = Float64(0.083333333333333 / x); 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 <= -2000000000000.0) || ~((t_0 <= 5e+35))) tmp = y * (z * (z / x)); else tmp = 0.083333333333333 / x; 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[Or[LessEqual[t$95$0, -2000000000000.0], N[Not[LessEqual[t$95$0, 5e+35]], $MachinePrecision]], N[(y * N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.083333333333333 / x), $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 -2000000000000 \lor \neg \left(t\_0 \leq 5 \cdot 10^{+35}\right):\\
\;\;\;\;y \cdot \left(z \cdot \frac{z}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.083333333333333}{x}\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < -2e12 or 5.00000000000000021e35 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 86.6%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6459.7
Applied rewrites59.7%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6461.1
Applied rewrites61.1%
if -2e12 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 5.00000000000000021e35Initial program 99.4%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites97.8%
Taylor expanded in x around 0
div-subN/A
*-commutativeN/A
div-subN/A
associate-/l*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
div-addN/A
lower-/.f64N/A
Applied rewrites52.4%
Taylor expanded in z around 0
Applied rewrites49.5%
Final simplification55.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (+ y 0.0007936500793651) z)))
(if (<= (+ (* (- t_0 0.0027777777777778) z) 0.083333333333333) 0.1)
(/ (+ (* (* z z) y) 0.083333333333333) x)
(* z (/ t_0 x)))))
double code(double x, double y, double z) {
double t_0 = (y + 0.0007936500793651) * z;
double tmp;
if ((((t_0 - 0.0027777777777778) * z) + 0.083333333333333) <= 0.1) {
tmp = (((z * z) * y) + 0.083333333333333) / x;
} else {
tmp = z * (t_0 / 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 = (y + 0.0007936500793651d0) * z
if ((((t_0 - 0.0027777777777778d0) * z) + 0.083333333333333d0) <= 0.1d0) then
tmp = (((z * z) * y) + 0.083333333333333d0) / x
else
tmp = z * (t_0 / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (y + 0.0007936500793651) * z;
double tmp;
if ((((t_0 - 0.0027777777777778) * z) + 0.083333333333333) <= 0.1) {
tmp = (((z * z) * y) + 0.083333333333333) / x;
} else {
tmp = z * (t_0 / x);
}
return tmp;
}
def code(x, y, z): t_0 = (y + 0.0007936500793651) * z tmp = 0 if (((t_0 - 0.0027777777777778) * z) + 0.083333333333333) <= 0.1: tmp = (((z * z) * y) + 0.083333333333333) / x else: tmp = z * (t_0 / x) return tmp
function code(x, y, z) t_0 = Float64(Float64(y + 0.0007936500793651) * z) tmp = 0.0 if (Float64(Float64(Float64(t_0 - 0.0027777777777778) * z) + 0.083333333333333) <= 0.1) tmp = Float64(Float64(Float64(Float64(z * z) * y) + 0.083333333333333) / x); else tmp = Float64(z * Float64(t_0 / x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y + 0.0007936500793651) * z; tmp = 0.0; if ((((t_0 - 0.0027777777777778) * z) + 0.083333333333333) <= 0.1) tmp = (((z * z) * y) + 0.083333333333333) / x; else tmp = z * (t_0 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[N[(N[(N[(t$95$0 - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision], 0.1], N[(N[(N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(z * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + 0.0007936500793651\right) \cdot z\\
\mathbf{if}\;\left(t\_0 - 0.0027777777777778\right) \cdot z + 0.083333333333333 \leq 0.1:\\
\;\;\;\;\frac{\left(z \cdot z\right) \cdot y + 0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{t\_0}{x}\\
\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)) < 0.10000000000000001Initial program 97.2%
Taylor expanded in x around 0
lower-/.f64N/A
Applied rewrites81.1%
Taylor expanded in y around inf
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f6459.1
Applied rewrites59.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 85.3%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites96.9%
Taylor expanded in z around inf
Applied rewrites72.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (+ y 0.0007936500793651) z)))
(if (<= (+ (* (- t_0 0.0027777777777778) z) 0.083333333333333) 0.1)
(/ (fma (* z y) z 0.083333333333333) x)
(* z (/ t_0 x)))))
double code(double x, double y, double z) {
double t_0 = (y + 0.0007936500793651) * z;
double tmp;
if ((((t_0 - 0.0027777777777778) * z) + 0.083333333333333) <= 0.1) {
tmp = fma((z * y), z, 0.083333333333333) / x;
} else {
tmp = z * (t_0 / x);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(y + 0.0007936500793651) * z) tmp = 0.0 if (Float64(Float64(Float64(t_0 - 0.0027777777777778) * z) + 0.083333333333333) <= 0.1) tmp = Float64(fma(Float64(z * y), z, 0.083333333333333) / x); else tmp = Float64(z * Float64(t_0 / x)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[N[(N[(N[(t$95$0 - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision], 0.1], N[(N[(N[(z * y), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(z * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + 0.0007936500793651\right) \cdot z\\
\mathbf{if}\;\left(t\_0 - 0.0027777777777778\right) \cdot z + 0.083333333333333 \leq 0.1:\\
\;\;\;\;\frac{\mathsf{fma}\left(z \cdot y, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{t\_0}{x}\\
\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)) < 0.10000000000000001Initial program 97.2%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites96.6%
Taylor expanded in x around 0
div-subN/A
*-commutativeN/A
div-subN/A
associate-/l*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
div-addN/A
lower-/.f64N/A
Applied rewrites59.1%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-*.f6459.1
Applied rewrites59.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 85.3%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites96.9%
Taylor expanded in z around inf
Applied rewrites72.3%
(FPCore (x y z)
:precision binary64
(if (<= x 3.7e+66)
(/
(fma
(- (* (+ 0.0007936500793651 y) z) 0.0027777777777778)
z
0.083333333333333)
x)
(* z (/ (* (+ y 0.0007936500793651) z) x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 3.7e+66) {
tmp = fma((((0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = z * (((y + 0.0007936500793651) * z) / x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 3.7e+66) tmp = Float64(fma(Float64(Float64(Float64(0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(z * Float64(Float64(Float64(y + 0.0007936500793651) * z) / x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 3.7e+66], N[(N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(z * N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.7 \cdot 10^{+66}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(0.0007936500793651 + y\right) \cdot z - 0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{\left(y + 0.0007936500793651\right) \cdot z}{x}\\
\end{array}
\end{array}
if x < 3.7e66Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f6489.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6489.2
Applied rewrites89.2%
if 3.7e66 < x Initial program 81.3%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites94.7%
Taylor expanded in z around inf
Applied rewrites24.0%
(FPCore (x y z) :precision binary64 (if (<= x 3.7e+66) (/ (fma (* (+ 0.0007936500793651 y) z) z 0.083333333333333) x) (* z (/ (* (+ y 0.0007936500793651) z) x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 3.7e+66) {
tmp = fma(((0.0007936500793651 + y) * z), z, 0.083333333333333) / x;
} else {
tmp = z * (((y + 0.0007936500793651) * z) / x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 3.7e+66) tmp = Float64(fma(Float64(Float64(0.0007936500793651 + y) * z), z, 0.083333333333333) / x); else tmp = Float64(z * Float64(Float64(Float64(y + 0.0007936500793651) * z) / x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 3.7e+66], N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(z * N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.7 \cdot 10^{+66}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(0.0007936500793651 + y\right) \cdot z, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{\left(y + 0.0007936500793651\right) \cdot z}{x}\\
\end{array}
\end{array}
if x < 3.7e66Initial program 99.7%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites97.8%
Taylor expanded in x around 0
div-subN/A
*-commutativeN/A
div-subN/A
associate-/l*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
div-addN/A
lower-/.f64N/A
Applied rewrites89.2%
Taylor expanded in z around inf
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6488.9
Applied rewrites88.9%
if 3.7e66 < x Initial program 81.3%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites94.7%
Taylor expanded in z around inf
Applied rewrites24.0%
(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 92.8%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites96.7%
Taylor expanded in x around 0
div-subN/A
*-commutativeN/A
div-subN/A
associate-/l*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
div-addN/A
lower-/.f64N/A
Applied rewrites62.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6432.9
Applied rewrites32.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 92.8%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-fma.f64N/A
Applied rewrites96.7%
Taylor expanded in x around 0
div-subN/A
*-commutativeN/A
div-subN/A
associate-/l*N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
div-addN/A
lower-/.f64N/A
Applied rewrites62.5%
Taylor expanded in z around 0
Applied rewrites25.6%
(FPCore (x y z) :precision binary64 (+ (+ (+ (* (- x 0.5) (log x)) (- 0.91893853320467 x)) (/ 0.083333333333333 x)) (* (/ z x) (- (* z (+ y 0.0007936500793651)) 0.0027777777777778))))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778));
}
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)) + (0.91893853320467d0 - x)) + (0.083333333333333d0 / x)) + ((z / x) * ((z * (y + 0.0007936500793651d0)) - 0.0027777777777778d0))
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778));
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) + Float64(0.91893853320467 - x)) + Float64(0.083333333333333 / x)) + Float64(Float64(z / x) * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778)); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision] + N[(N[(z / x), $MachinePrecision] * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x + \left(0.91893853320467 - x\right)\right) + \frac{0.083333333333333}{x}\right) + \frac{z}{x} \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)
\end{array}
herbie shell --seed 2025043
(FPCore (x y z)
:name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ (* (- x 1/2) (log x)) (- 91893853320467/100000000000000 x)) (/ 83333333333333/1000000000000000 x)) (* (/ z x) (- (* z (+ y 7936500793651/10000000000000000)) 13888888888889/5000000000000000))))
(+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))