
(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 16 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.6%
(FPCore (x y z)
:precision binary64
(if (<= x 8e+189)
(fma
(- x 0.5)
(log x)
(-
(- 0.91893853320467 x)
(/
(fma
(fma (- -0.0007936500793651 y) z 0.0027777777777778)
z
-0.083333333333333)
x)))
(fma
(* y z)
(/ z x)
(- (/ 0.083333333333333 x) (* x (+ 1.0 (log (/ 1.0 x))))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 8e+189) {
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((y * z), (z / x), ((0.083333333333333 / x) - (x * (1.0 + log((1.0 / x))))));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 8e+189) 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(y * z), Float64(z / x), Float64(Float64(0.083333333333333 / x) - Float64(x * Float64(1.0 + log(Float64(1.0 / x)))))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 8e+189], 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[(y * z), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] - N[(x * N[(1.0 + N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8 \cdot 10^{+189}:\\
\;\;\;\;\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(y \cdot z, \frac{z}{x}, \frac{0.083333333333333}{x} - x \cdot \left(1 + \log \left(\frac{1}{x}\right)\right)\right)\\
\end{array}
\end{array}
if x < 8.0000000000000002e189Initial program 94.0%
Applied rewrites94.1%
if 8.0000000000000002e189 < x Initial program 94.0%
Applied rewrites98.6%
Taylor expanded in y around inf
lower-*.f6483.9
Applied rewrites83.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-/.f6483.0
Applied rewrites83.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(fma
(* y z)
(/ z x)
(-
(/ 0.083333333333333 x)
(fma (- 0.5 x) (log x) (- x 0.91893853320467))))))
(if (<= y -2.65e+26)
t_0
(if (<= y 5e-93)
(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((y * z), (z / x), ((0.083333333333333 / x) - fma((0.5 - x), log(x), (x - 0.91893853320467))));
double tmp;
if (y <= -2.65e+26) {
tmp = t_0;
} else if (y <= 5e-93) {
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 = fma(Float64(y * z), Float64(z / x), Float64(Float64(0.083333333333333 / x) - fma(Float64(0.5 - x), log(x), Float64(x - 0.91893853320467)))) tmp = 0.0 if (y <= -2.65e+26) tmp = t_0; elseif (y <= 5e-93) 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[(y * z), $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]}, If[LessEqual[y, -2.65e+26], t$95$0, If[LessEqual[y, 5e-93], 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 := \mathsf{fma}\left(y \cdot z, \frac{z}{x}, \frac{0.083333333333333}{x} - \mathsf{fma}\left(0.5 - x, \log x, x - 0.91893853320467\right)\right)\\
\mathbf{if}\;y \leq -2.65 \cdot 10^{+26}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-93}:\\
\;\;\;\;\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 < -2.64999999999999984e26 or 4.99999999999999994e-93 < y Initial program 94.0%
Applied rewrites98.6%
Taylor expanded in y around inf
lower-*.f6483.9
Applied rewrites83.9%
if -2.64999999999999984e26 < y < 4.99999999999999994e-93Initial program 94.0%
Applied rewrites94.1%
Taylor expanded in y around 0
Applied rewrites78.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(fma
(* y z)
(/ z x)
(- (/ 0.083333333333333 x) (* x (+ 1.0 (log (/ 1.0 x))))))))
(if (<= y -2.65e+26)
t_0
(if (<= y 4.2e-80)
(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((y * z), (z / x), ((0.083333333333333 / x) - (x * (1.0 + log((1.0 / x))))));
double tmp;
if (y <= -2.65e+26) {
tmp = t_0;
} else if (y <= 4.2e-80) {
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 = fma(Float64(y * z), Float64(z / x), Float64(Float64(0.083333333333333 / x) - Float64(x * Float64(1.0 + log(Float64(1.0 / x)))))) tmp = 0.0 if (y <= -2.65e+26) tmp = t_0; elseif (y <= 4.2e-80) 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[(y * z), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] - N[(x * N[(1.0 + N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.65e+26], t$95$0, If[LessEqual[y, 4.2e-80], 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 := \mathsf{fma}\left(y \cdot z, \frac{z}{x}, \frac{0.083333333333333}{x} - x \cdot \left(1 + \log \left(\frac{1}{x}\right)\right)\right)\\
\mathbf{if}\;y \leq -2.65 \cdot 10^{+26}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-80}:\\
\;\;\;\;\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 < -2.64999999999999984e26 or 4.20000000000000003e-80 < y Initial program 94.0%
Applied rewrites98.6%
Taylor expanded in y around inf
lower-*.f6483.9
Applied rewrites83.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-/.f6483.0
Applied rewrites83.0%
if -2.64999999999999984e26 < y < 4.20000000000000003e-80Initial program 94.0%
Applied rewrites94.1%
Taylor expanded in y around 0
Applied rewrites78.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(-
(/ (fma (* y z) z 0.083333333333333) x)
(fma (log x) (- 0.5 x) (- x 0.91893853320467)))))
(if (<= y -2.65e+26)
t_0
(if (<= y 2e-94)
(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((y * z), z, 0.083333333333333) / x) - fma(log(x), (0.5 - x), (x - 0.91893853320467));
double tmp;
if (y <= -2.65e+26) {
tmp = t_0;
} else if (y <= 2e-94) {
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(y * z), z, 0.083333333333333) / x) - fma(log(x), Float64(0.5 - x), Float64(x - 0.91893853320467))) tmp = 0.0 if (y <= -2.65e+26) tmp = t_0; elseif (y <= 2e-94) 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[(y * z), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] * N[(0.5 - x), $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.65e+26], t$95$0, If[LessEqual[y, 2e-94], 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(y \cdot z, z, 0.083333333333333\right)}{x} - \mathsf{fma}\left(\log x, 0.5 - x, x - 0.91893853320467\right)\\
\mathbf{if}\;y \leq -2.65 \cdot 10^{+26}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-94}:\\
\;\;\;\;\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 < -2.64999999999999984e26 or 1.9999999999999999e-94 < y Initial program 94.0%
Applied rewrites98.6%
Taylor expanded in y around inf
lower-*.f6483.9
Applied rewrites83.9%
Applied rewrites81.8%
if -2.64999999999999984e26 < y < 1.9999999999999999e-94Initial program 94.0%
Applied rewrites94.1%
Taylor expanded in y around 0
Applied rewrites78.6%
(FPCore (x y z)
:precision binary64
(if (<= x 6.8e-15)
(fma
(fma z (- y -0.0007936500793651) -0.0027777777777778)
(/ z x)
(/ 0.083333333333333 x))
(if (<= x 1.75e+260)
(-
(/ (fma (* y z) z 0.083333333333333) x)
(fma (log x) (- 0.5 x) (- x 0.91893853320467)))
(fma (- x 0.5) (log x) (- x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 6.8e-15) {
tmp = fma(fma(z, (y - -0.0007936500793651), -0.0027777777777778), (z / x), (0.083333333333333 / x));
} else if (x <= 1.75e+260) {
tmp = (fma((y * z), z, 0.083333333333333) / x) - fma(log(x), (0.5 - x), (x - 0.91893853320467));
} else {
tmp = fma((x - 0.5), log(x), -x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 6.8e-15) tmp = fma(fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778), Float64(z / x), Float64(0.083333333333333 / x)); elseif (x <= 1.75e+260) tmp = Float64(Float64(fma(Float64(y * z), z, 0.083333333333333) / x) - fma(log(x), Float64(0.5 - x), Float64(x - 0.91893853320467))); else tmp = fma(Float64(x - 0.5), log(x), Float64(-x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 6.8e-15], N[(N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.75e+260], N[(N[(N[(N[(y * z), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] * N[(0.5 - x), $MachinePrecision] + N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.8 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+260}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot z, z, 0.083333333333333\right)}{x} - \mathsf{fma}\left(\log x, 0.5 - x, x - 0.91893853320467\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, -x\right)\\
\end{array}
\end{array}
if x < 6.8000000000000001e-15Initial program 94.0%
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f6466.0
Applied rewrites66.0%
if 6.8000000000000001e-15 < x < 1.7499999999999999e260Initial program 94.0%
Applied rewrites98.6%
Taylor expanded in y around inf
lower-*.f6483.9
Applied rewrites83.9%
Applied rewrites81.8%
if 1.7499999999999999e260 < x Initial program 94.0%
Applied rewrites94.1%
Taylor expanded in x around inf
lower-*.f6435.6
Applied rewrites35.6%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.6
Applied rewrites35.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(fma
(fma z (- y -0.0007936500793651) -0.0027777777777778)
(/ z x)
(/ 0.083333333333333 x)))
(t_1
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)))
(if (<= t_1 -1e+115)
t_0
(if (<= t_1 5e+83)
(fma
(- x 0.5)
(log x)
(- (- 0.91893853320467 x) (/ -0.083333333333333 x)))
t_0))))
double code(double x, double y, double z) {
double t_0 = fma(fma(z, (y - -0.0007936500793651), -0.0027777777777778), (z / x), (0.083333333333333 / x));
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -1e+115) {
tmp = t_0;
} else if (t_1 <= 5e+83) {
tmp = fma((x - 0.5), log(x), ((0.91893853320467 - x) - (-0.083333333333333 / x)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778), Float64(z / x), Float64(0.083333333333333 / x)) t_1 = Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) tmp = 0.0 if (t_1 <= -1e+115) tmp = t_0; elseif (t_1 <= 5e+83) tmp = fma(Float64(x - 0.5), log(x), Float64(Float64(0.91893853320467 - x) - Float64(-0.083333333333333 / x))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $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, -1e+115], t$95$0, If[LessEqual[t$95$1, 5e+83], N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(N[(0.91893853320467 - x), $MachinePrecision] - N[(-0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\
t_1 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+115}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \left(0.91893853320467 - x\right) - \frac{-0.083333333333333}{x}\right)\\
\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)) < -1e115 or 5.00000000000000029e83 < (+.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%
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f6466.0
Applied rewrites66.0%
if -1e115 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5.00000000000000029e83Initial program 94.0%
Applied rewrites94.1%
Taylor expanded in z around 0
Applied rewrites56.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(fma
(fma z (- y -0.0007936500793651) -0.0027777777777778)
(/ z x)
(/ 0.083333333333333 x)))
(t_1
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)))
(if (<= t_1 -1e+115)
t_0
(if (<= t_1 5e+83)
(-
(/ 0.083333333333333 x)
(- x (fma (log x) (- x 0.5) 0.91893853320467)))
t_0))))
double code(double x, double y, double z) {
double t_0 = fma(fma(z, (y - -0.0007936500793651), -0.0027777777777778), (z / x), (0.083333333333333 / x));
double t_1 = ((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333;
double tmp;
if (t_1 <= -1e+115) {
tmp = t_0;
} else if (t_1 <= 5e+83) {
tmp = (0.083333333333333 / x) - (x - fma(log(x), (x - 0.5), 0.91893853320467));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778), Float64(z / x), Float64(0.083333333333333 / x)) t_1 = Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) tmp = 0.0 if (t_1 <= -1e+115) tmp = t_0; elseif (t_1 <= 5e+83) tmp = Float64(Float64(0.083333333333333 / x) - Float64(x - fma(log(x), Float64(x - 0.5), 0.91893853320467))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $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, -1e+115], t$95$0, If[LessEqual[t$95$1, 5e+83], N[(N[(0.083333333333333 / x), $MachinePrecision] - N[(x - N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\
t_1 := \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+115}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+83}:\\
\;\;\;\;\frac{0.083333333333333}{x} - \left(x - \mathsf{fma}\left(\log x, x - 0.5, 0.91893853320467\right)\right)\\
\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)) < -1e115 or 5.00000000000000029e83 < (+.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%
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f6466.0
Applied rewrites66.0%
if -1e115 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5.00000000000000029e83Initial program 94.0%
Taylor expanded in z around 0
Applied rewrites56.9%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
sub-negate-revN/A
associate--l-N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-log.f64N/A
lift--.f64N/A
lower--.f64N/A
Applied rewrites56.9%
(FPCore (x y z)
:precision binary64
(if (<= x 7000000.0)
(fma
(fma z (- y -0.0007936500793651) -0.0027777777777778)
(/ z x)
(/ 0.083333333333333 x))
(fma (- x 0.5) (log x) (- x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 7000000.0) {
tmp = fma(fma(z, (y - -0.0007936500793651), -0.0027777777777778), (z / x), (0.083333333333333 / x));
} else {
tmp = fma((x - 0.5), log(x), -x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 7000000.0) tmp = fma(fma(z, Float64(y - -0.0007936500793651), -0.0027777777777778), Float64(z / x), Float64(0.083333333333333 / x)); else tmp = fma(Float64(x - 0.5), log(x), Float64(-x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 7000000.0], N[(N[(z * N[(y - -0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7000000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, y - -0.0007936500793651, -0.0027777777777778\right), \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, -x\right)\\
\end{array}
\end{array}
if x < 7e6Initial program 94.0%
Applied rewrites98.6%
Taylor expanded in x around 0
lower-/.f6466.0
Applied rewrites66.0%
if 7e6 < x Initial program 94.0%
Applied rewrites94.1%
Taylor expanded in x around inf
lower-*.f6435.6
Applied rewrites35.6%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.6
Applied rewrites35.6%
(FPCore (x y z)
:precision binary64
(if (<= x 7000000.0)
(/
(fma
(fma (- y -0.0007936500793651) z -0.0027777777777778)
z
0.083333333333333)
x)
(fma (- x 0.5) (log x) (- x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 7000000.0) {
tmp = fma(fma((y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = fma((x - 0.5), log(x), -x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 7000000.0) tmp = Float64(fma(fma(Float64(y - -0.0007936500793651), z, -0.0027777777777778), z, 0.083333333333333) / x); else tmp = fma(Float64(x - 0.5), log(x), Float64(-x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 7000000.0], N[(N[(N[(N[(y - -0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(y - -0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, -x\right)\\
\end{array}
\end{array}
if x < 7e6Initial 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-+.f6463.8
Applied rewrites63.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-*.f64N/A
metadata-evalN/A
add-flipN/A
lift-fma.f64N/A
lift-fma.f6463.8
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6463.8
Applied rewrites63.8%
if 7e6 < x Initial program 94.0%
Applied rewrites94.1%
Taylor expanded in x around inf
lower-*.f6435.6
Applied rewrites35.6%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.6
Applied rewrites35.6%
(FPCore (x y z) :precision binary64 (if (<= x 7000000.0) (/ (fma (* z (+ 0.0007936500793651 y)) z 0.083333333333333) x) (fma (- x 0.5) (log x) (- x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 7000000.0) {
tmp = fma((z * (0.0007936500793651 + y)), z, 0.083333333333333) / x;
} else {
tmp = fma((x - 0.5), log(x), -x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 7000000.0) tmp = Float64(fma(Float64(z * Float64(0.0007936500793651 + y)), z, 0.083333333333333) / x); else tmp = fma(Float64(x - 0.5), log(x), Float64(-x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 7000000.0], N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(z \cdot \left(0.0007936500793651 + y\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, -x\right)\\
\end{array}
\end{array}
if x < 7e6Initial 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-+.f6463.8
Applied rewrites63.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-*.f64N/A
metadata-evalN/A
add-flipN/A
lift-fma.f64N/A
lift-fma.f6463.8
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6463.8
Applied rewrites63.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f6463.4
Applied rewrites63.4%
if 7e6 < x Initial program 94.0%
Applied rewrites94.1%
Taylor expanded in x around inf
lower-*.f6435.6
Applied rewrites35.6%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6435.6
Applied rewrites35.6%
(FPCore (x y z)
:precision binary64
(if (<=
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
0.1)
(/ (fma (* y z) 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) <= 0.1) {
tmp = fma((y * z), 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) <= 0.1) tmp = Float64(fma(Float64(y * z), 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], 0.1], N[(N[(N[(y * z), $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}\;\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333 \leq 0.1:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot z, z, 0.083333333333333\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)) < 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-+.f6463.8
Applied rewrites63.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-*.f64N/A
metadata-evalN/A
add-flipN/A
lift-fma.f64N/A
lift-fma.f6463.8
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6463.8
Applied rewrites63.8%
Taylor expanded in y around inf
lower-*.f6450.7
Applied rewrites50.7%
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-/.f6442.6
Applied rewrites42.6%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6444.5
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-/.f6444.5
Applied rewrites44.5%
(FPCore (x y z) :precision binary64 (/ (fma (* z (+ 0.0007936500793651 y)) z 0.083333333333333) x))
double code(double x, double y, double z) {
return fma((z * (0.0007936500793651 + y)), z, 0.083333333333333) / x;
}
function code(x, y, z) return Float64(fma(Float64(z * Float64(0.0007936500793651 + y)), z, 0.083333333333333) / x) end
code[x_, y_, z_] := N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(z \cdot \left(0.0007936500793651 + y\right), 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-+.f6463.8
Applied rewrites63.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-*.f64N/A
metadata-evalN/A
add-flipN/A
lift-fma.f64N/A
lift-fma.f6463.8
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6463.8
Applied rewrites63.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f6463.4
Applied rewrites63.4%
(FPCore (x y z) :precision binary64 (/ (fma (* y z) z 0.083333333333333) x))
double code(double x, double y, double z) {
return fma((y * z), z, 0.083333333333333) / x;
}
function code(x, y, z) return Float64(fma(Float64(y * z), z, 0.083333333333333) / x) end
code[x_, y_, z_] := N[(N[(N[(y * z), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(y \cdot z, 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-+.f6463.8
Applied rewrites63.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-*.f64N/A
metadata-evalN/A
add-flipN/A
lift-fma.f64N/A
lift-fma.f6463.8
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6463.8
Applied rewrites63.8%
Taylor expanded in y around inf
lower-*.f6450.7
Applied rewrites50.7%
(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-+.f6463.8
Applied rewrites63.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-*.f64N/A
metadata-evalN/A
add-flipN/A
lift-fma.f64N/A
lift-fma.f6463.8
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6463.8
Applied rewrites63.8%
Taylor expanded in z around 0
Applied rewrites29.7%
(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-+.f6463.8
Applied rewrites63.8%
Taylor expanded in z around 0
Applied rewrites23.8%
herbie shell --seed 2025143
(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)))