
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + y) - z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + y) - z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
(FPCore (x y z) :precision binary64 (+ x (fma (log y) (- -0.5 y) (- y z))))
double code(double x, double y, double z) {
return x + fma(log(y), (-0.5 - y), (y - z));
}
function code(x, y, z) return Float64(x + fma(log(y), Float64(-0.5 - y), Float64(y - z))) end
code[x_, y_, z_] := N[(x + N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \mathsf{fma}\left(\log y, -0.5 - y, y - z\right)
\end{array}
Initial program 99.8%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (log y) (- 0.5)) z)) (t_1 (- y (* (log y) (+ y 0.5)))))
(if (<= x -6e-12)
(- x z)
(if (<= x 2.3e-284)
t_1
(if (<= x 3.5e-106)
t_0
(if (<= x 5.8e-49)
t_1
(if (<= x 1850.0) t_0 (+ x (* y (- 1.0 (log y)))))))))))
double code(double x, double y, double z) {
double t_0 = (log(y) * -0.5) - z;
double t_1 = y - (log(y) * (y + 0.5));
double tmp;
if (x <= -6e-12) {
tmp = x - z;
} else if (x <= 2.3e-284) {
tmp = t_1;
} else if (x <= 3.5e-106) {
tmp = t_0;
} else if (x <= 5.8e-49) {
tmp = t_1;
} else if (x <= 1850.0) {
tmp = t_0;
} else {
tmp = x + (y * (1.0 - log(y)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (log(y) * -0.5d0) - z
t_1 = y - (log(y) * (y + 0.5d0))
if (x <= (-6d-12)) then
tmp = x - z
else if (x <= 2.3d-284) then
tmp = t_1
else if (x <= 3.5d-106) then
tmp = t_0
else if (x <= 5.8d-49) then
tmp = t_1
else if (x <= 1850.0d0) then
tmp = t_0
else
tmp = x + (y * (1.0d0 - log(y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (Math.log(y) * -0.5) - z;
double t_1 = y - (Math.log(y) * (y + 0.5));
double tmp;
if (x <= -6e-12) {
tmp = x - z;
} else if (x <= 2.3e-284) {
tmp = t_1;
} else if (x <= 3.5e-106) {
tmp = t_0;
} else if (x <= 5.8e-49) {
tmp = t_1;
} else if (x <= 1850.0) {
tmp = t_0;
} else {
tmp = x + (y * (1.0 - Math.log(y)));
}
return tmp;
}
def code(x, y, z): t_0 = (math.log(y) * -0.5) - z t_1 = y - (math.log(y) * (y + 0.5)) tmp = 0 if x <= -6e-12: tmp = x - z elif x <= 2.3e-284: tmp = t_1 elif x <= 3.5e-106: tmp = t_0 elif x <= 5.8e-49: tmp = t_1 elif x <= 1850.0: tmp = t_0 else: tmp = x + (y * (1.0 - math.log(y))) return tmp
function code(x, y, z) t_0 = Float64(Float64(log(y) * Float64(-0.5)) - z) t_1 = Float64(y - Float64(log(y) * Float64(y + 0.5))) tmp = 0.0 if (x <= -6e-12) tmp = Float64(x - z); elseif (x <= 2.3e-284) tmp = t_1; elseif (x <= 3.5e-106) tmp = t_0; elseif (x <= 5.8e-49) tmp = t_1; elseif (x <= 1850.0) tmp = t_0; else tmp = Float64(x + Float64(y * Float64(1.0 - log(y)))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (log(y) * -0.5) - z; t_1 = y - (log(y) * (y + 0.5)); tmp = 0.0; if (x <= -6e-12) tmp = x - z; elseif (x <= 2.3e-284) tmp = t_1; elseif (x <= 3.5e-106) tmp = t_0; elseif (x <= 5.8e-49) tmp = t_1; elseif (x <= 1850.0) tmp = t_0; else tmp = x + (y * (1.0 - log(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Log[y], $MachinePrecision] * (-0.5)), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(y - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6e-12], N[(x - z), $MachinePrecision], If[LessEqual[x, 2.3e-284], t$95$1, If[LessEqual[x, 3.5e-106], t$95$0, If[LessEqual[x, 5.8e-49], t$95$1, If[LessEqual[x, 1850.0], t$95$0, N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log y \cdot \left(-0.5\right) - z\\
t_1 := y - \log y \cdot \left(y + 0.5\right)\\
\mathbf{if}\;x \leq -6 \cdot 10^{-12}:\\
\;\;\;\;x - z\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-284}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1850:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if x < -6.0000000000000003e-12Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
fma-undefine99.9%
associate-+r+99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-neg-in99.9%
+-commutative99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
sub-neg99.9%
+-commutative99.9%
associate-+r-99.9%
*-commutative99.9%
Applied egg-rr99.9%
add-cube-cbrt99.5%
pow399.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 98.3%
mul-1-neg98.3%
distribute-rgt-neg-in98.3%
log-rec98.3%
remove-double-neg98.3%
Simplified98.3%
Taylor expanded in y around 0 79.1%
if -6.0000000000000003e-12 < x < 2.3e-284 or 3.5e-106 < x < 5.8e-49Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
associate-+l+99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 77.1%
associate-+r+77.1%
associate-*r*77.1%
neg-mul-177.1%
+-commutative77.1%
cancel-sign-sub-inv77.1%
+-commutative77.1%
Simplified77.1%
Taylor expanded in x around 0 77.1%
+-commutative77.1%
Simplified77.1%
if 2.3e-284 < x < 3.5e-106 or 5.8e-49 < x < 1850Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
associate-+r+99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-neg-in99.9%
+-commutative99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
sub-neg99.9%
+-commutative99.9%
associate-+r-99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 80.5%
associate--r+80.6%
Simplified80.6%
Taylor expanded in x around 0 79.3%
mul-1-neg79.3%
Simplified79.3%
if 1850 < x Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 88.2%
log-rec88.2%
sub-neg88.2%
Simplified88.2%
Final simplification80.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ x y) (* (log y) (+ y 0.5)))))
(if (<= y 1200.0)
(- (- x z) (* (log y) 0.5))
(if (<= y 1.65e+44)
t_0
(if (<= y 5.8e+97)
(- (+ x (* (log y) -0.5)) z)
(if (<= y 1.15e+161) t_0 (- (- y z) (* y (log y)))))))))
double code(double x, double y, double z) {
double t_0 = (x + y) - (log(y) * (y + 0.5));
double tmp;
if (y <= 1200.0) {
tmp = (x - z) - (log(y) * 0.5);
} else if (y <= 1.65e+44) {
tmp = t_0;
} else if (y <= 5.8e+97) {
tmp = (x + (log(y) * -0.5)) - z;
} else if (y <= 1.15e+161) {
tmp = t_0;
} else {
tmp = (y - z) - (y * log(y));
}
return tmp;
}
real(8) function code(x, y, z)
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 + y) - (log(y) * (y + 0.5d0))
if (y <= 1200.0d0) then
tmp = (x - z) - (log(y) * 0.5d0)
else if (y <= 1.65d+44) then
tmp = t_0
else if (y <= 5.8d+97) then
tmp = (x + (log(y) * (-0.5d0))) - z
else if (y <= 1.15d+161) then
tmp = t_0
else
tmp = (y - z) - (y * log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + y) - (Math.log(y) * (y + 0.5));
double tmp;
if (y <= 1200.0) {
tmp = (x - z) - (Math.log(y) * 0.5);
} else if (y <= 1.65e+44) {
tmp = t_0;
} else if (y <= 5.8e+97) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else if (y <= 1.15e+161) {
tmp = t_0;
} else {
tmp = (y - z) - (y * Math.log(y));
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) - (math.log(y) * (y + 0.5)) tmp = 0 if y <= 1200.0: tmp = (x - z) - (math.log(y) * 0.5) elif y <= 1.65e+44: tmp = t_0 elif y <= 5.8e+97: tmp = (x + (math.log(y) * -0.5)) - z elif y <= 1.15e+161: tmp = t_0 else: tmp = (y - z) - (y * math.log(y)) return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) - Float64(log(y) * Float64(y + 0.5))) tmp = 0.0 if (y <= 1200.0) tmp = Float64(Float64(x - z) - Float64(log(y) * 0.5)); elseif (y <= 1.65e+44) tmp = t_0; elseif (y <= 5.8e+97) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); elseif (y <= 1.15e+161) tmp = t_0; else tmp = Float64(Float64(y - z) - Float64(y * log(y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) - (log(y) * (y + 0.5)); tmp = 0.0; if (y <= 1200.0) tmp = (x - z) - (log(y) * 0.5); elseif (y <= 1.65e+44) tmp = t_0; elseif (y <= 5.8e+97) tmp = (x + (log(y) * -0.5)) - z; elseif (y <= 1.15e+161) tmp = t_0; else tmp = (y - z) - (y * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1200.0], N[(N[(x - z), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.65e+44], t$95$0, If[LessEqual[y, 5.8e+97], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 1.15e+161], t$95$0, N[(N[(y - z), $MachinePrecision] - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + y\right) - \log y \cdot \left(y + 0.5\right)\\
\mathbf{if}\;y \leq 1200:\\
\;\;\;\;\left(x - z\right) - \log y \cdot 0.5\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+97}:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+161}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) - y \cdot \log y\\
\end{array}
\end{array}
if y < 1200Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r+100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-neg-in100.0%
+-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r-100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 98.8%
associate--r+98.8%
Simplified98.8%
if 1200 < y < 1.65000000000000007e44 or 5.79999999999999974e97 < y < 1.15e161Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
associate-+l+99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-define99.6%
+-commutative99.6%
distribute-neg-in99.6%
unsub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 95.4%
associate-+r+95.4%
associate-*r*95.4%
neg-mul-195.4%
+-commutative95.4%
cancel-sign-sub-inv95.4%
+-commutative95.4%
Simplified95.4%
if 1.65000000000000007e44 < y < 5.79999999999999974e97Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 90.0%
+-commutative90.0%
Simplified90.0%
if 1.15e161 < y Initial program 99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in y around inf 90.7%
*-commutative90.7%
log-rec90.7%
distribute-lft-neg-in90.7%
distribute-rgt-neg-in90.7%
Simplified90.7%
Taylor expanded in z around 0 90.7%
log-pow5.9%
distribute-lft-out5.9%
mul-1-neg5.9%
sub-neg5.9%
associate--l-5.9%
log-pow90.7%
Simplified90.7%
Final simplification95.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (log y) (- 0.5)) z))
(t_1 (* y (- 1.0 (log y))))
(t_2 (+ x t_1)))
(if (<= x -240000000.0)
t_2
(if (<= x -7.5e-268)
t_0
(if (<= x 2.3e-293) t_1 (if (<= x 95.0) t_0 t_2))))))
double code(double x, double y, double z) {
double t_0 = (log(y) * -0.5) - z;
double t_1 = y * (1.0 - log(y));
double t_2 = x + t_1;
double tmp;
if (x <= -240000000.0) {
tmp = t_2;
} else if (x <= -7.5e-268) {
tmp = t_0;
} else if (x <= 2.3e-293) {
tmp = t_1;
} else if (x <= 95.0) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (log(y) * -0.5d0) - z
t_1 = y * (1.0d0 - log(y))
t_2 = x + t_1
if (x <= (-240000000.0d0)) then
tmp = t_2
else if (x <= (-7.5d-268)) then
tmp = t_0
else if (x <= 2.3d-293) then
tmp = t_1
else if (x <= 95.0d0) then
tmp = t_0
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (Math.log(y) * -0.5) - z;
double t_1 = y * (1.0 - Math.log(y));
double t_2 = x + t_1;
double tmp;
if (x <= -240000000.0) {
tmp = t_2;
} else if (x <= -7.5e-268) {
tmp = t_0;
} else if (x <= 2.3e-293) {
tmp = t_1;
} else if (x <= 95.0) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = (math.log(y) * -0.5) - z t_1 = y * (1.0 - math.log(y)) t_2 = x + t_1 tmp = 0 if x <= -240000000.0: tmp = t_2 elif x <= -7.5e-268: tmp = t_0 elif x <= 2.3e-293: tmp = t_1 elif x <= 95.0: tmp = t_0 else: tmp = t_2 return tmp
function code(x, y, z) t_0 = Float64(Float64(log(y) * Float64(-0.5)) - z) t_1 = Float64(y * Float64(1.0 - log(y))) t_2 = Float64(x + t_1) tmp = 0.0 if (x <= -240000000.0) tmp = t_2; elseif (x <= -7.5e-268) tmp = t_0; elseif (x <= 2.3e-293) tmp = t_1; elseif (x <= 95.0) tmp = t_0; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (log(y) * -0.5) - z; t_1 = y * (1.0 - log(y)); t_2 = x + t_1; tmp = 0.0; if (x <= -240000000.0) tmp = t_2; elseif (x <= -7.5e-268) tmp = t_0; elseif (x <= 2.3e-293) tmp = t_1; elseif (x <= 95.0) tmp = t_0; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Log[y], $MachinePrecision] * (-0.5)), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + t$95$1), $MachinePrecision]}, If[LessEqual[x, -240000000.0], t$95$2, If[LessEqual[x, -7.5e-268], t$95$0, If[LessEqual[x, 2.3e-293], t$95$1, If[LessEqual[x, 95.0], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log y \cdot \left(-0.5\right) - z\\
t_1 := y \cdot \left(1 - \log y\right)\\
t_2 := x + t\_1\\
\mathbf{if}\;x \leq -240000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{-268}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-293}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 95:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -2.4e8 or 95 < x Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 84.2%
log-rec84.2%
sub-neg84.2%
Simplified84.2%
if -2.4e8 < x < -7.4999999999999999e-268 or 2.29999999999999995e-293 < x < 95Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
associate-+r+99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-neg-in99.9%
+-commutative99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
sub-neg99.9%
+-commutative99.9%
associate-+r-99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 73.9%
associate--r+73.9%
Simplified73.9%
Taylor expanded in x around 0 72.7%
mul-1-neg72.7%
Simplified72.7%
if -7.4999999999999999e-268 < x < 2.29999999999999995e-293Initial program 99.2%
associate--l+99.2%
sub-neg99.2%
associate-+l+99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-define99.4%
+-commutative99.4%
distribute-neg-in99.4%
unsub-neg99.4%
metadata-eval99.4%
Simplified99.4%
fma-undefine99.2%
associate-+r+99.2%
sub-neg99.2%
metadata-eval99.2%
distribute-neg-in99.2%
+-commutative99.2%
distribute-rgt-neg-in99.2%
*-commutative99.2%
sub-neg99.2%
+-commutative99.2%
associate-+r-99.2%
*-commutative99.2%
Applied egg-rr99.2%
Taylor expanded in y around inf 87.1%
*-commutative87.1%
log-rec87.1%
cancel-sign-sub87.1%
*-commutative87.1%
neg-mul-187.1%
log-rec87.1%
log-rec87.1%
sub-neg87.1%
Simplified87.1%
Final simplification78.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (* y (- 1.0 (log y))))))
(if (<= y 1200.0)
(- (- x z) (* (log y) 0.5))
(if (<= y 4e+44)
t_0
(if (<= y 5.8e+97)
(- (+ x (* (log y) -0.5)) z)
(if (<= y 6.2e+160) t_0 (- (- y z) (* y (log y)))))))))
double code(double x, double y, double z) {
double t_0 = x + (y * (1.0 - log(y)));
double tmp;
if (y <= 1200.0) {
tmp = (x - z) - (log(y) * 0.5);
} else if (y <= 4e+44) {
tmp = t_0;
} else if (y <= 5.8e+97) {
tmp = (x + (log(y) * -0.5)) - z;
} else if (y <= 6.2e+160) {
tmp = t_0;
} else {
tmp = (y - z) - (y * log(y));
}
return tmp;
}
real(8) function code(x, y, z)
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 + (y * (1.0d0 - log(y)))
if (y <= 1200.0d0) then
tmp = (x - z) - (log(y) * 0.5d0)
else if (y <= 4d+44) then
tmp = t_0
else if (y <= 5.8d+97) then
tmp = (x + (log(y) * (-0.5d0))) - z
else if (y <= 6.2d+160) then
tmp = t_0
else
tmp = (y - z) - (y * log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (y * (1.0 - Math.log(y)));
double tmp;
if (y <= 1200.0) {
tmp = (x - z) - (Math.log(y) * 0.5);
} else if (y <= 4e+44) {
tmp = t_0;
} else if (y <= 5.8e+97) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else if (y <= 6.2e+160) {
tmp = t_0;
} else {
tmp = (y - z) - (y * Math.log(y));
}
return tmp;
}
def code(x, y, z): t_0 = x + (y * (1.0 - math.log(y))) tmp = 0 if y <= 1200.0: tmp = (x - z) - (math.log(y) * 0.5) elif y <= 4e+44: tmp = t_0 elif y <= 5.8e+97: tmp = (x + (math.log(y) * -0.5)) - z elif y <= 6.2e+160: tmp = t_0 else: tmp = (y - z) - (y * math.log(y)) return tmp
function code(x, y, z) t_0 = Float64(x + Float64(y * Float64(1.0 - log(y)))) tmp = 0.0 if (y <= 1200.0) tmp = Float64(Float64(x - z) - Float64(log(y) * 0.5)); elseif (y <= 4e+44) tmp = t_0; elseif (y <= 5.8e+97) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); elseif (y <= 6.2e+160) tmp = t_0; else tmp = Float64(Float64(y - z) - Float64(y * log(y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (y * (1.0 - log(y))); tmp = 0.0; if (y <= 1200.0) tmp = (x - z) - (log(y) * 0.5); elseif (y <= 4e+44) tmp = t_0; elseif (y <= 5.8e+97) tmp = (x + (log(y) * -0.5)) - z; elseif (y <= 6.2e+160) tmp = t_0; else tmp = (y - z) - (y * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1200.0], N[(N[(x - z), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e+44], t$95$0, If[LessEqual[y, 5.8e+97], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 6.2e+160], t$95$0, N[(N[(y - z), $MachinePrecision] - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + y \cdot \left(1 - \log y\right)\\
\mathbf{if}\;y \leq 1200:\\
\;\;\;\;\left(x - z\right) - \log y \cdot 0.5\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+97}:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+160}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) - y \cdot \log y\\
\end{array}
\end{array}
if y < 1200Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r+100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-neg-in100.0%
+-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r-100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 98.8%
associate--r+98.8%
Simplified98.8%
if 1200 < y < 4.0000000000000004e44 or 5.79999999999999974e97 < y < 6.1999999999999996e160Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
associate-+l+99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-define99.6%
+-commutative99.6%
distribute-neg-in99.6%
unsub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 95.4%
log-rec95.4%
sub-neg95.4%
Simplified95.4%
if 4.0000000000000004e44 < y < 5.79999999999999974e97Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 90.0%
+-commutative90.0%
Simplified90.0%
if 6.1999999999999996e160 < y Initial program 99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in y around inf 90.7%
*-commutative90.7%
log-rec90.7%
distribute-lft-neg-in90.7%
distribute-rgt-neg-in90.7%
Simplified90.7%
Taylor expanded in z around 0 90.7%
log-pow5.9%
distribute-lft-out5.9%
mul-1-neg5.9%
sub-neg5.9%
associate--l-5.9%
log-pow90.7%
Simplified90.7%
Final simplification95.6%
(FPCore (x y z) :precision binary64 (if (or (<= y 1200.0) (and (not (<= y 7.2e+43)) (<= y 5.8e+97))) (- (+ x (* (log y) -0.5)) z) (+ x (* y (- 1.0 (log y))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= 1200.0) || (!(y <= 7.2e+43) && (y <= 5.8e+97))) {
tmp = (x + (log(y) * -0.5)) - z;
} else {
tmp = x + (y * (1.0 - log(y)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= 1200.0d0) .or. (.not. (y <= 7.2d+43)) .and. (y <= 5.8d+97)) then
tmp = (x + (log(y) * (-0.5d0))) - z
else
tmp = x + (y * (1.0d0 - log(y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= 1200.0) || (!(y <= 7.2e+43) && (y <= 5.8e+97))) {
tmp = (x + (Math.log(y) * -0.5)) - z;
} else {
tmp = x + (y * (1.0 - Math.log(y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= 1200.0) or (not (y <= 7.2e+43) and (y <= 5.8e+97)): tmp = (x + (math.log(y) * -0.5)) - z else: tmp = x + (y * (1.0 - math.log(y))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= 1200.0) || (!(y <= 7.2e+43) && (y <= 5.8e+97))) tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); else tmp = Float64(x + Float64(y * Float64(1.0 - log(y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= 1200.0) || (~((y <= 7.2e+43)) && (y <= 5.8e+97))) tmp = (x + (log(y) * -0.5)) - z; else tmp = x + (y * (1.0 - log(y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, 1200.0], And[N[Not[LessEqual[y, 7.2e+43]], $MachinePrecision], LessEqual[y, 5.8e+97]]], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1200 \lor \neg \left(y \leq 7.2 \cdot 10^{+43}\right) \land y \leq 5.8 \cdot 10^{+97}:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 1200 or 7.2000000000000002e43 < y < 5.79999999999999974e97Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.6%
+-commutative97.6%
Simplified97.6%
if 1200 < y < 7.2000000000000002e43 or 5.79999999999999974e97 < y Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
associate-+l+99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-define99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 82.1%
log-rec82.1%
sub-neg82.1%
Simplified82.1%
Final simplification91.6%
(FPCore (x y z)
:precision binary64
(if (<= y 1200.0)
(- (- x z) (* (log y) 0.5))
(if (or (<= y 3.8e+44) (not (<= y 5.8e+97)))
(+ x (* y (- 1.0 (log y))))
(- (+ x (* (log y) -0.5)) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1200.0) {
tmp = (x - z) - (log(y) * 0.5);
} else if ((y <= 3.8e+44) || !(y <= 5.8e+97)) {
tmp = x + (y * (1.0 - log(y)));
} else {
tmp = (x + (log(y) * -0.5)) - z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 1200.0d0) then
tmp = (x - z) - (log(y) * 0.5d0)
else if ((y <= 3.8d+44) .or. (.not. (y <= 5.8d+97))) then
tmp = x + (y * (1.0d0 - log(y)))
else
tmp = (x + (log(y) * (-0.5d0))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1200.0) {
tmp = (x - z) - (Math.log(y) * 0.5);
} else if ((y <= 3.8e+44) || !(y <= 5.8e+97)) {
tmp = x + (y * (1.0 - Math.log(y)));
} else {
tmp = (x + (Math.log(y) * -0.5)) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1200.0: tmp = (x - z) - (math.log(y) * 0.5) elif (y <= 3.8e+44) or not (y <= 5.8e+97): tmp = x + (y * (1.0 - math.log(y))) else: tmp = (x + (math.log(y) * -0.5)) - z return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1200.0) tmp = Float64(Float64(x - z) - Float64(log(y) * 0.5)); elseif ((y <= 3.8e+44) || !(y <= 5.8e+97)) tmp = Float64(x + Float64(y * Float64(1.0 - log(y)))); else tmp = Float64(Float64(x + Float64(log(y) * -0.5)) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1200.0) tmp = (x - z) - (log(y) * 0.5); elseif ((y <= 3.8e+44) || ~((y <= 5.8e+97))) tmp = x + (y * (1.0 - log(y))); else tmp = (x + (log(y) * -0.5)) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1200.0], N[(N[(x - z), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 3.8e+44], N[Not[LessEqual[y, 5.8e+97]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1200:\\
\;\;\;\;\left(x - z\right) - \log y \cdot 0.5\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+44} \lor \neg \left(y \leq 5.8 \cdot 10^{+97}\right):\\
\;\;\;\;x + y \cdot \left(1 - \log y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + \log y \cdot -0.5\right) - z\\
\end{array}
\end{array}
if y < 1200Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
fma-undefine100.0%
associate-+r+100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-neg-in100.0%
+-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r-100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 98.8%
associate--r+98.8%
Simplified98.8%
if 1200 < y < 3.8000000000000002e44 or 5.79999999999999974e97 < y Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
associate-+l+99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-define99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 82.1%
log-rec82.1%
sub-neg82.1%
Simplified82.1%
if 3.8000000000000002e44 < y < 5.79999999999999974e97Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 90.0%
+-commutative90.0%
Simplified90.0%
Final simplification91.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.5e+28) (not (<= z 210.0))) (- x z) (- x (* (log y) 0.5))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5e+28) || !(z <= 210.0)) {
tmp = x - z;
} else {
tmp = x - (log(y) * 0.5);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.5d+28)) .or. (.not. (z <= 210.0d0))) then
tmp = x - z
else
tmp = x - (log(y) * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.5e+28) || !(z <= 210.0)) {
tmp = x - z;
} else {
tmp = x - (Math.log(y) * 0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.5e+28) or not (z <= 210.0): tmp = x - z else: tmp = x - (math.log(y) * 0.5) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.5e+28) || !(z <= 210.0)) tmp = Float64(x - z); else tmp = Float64(x - Float64(log(y) * 0.5)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.5e+28) || ~((z <= 210.0))) tmp = x - z; else tmp = x - (log(y) * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.5e+28], N[Not[LessEqual[z, 210.0]], $MachinePrecision]], N[(x - z), $MachinePrecision], N[(x - N[(N[Log[y], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+28} \lor \neg \left(z \leq 210\right):\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;x - \log y \cdot 0.5\\
\end{array}
\end{array}
if z < -1.5e28 or 210 < z Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
associate-+r+99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-neg-in99.9%
+-commutative99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
sub-neg99.9%
+-commutative99.9%
associate-+r-99.9%
*-commutative99.9%
Applied egg-rr99.9%
add-cube-cbrt99.5%
pow399.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 98.5%
mul-1-neg98.5%
distribute-rgt-neg-in98.5%
log-rec98.5%
remove-double-neg98.5%
Simplified98.5%
Taylor expanded in y around 0 74.7%
if -1.5e28 < z < 210Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
associate-+r+99.8%
sub-neg99.8%
metadata-eval99.8%
distribute-neg-in99.8%
+-commutative99.8%
distribute-rgt-neg-in99.8%
*-commutative99.8%
sub-neg99.8%
+-commutative99.8%
associate-+r-99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 72.4%
associate--r+72.4%
Simplified72.4%
Taylor expanded in z around 0 71.5%
Final simplification72.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.5e-15) (not (<= x 1.75e-276))) (- x z) (* (log y) -0.5)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.5e-15) || !(x <= 1.75e-276)) {
tmp = x - z;
} else {
tmp = log(y) * -0.5;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-3.5d-15)) .or. (.not. (x <= 1.75d-276))) then
tmp = x - z
else
tmp = log(y) * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.5e-15) || !(x <= 1.75e-276)) {
tmp = x - z;
} else {
tmp = Math.log(y) * -0.5;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.5e-15) or not (x <= 1.75e-276): tmp = x - z else: tmp = math.log(y) * -0.5 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.5e-15) || !(x <= 1.75e-276)) tmp = Float64(x - z); else tmp = Float64(log(y) * -0.5); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.5e-15) || ~((x <= 1.75e-276))) tmp = x - z; else tmp = log(y) * -0.5; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.5e-15], N[Not[LessEqual[x, 1.75e-276]], $MachinePrecision]], N[(x - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-15} \lor \neg \left(x \leq 1.75 \cdot 10^{-276}\right):\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot -0.5\\
\end{array}
\end{array}
if x < -3.5000000000000001e-15 or 1.74999999999999996e-276 < x Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
associate-+r+99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-neg-in99.9%
+-commutative99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
sub-neg99.9%
+-commutative99.9%
associate-+r-99.9%
*-commutative99.9%
Applied egg-rr99.9%
add-cube-cbrt99.3%
pow399.3%
Applied egg-rr99.3%
Taylor expanded in y around inf 90.6%
mul-1-neg90.6%
distribute-rgt-neg-in90.6%
log-rec90.6%
remove-double-neg90.6%
Simplified90.6%
Taylor expanded in y around 0 68.0%
if -3.5000000000000001e-15 < x < 1.74999999999999996e-276Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
associate-+l+99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
fma-undefine99.8%
associate-+r+99.8%
sub-neg99.8%
metadata-eval99.8%
distribute-neg-in99.8%
+-commutative99.8%
distribute-rgt-neg-in99.8%
*-commutative99.8%
sub-neg99.8%
+-commutative99.8%
associate-+r-99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 65.8%
associate--r+65.8%
Simplified65.8%
Taylor expanded in z around 0 40.2%
Taylor expanded in x around 0 40.2%
Final simplification60.2%
(FPCore (x y z) :precision binary64 (+ (- y z) (- x (* (log y) (+ y 0.5)))))
double code(double x, double y, double z) {
return (y - z) + (x - (log(y) * (y + 0.5)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y - z) + (x - (log(y) * (y + 0.5d0)))
end function
public static double code(double x, double y, double z) {
return (y - z) + (x - (Math.log(y) * (y + 0.5)));
}
def code(x, y, z): return (y - z) + (x - (math.log(y) * (y + 0.5)))
function code(x, y, z) return Float64(Float64(y - z) + Float64(x - Float64(log(y) * Float64(y + 0.5)))) end
function tmp = code(x, y, z) tmp = (y - z) + (x - (log(y) * (y + 0.5))); end
code[x_, y_, z_] := N[(N[(y - z), $MachinePrecision] + N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y - z\right) + \left(x - \log y \cdot \left(y + 0.5\right)\right)
\end{array}
Initial program 99.8%
associate--l+99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (- (+ x (- y z)) (* (log y) (+ y 0.5))))
double code(double x, double y, double z) {
return (x + (y - z)) - (log(y) * (y + 0.5));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + (y - z)) - (log(y) * (y + 0.5d0))
end function
public static double code(double x, double y, double z) {
return (x + (y - z)) - (Math.log(y) * (y + 0.5));
}
def code(x, y, z): return (x + (y - z)) - (math.log(y) * (y + 0.5))
function code(x, y, z) return Float64(Float64(x + Float64(y - z)) - Float64(log(y) * Float64(y + 0.5))) end
function tmp = code(x, y, z) tmp = (x + (y - z)) - (log(y) * (y + 0.5)); end
code[x_, y_, z_] := N[(N[(x + N[(y - z), $MachinePrecision]), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \left(y - z\right)\right) - \log y \cdot \left(y + 0.5\right)
\end{array}
Initial program 99.8%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
associate-+r+99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-neg-in99.9%
+-commutative99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
sub-neg99.9%
+-commutative99.9%
associate-+r-99.9%
*-commutative99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= y 5.9e+97) (- (+ x y) z) (* y (- 1.0 (log y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.9e+97) {
tmp = (x + y) - z;
} else {
tmp = y * (1.0 - log(y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 5.9d+97) then
tmp = (x + y) - z
else
tmp = y * (1.0d0 - log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 5.9e+97) {
tmp = (x + y) - z;
} else {
tmp = y * (1.0 - Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 5.9e+97: tmp = (x + y) - z else: tmp = y * (1.0 - math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 5.9e+97) tmp = Float64(Float64(x + y) - z); else tmp = Float64(y * Float64(1.0 - log(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 5.9e+97) tmp = (x + y) - z; else tmp = y * (1.0 - log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 5.9e+97], N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision], N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.9 \cdot 10^{+97}:\\
\;\;\;\;\left(x + y\right) - z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \log y\right)\\
\end{array}
\end{array}
if y < 5.90000000000000009e97Initial program 99.9%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine100.0%
associate-+r+100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-neg-in100.0%
+-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r-100.0%
*-commutative100.0%
Applied egg-rr100.0%
add-cube-cbrt99.3%
pow399.4%
Applied egg-rr99.4%
Taylor expanded in y around inf 69.6%
if 5.90000000000000009e97 < y Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
associate-+l+99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-define99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
fma-undefine99.7%
associate-+r+99.7%
sub-neg99.7%
metadata-eval99.7%
distribute-neg-in99.7%
+-commutative99.7%
distribute-rgt-neg-in99.7%
*-commutative99.7%
sub-neg99.7%
+-commutative99.7%
associate-+r-99.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 65.6%
*-commutative65.6%
log-rec65.6%
cancel-sign-sub65.6%
*-commutative65.6%
neg-mul-165.6%
log-rec65.6%
log-rec65.6%
sub-neg65.6%
Simplified65.6%
Final simplification68.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.2e+29) (not (<= z 8.8e+17))) (- z) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.2e+29) || !(z <= 8.8e+17)) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-6.2d+29)) .or. (.not. (z <= 8.8d+17))) then
tmp = -z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.2e+29) || !(z <= 8.8e+17)) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.2e+29) or not (z <= 8.8e+17): tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.2e+29) || !(z <= 8.8e+17)) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.2e+29) || ~((z <= 8.8e+17))) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.2e+29], N[Not[LessEqual[z, 8.8e+17]], $MachinePrecision]], (-z), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+29} \lor \neg \left(z \leq 8.8 \cdot 10^{+17}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.1999999999999998e29 or 8.8e17 < z Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
associate-+r+99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-neg-in99.9%
+-commutative99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
sub-neg99.9%
+-commutative99.9%
associate-+r-99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 62.9%
neg-mul-162.9%
Simplified62.9%
if -6.1999999999999998e29 < z < 8.8e17Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 42.9%
Final simplification51.1%
(FPCore (x y z) :precision binary64 (- x z))
double code(double x, double y, double z) {
return x - z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - z
end function
public static double code(double x, double y, double z) {
return x - z;
}
def code(x, y, z): return x - z
function code(x, y, z) return Float64(x - z) end
function tmp = code(x, y, z) tmp = x - z; end
code[x_, y_, z_] := N[(x - z), $MachinePrecision]
\begin{array}{l}
\\
x - z
\end{array}
Initial program 99.8%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
associate-+r+99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-neg-in99.9%
+-commutative99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
sub-neg99.9%
+-commutative99.9%
associate-+r-99.9%
*-commutative99.9%
Applied egg-rr99.9%
add-cube-cbrt99.1%
pow399.1%
Applied egg-rr99.1%
Taylor expanded in y around inf 82.1%
mul-1-neg82.1%
distribute-rgt-neg-in82.1%
log-rec82.1%
remove-double-neg82.1%
Simplified82.1%
Taylor expanded in y around 0 56.6%
Final simplification56.6%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.8%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 30.2%
Final simplification30.2%
(FPCore (x y z) :precision binary64 (- (- (+ y x) z) (* (+ y 0.5) (log y))))
double code(double x, double y, double z) {
return ((y + x) - z) - ((y + 0.5) * log(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((y + x) - z) - ((y + 0.5d0) * log(y))
end function
public static double code(double x, double y, double z) {
return ((y + x) - z) - ((y + 0.5) * Math.log(y));
}
def code(x, y, z): return ((y + x) - z) - ((y + 0.5) * math.log(y))
function code(x, y, z) return Float64(Float64(Float64(y + x) - z) - Float64(Float64(y + 0.5) * log(y))) end
function tmp = code(x, y, z) tmp = ((y + x) - z) - ((y + 0.5) * log(y)); end
code[x_, y_, z_] := N[(N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision] - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(y + x\right) - z\right) - \left(y + 0.5\right) \cdot \log y
\end{array}
herbie shell --seed 2024034
(FPCore (x y z)
:name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(- (- (+ y x) z) (* (+ y 0.5) (log y)))
(- (+ (- x (* (+ y 0.5) (log y))) y) z))