
(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 17 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 1e-60)
(/
(fma
(- (* (fma (/ z y) 0.0007936500793651 z) y) 0.0027777777777778)
z
0.083333333333333)
x)
(fma
z
(/ (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778) x)
(+
(/ 0.083333333333333 x)
(- (* (log x) (- x 0.5)) (- x 0.91893853320467))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1e-60) {
tmp = fma(((fma((z / y), 0.0007936500793651, z) * y) - 0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = fma(z, (((z * (0.0007936500793651 + y)) - 0.0027777777777778) / x), ((0.083333333333333 / x) + ((log(x) * (x - 0.5)) - (x - 0.91893853320467))));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1e-60) tmp = Float64(fma(Float64(Float64(fma(Float64(z / y), 0.0007936500793651, z) * y) - 0.0027777777777778), z, 0.083333333333333) / x); else tmp = fma(z, Float64(Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778) / x), Float64(Float64(0.083333333333333 / x) + Float64(Float64(log(x) * Float64(x - 0.5)) - Float64(x - 0.91893853320467)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1e-60], N[(N[(N[(N[(N[(N[(z / y), $MachinePrecision] * 0.0007936500793651 + z), $MachinePrecision] * y), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(z * N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] / x), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-60}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(\frac{z}{y}, 0.0007936500793651, z\right) \cdot y - 0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778}{x}, \frac{0.083333333333333}{x} + \left(\log x \cdot \left(x - 0.5\right) - \left(x - 0.91893853320467\right)\right)\right)\\
\end{array}
\end{array}
if x < 9.9999999999999997e-61Initial program 99.7%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
Applied rewrites99.8%
if 9.9999999999999997e-61 < x Initial program 90.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites97.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))))
(if (<= t_0 4e+307) t_0 (* (* (/ (+ 0.0007936500793651 y) x) z) z))))
double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= 4e+307) {
tmp = t_0;
} else {
tmp = (((0.0007936500793651 + y) / x) * z) * z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
if (t_0 <= 4d+307) then
tmp = t_0
else
tmp = (((0.0007936500793651d0 + y) / x) * z) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= 4e+307) {
tmp = t_0;
} else {
tmp = (((0.0007936500793651 + y) / x) * z) * z;
}
return tmp;
}
def code(x, y, z): t_0 = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) tmp = 0 if t_0 <= 4e+307: tmp = t_0 else: tmp = (((0.0007936500793651 + y) / x) * z) * z return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) tmp = 0.0 if (t_0 <= 4e+307) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(0.0007936500793651 + y) / x) * z) * z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); tmp = 0.0; if (t_0 <= 4e+307) tmp = t_0; else tmp = (((0.0007936500793651 + y) / x) * z) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 4e+307], t$95$0, N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\
\mathbf{if}\;t\_0 \leq 4 \cdot 10^{+307}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{0.0007936500793651 + y}{x} \cdot z\right) \cdot z\\
\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)) < 3.99999999999999994e307Initial program 98.5%
if 3.99999999999999994e307 < (+.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 81.9%
Taylor expanded in z around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
lower-+.f6491.0
Applied rewrites91.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x)))
(if (<= (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) t_0) 4e+307)
(+ (* (- (log x) 1.0) x) t_0)
(* (* (/ (+ 0.0007936500793651 y) x) z) z))))
double code(double x, double y, double z) {
double t_0 = (((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x;
double tmp;
if ((((((x - 0.5) * log(x)) - x) + 0.91893853320467) + t_0) <= 4e+307) {
tmp = ((log(x) - 1.0) * x) + t_0;
} else {
tmp = (((0.0007936500793651 + y) / x) * z) * z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x
if ((((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + t_0) <= 4d+307) then
tmp = ((log(x) - 1.0d0) * x) + t_0
else
tmp = (((0.0007936500793651d0 + y) / x) * z) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x;
double tmp;
if ((((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + t_0) <= 4e+307) {
tmp = ((Math.log(x) - 1.0) * x) + t_0;
} else {
tmp = (((0.0007936500793651 + y) / x) * z) * z;
}
return tmp;
}
def code(x, y, z): t_0 = (((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x tmp = 0 if (((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + t_0) <= 4e+307: tmp = ((math.log(x) - 1.0) * x) + t_0 else: tmp = (((0.0007936500793651 + y) / x) * z) * z return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x) tmp = 0.0 if (Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + t_0) <= 4e+307) tmp = Float64(Float64(Float64(log(x) - 1.0) * x) + t_0); else tmp = Float64(Float64(Float64(Float64(0.0007936500793651 + y) / x) * z) * z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x; tmp = 0.0; if ((((((x - 0.5) * log(x)) - x) + 0.91893853320467) + t_0) <= 4e+307) tmp = ((log(x) - 1.0) * x) + t_0; else tmp = (((0.0007936500793651 + y) / x) * z) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + t$95$0), $MachinePrecision], 4e+307], N[(N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\\
\mathbf{if}\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + t\_0 \leq 4 \cdot 10^{+307}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x + t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{0.0007936500793651 + y}{x} \cdot z\right) \cdot z\\
\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)) < 3.99999999999999994e307Initial program 98.5%
Taylor expanded in x around inf
*-commutativeN/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6497.0
Applied rewrites97.0%
if 3.99999999999999994e307 < (+.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 81.9%
Taylor expanded in z around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
lower-+.f6491.0
Applied rewrites91.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (+ y 0.0007936500793651) z) 0.0027777777777778))
(t_1 (+ (* t_0 z) 0.083333333333333)))
(if (<= t_1 0.083332)
(fma t_0 (/ z x) (/ 0.083333333333333 x))
(if (<= t_1 5e+40)
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/ 0.083333333333333 x))
(*
(*
(/
(+
(- y (/ (- 0.0027777777777778 (/ 0.083333333333333 z)) z))
0.0007936500793651)
x)
z)
z)))))
double code(double x, double y, double z) {
double t_0 = ((y + 0.0007936500793651) * z) - 0.0027777777777778;
double t_1 = (t_0 * z) + 0.083333333333333;
double tmp;
if (t_1 <= 0.083332) {
tmp = fma(t_0, (z / x), (0.083333333333333 / x));
} else if (t_1 <= 5e+40) {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (0.083333333333333 / x);
} else {
tmp = ((((y - ((0.0027777777777778 - (0.083333333333333 / z)) / z)) + 0.0007936500793651) / x) * z) * z;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) t_1 = Float64(Float64(t_0 * z) + 0.083333333333333) tmp = 0.0 if (t_1 <= 0.083332) tmp = fma(t_0, Float64(z / x), Float64(0.083333333333333 / x)); elseif (t_1 <= 5e+40) tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(0.083333333333333 / x)); else tmp = Float64(Float64(Float64(Float64(Float64(y - Float64(Float64(0.0027777777777778 - Float64(0.083333333333333 / z)) / z)) + 0.0007936500793651) / x) * z) * z); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision]}, If[LessEqual[t$95$1, 0.083332], N[(t$95$0 * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+40], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(y - N[(N[(0.0027777777777778 - N[(0.083333333333333 / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + 0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\\
t_1 := t\_0 \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_1 \leq 0.083332:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+40}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\left(y - \frac{0.0027777777777778 - \frac{0.083333333333333}{z}}{z}\right) + 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.0833320000000000033Initial program 94.2%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6485.8
Applied rewrites85.8%
Applied rewrites88.3%
if 0.0833320000000000033 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5.00000000000000003e40Initial program 99.5%
Taylor expanded in z around 0
Applied rewrites95.6%
if 5.00000000000000003e40 < (+.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 87.4%
Taylor expanded in z around -inf
Applied rewrites90.0%
Taylor expanded in x around 0
Applied rewrites80.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (+ y 0.0007936500793651) z) 0.0027777777777778))
(t_1 (+ (* t_0 z) 0.083333333333333)))
(if (<= t_1 0.083332)
(fma t_0 (/ z x) (/ 0.083333333333333 x))
(if (<= t_1 5e+40)
(+
(fma (- x 0.5) (log x) (/ 0.083333333333333 x))
(- 0.91893853320467 x))
(*
(*
(/
(+
(- y (/ (- 0.0027777777777778 (/ 0.083333333333333 z)) z))
0.0007936500793651)
x)
z)
z)))))
double code(double x, double y, double z) {
double t_0 = ((y + 0.0007936500793651) * z) - 0.0027777777777778;
double t_1 = (t_0 * z) + 0.083333333333333;
double tmp;
if (t_1 <= 0.083332) {
tmp = fma(t_0, (z / x), (0.083333333333333 / x));
} else if (t_1 <= 5e+40) {
tmp = fma((x - 0.5), log(x), (0.083333333333333 / x)) + (0.91893853320467 - x);
} else {
tmp = ((((y - ((0.0027777777777778 - (0.083333333333333 / z)) / z)) + 0.0007936500793651) / x) * z) * z;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) t_1 = Float64(Float64(t_0 * z) + 0.083333333333333) tmp = 0.0 if (t_1 <= 0.083332) tmp = fma(t_0, Float64(z / x), Float64(0.083333333333333 / x)); elseif (t_1 <= 5e+40) tmp = Float64(fma(Float64(x - 0.5), log(x), Float64(0.083333333333333 / x)) + Float64(0.91893853320467 - x)); else tmp = Float64(Float64(Float64(Float64(Float64(y - Float64(Float64(0.0027777777777778 - Float64(0.083333333333333 / z)) / z)) + 0.0007936500793651) / x) * z) * z); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision]}, If[LessEqual[t$95$1, 0.083332], N[(t$95$0 * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+40], N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(y - N[(N[(0.0027777777777778 - N[(0.083333333333333 / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + 0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\\
t_1 := t\_0 \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_1 \leq 0.083332:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+40}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \frac{0.083333333333333}{x}\right) + \left(0.91893853320467 - x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\left(y - \frac{0.0027777777777778 - \frac{0.083333333333333}{z}}{z}\right) + 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.0833320000000000033Initial program 94.2%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6485.8
Applied rewrites85.8%
Applied rewrites88.3%
if 0.0833320000000000033 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5.00000000000000003e40Initial program 99.5%
Taylor expanded in z around 0
+-commutativeN/A
associate--l+N/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6495.6
Applied rewrites95.6%
if 5.00000000000000003e40 < (+.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 87.4%
Taylor expanded in z around -inf
Applied rewrites90.0%
Taylor expanded in x around 0
Applied rewrites80.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (+ y 0.0007936500793651) z) 0.0027777777777778))
(t_1 (+ (* t_0 z) 0.083333333333333)))
(if (<= t_1 0.083332)
(fma t_0 (/ z x) (/ 0.083333333333333 x))
(if (<= t_1 5e+40)
(+ (+ (- (* (log x) x) x) 0.91893853320467) (/ 0.083333333333333 x))
(*
(*
(/
(+
(- y (/ (- 0.0027777777777778 (/ 0.083333333333333 z)) z))
0.0007936500793651)
x)
z)
z)))))
double code(double x, double y, double z) {
double t_0 = ((y + 0.0007936500793651) * z) - 0.0027777777777778;
double t_1 = (t_0 * z) + 0.083333333333333;
double tmp;
if (t_1 <= 0.083332) {
tmp = fma(t_0, (z / x), (0.083333333333333 / x));
} else if (t_1 <= 5e+40) {
tmp = (((log(x) * x) - x) + 0.91893853320467) + (0.083333333333333 / x);
} else {
tmp = ((((y - ((0.0027777777777778 - (0.083333333333333 / z)) / z)) + 0.0007936500793651) / x) * z) * z;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) t_1 = Float64(Float64(t_0 * z) + 0.083333333333333) tmp = 0.0 if (t_1 <= 0.083332) tmp = fma(t_0, Float64(z / x), Float64(0.083333333333333 / x)); elseif (t_1 <= 5e+40) tmp = Float64(Float64(Float64(Float64(log(x) * x) - x) + 0.91893853320467) + Float64(0.083333333333333 / x)); else tmp = Float64(Float64(Float64(Float64(Float64(y - Float64(Float64(0.0027777777777778 - Float64(0.083333333333333 / z)) / z)) + 0.0007936500793651) / x) * z) * z); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision]}, If[LessEqual[t$95$1, 0.083332], N[(t$95$0 * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+40], N[(N[(N[(N[(N[Log[x], $MachinePrecision] * x), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(y - N[(N[(0.0027777777777778 - N[(0.083333333333333 / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + 0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\\
t_1 := t\_0 \cdot z + 0.083333333333333\\
\mathbf{if}\;t\_1 \leq 0.083332:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+40}:\\
\;\;\;\;\left(\left(\log x \cdot x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\left(y - \frac{0.0027777777777778 - \frac{0.083333333333333}{z}}{z}\right) + 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.0833320000000000033Initial program 94.2%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6485.8
Applied rewrites85.8%
Applied rewrites88.3%
if 0.0833320000000000033 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5.00000000000000003e40Initial program 99.5%
Taylor expanded in z around 0
Applied rewrites95.6%
Taylor expanded in x around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f6493.2
Applied rewrites93.2%
if 5.00000000000000003e40 < (+.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 87.4%
Taylor expanded in z around -inf
Applied rewrites90.0%
Taylor expanded in x around 0
Applied rewrites80.0%
(FPCore (x y z) :precision binary64 (fma (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778) (/ z x) (+ (/ 0.083333333333333 x) (- (* (log x) (- x 0.5)) (- x 0.91893853320467)))))
double code(double x, double y, double z) {
return fma(((z * (0.0007936500793651 + y)) - 0.0027777777777778), (z / x), ((0.083333333333333 / x) + ((log(x) * (x - 0.5)) - (x - 0.91893853320467))));
}
function code(x, y, z) return fma(Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778), Float64(z / x), Float64(Float64(0.083333333333333 / x) + Float64(Float64(log(x) * Float64(x - 0.5)) - Float64(x - 0.91893853320467)))) end
code[x_, y_, z_] := N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778, \frac{z}{x}, \frac{0.083333333333333}{x} + \left(\log x \cdot \left(x - 0.5\right) - \left(x - 0.91893853320467\right)\right)\right)
\end{array}
Initial program 93.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
associate-+l+N/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites98.5%
(FPCore (x y z)
:precision binary64
(if (<= x 4.4e+91)
(fma
(- (* (+ y 0.0007936500793651) z) 0.0027777777777778)
(/ z x)
(/ 0.083333333333333 x))
(* (- (log x) 1.0) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.4e+91) {
tmp = fma((((y + 0.0007936500793651) * z) - 0.0027777777777778), (z / x), (0.083333333333333 / x));
} else {
tmp = (log(x) - 1.0) * x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 4.4e+91) tmp = fma(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778), Float64(z / x), Float64(0.083333333333333 / x)); else tmp = Float64(Float64(log(x) - 1.0) * x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 4.4e+91], N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.4 \cdot 10^{+91}:\\
\;\;\;\;\mathsf{fma}\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778, \frac{z}{x}, \frac{0.083333333333333}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x\\
\end{array}
\end{array}
if x < 4.39999999999999999e91Initial program 99.2%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6486.3
Applied rewrites86.3%
Applied rewrites86.8%
if 4.39999999999999999e91 < x Initial program 83.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
associate-+l+N/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites96.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower--.f64N/A
lower-log.f6477.9
Applied rewrites77.9%
Final simplification83.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)))
(if (or (<= t_0 -40000000000.0) (not (<= t_0 3e+14)))
(* (* y (/ z x)) z)
(/ (fma -0.0027777777777778 z 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 <= -40000000000.0) || !(t_0 <= 3e+14)) {
tmp = (y * (z / x)) * z;
} else {
tmp = fma(-0.0027777777777778, z, 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 <= -40000000000.0) || !(t_0 <= 3e+14)) tmp = Float64(Float64(y * Float64(z / x)) * z); else tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x); end return 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, -40000000000.0], N[Not[LessEqual[t$95$0, 3e+14]], $MachinePrecision]], N[(N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / 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 -40000000000 \lor \neg \left(t\_0 \leq 3 \cdot 10^{+14}\right):\\
\;\;\;\;\left(y \cdot \frac{z}{x}\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < -4e10 or 3e14 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 89.4%
Taylor expanded in y around inf
associate-*l/N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6454.1
Applied rewrites54.1%
Applied rewrites55.5%
if -4e10 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 3e14Initial program 99.5%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6447.6
Applied rewrites47.6%
Taylor expanded in z around 0
Applied rewrites44.3%
Final simplification50.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)))
(if (<= t_0 -40000000000.0)
(* (* y (/ z x)) z)
(if (<= t_0 0.001)
(/ (fma -0.0027777777777778 z 0.083333333333333) x)
(* (* (/ z x) z) y)))))
double code(double x, double y, double z) {
double t_0 = (((y + 0.0007936500793651) * z) - 0.0027777777777778) * z;
double tmp;
if (t_0 <= -40000000000.0) {
tmp = (y * (z / x)) * z;
} else if (t_0 <= 0.001) {
tmp = fma(-0.0027777777777778, z, 0.083333333333333) / x;
} else {
tmp = ((z / x) * z) * y;
}
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 <= -40000000000.0) tmp = Float64(Float64(y * Float64(z / x)) * z); elseif (t_0 <= 0.001) tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(z / x) * z) * y); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$0, -40000000000.0], N[(N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t$95$0, 0.001], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(z / x), $MachinePrecision] * z), $MachinePrecision] * y), $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 -40000000000:\\
\;\;\;\;\left(y \cdot \frac{z}{x}\right) \cdot z\\
\mathbf{elif}\;t\_0 \leq 0.001:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z}{x} \cdot z\right) \cdot y\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < -4e10Initial program 93.9%
Taylor expanded in y around inf
associate-*l/N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6486.7
Applied rewrites86.7%
Applied rewrites86.9%
if -4e10 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 1e-3Initial program 99.4%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6446.6
Applied rewrites46.6%
Taylor expanded in z around 0
Applied rewrites45.6%
if 1e-3 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 88.5%
Taylor expanded in y around inf
associate-*l/N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6442.9
Applied rewrites42.9%
Applied rewrites44.6%
Applied rewrites50.0%
(FPCore (x y z)
:precision binary64
(if (<=
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
4000000000000.0)
(/ (fma (* y z) z 0.083333333333333) x)
(* (* (/ (+ 0.0007936500793651 y) x) z) z)))
double code(double x, double y, double z) {
double tmp;
if (((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) <= 4000000000000.0) {
tmp = fma((y * z), z, 0.083333333333333) / x;
} else {
tmp = (((0.0007936500793651 + y) / x) * z) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) <= 4000000000000.0) tmp = Float64(fma(Float64(y * z), z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(Float64(0.0007936500793651 + y) / x) * z) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision], 4000000000000.0], N[(N[(N[(y * z), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(0.0007936500793651 + y), $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 \leq 4000000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot z, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{0.0007936500793651 + y}{x} \cdot z\right) \cdot z\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 4e12Initial program 98.2%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6455.8
Applied rewrites55.8%
Taylor expanded in y around inf
Applied rewrites55.2%
if 4e12 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 88.2%
Taylor expanded in z around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
lower-+.f6477.5
Applied rewrites77.5%
(FPCore (x y z)
:precision binary64
(if (<=
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
4000000000000.0)
(/ (fma (* y z) z 0.083333333333333) x)
(* (/ (+ 0.0007936500793651 y) x) (* z z))))
double code(double x, double y, double z) {
double tmp;
if (((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) <= 4000000000000.0) {
tmp = fma((y * z), z, 0.083333333333333) / x;
} else {
tmp = ((0.0007936500793651 + y) / x) * (z * z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) <= 4000000000000.0) tmp = Float64(fma(Float64(y * z), z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(0.0007936500793651 + y) / x) * Float64(z * z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision], 4000000000000.0], N[(N[(N[(y * z), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] / x), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z \leq 4000000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot z, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.0007936500793651 + y}{x} \cdot \left(z \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 4e12Initial program 98.2%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6455.8
Applied rewrites55.8%
Taylor expanded in y around inf
Applied rewrites55.2%
if 4e12 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 88.2%
Taylor expanded in z around -inf
Applied rewrites89.8%
Taylor expanded in z around inf
Applied rewrites74.1%
(FPCore (x y z) :precision binary64 (fma (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) (/ z x) (/ 0.083333333333333 x)))
double code(double x, double y, double z) {
return fma((((y + 0.0007936500793651) * z) - 0.0027777777777778), (z / x), (0.083333333333333 / x));
}
function code(x, y, z) return fma(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778), Float64(z / x), Float64(0.083333333333333 / x)) end
code[x_, y_, z_] := N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778, \frac{z}{x}, \frac{0.083333333333333}{x}\right)
\end{array}
Initial program 93.8%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6463.2
Applied rewrites63.2%
Applied rewrites65.3%
(FPCore (x y z)
:precision binary64
(if (<= z 2.2e+25)
(/
(fma
(- (* (+ 0.0007936500793651 y) z) 0.0027777777777778)
z
0.083333333333333)
x)
(* (* (/ (+ 0.0007936500793651 y) x) z) z)))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.2e+25) {
tmp = fma((((0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = (((0.0007936500793651 + y) / x) * z) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 2.2e+25) tmp = Float64(fma(Float64(Float64(Float64(0.0007936500793651 + y) * z) - 0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(Float64(0.0007936500793651 + y) / x) * z) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 2.2e+25], N[(N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.2 \cdot 10^{+25}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(0.0007936500793651 + y\right) \cdot z - 0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{0.0007936500793651 + y}{x} \cdot z\right) \cdot z\\
\end{array}
\end{array}
if z < 2.2000000000000001e25Initial program 98.1%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6459.8
Applied rewrites59.8%
if 2.2000000000000001e25 < z Initial program 81.5%
Taylor expanded in z around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
lower-+.f6484.2
Applied rewrites84.2%
(FPCore (x y z) :precision binary64 (if (<= z 1.12e+27) (/ (fma (* y z) z 0.083333333333333) x) (* (* (/ z x) z) y)))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.12e+27) {
tmp = fma((y * z), z, 0.083333333333333) / x;
} else {
tmp = ((z / x) * z) * y;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 1.12e+27) tmp = Float64(fma(Float64(y * z), z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(z / x) * z) * y); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 1.12e+27], N[(N[(N[(y * z), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(z / x), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.12 \cdot 10^{+27}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot z, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z}{x} \cdot z\right) \cdot y\\
\end{array}
\end{array}
if z < 1.12e27Initial program 98.1%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6459.8
Applied rewrites59.8%
Taylor expanded in y around inf
Applied rewrites51.6%
if 1.12e27 < z Initial program 81.5%
Taylor expanded in y around inf
associate-*l/N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6449.7
Applied rewrites49.7%
Applied rewrites51.3%
Applied rewrites58.5%
(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 93.8%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6463.2
Applied rewrites63.2%
Taylor expanded in z around 0
Applied rewrites27.4%
(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 93.8%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6463.2
Applied rewrites63.2%
Taylor expanded in z around 0
Applied rewrites21.3%
Final simplification21.3%
(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 2024364
(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)))