
(FPCore (x y z) :precision binary64 (+ (+ (/ x 2.0) (* y x)) z))
double code(double x, double y, double z) {
return ((x / 2.0) + (y * 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 / 2.0d0) + (y * x)) + z
end function
public static double code(double x, double y, double z) {
return ((x / 2.0) + (y * x)) + z;
}
def code(x, y, z): return ((x / 2.0) + (y * x)) + z
function code(x, y, z) return Float64(Float64(Float64(x / 2.0) + Float64(y * x)) + z) end
function tmp = code(x, y, z) tmp = ((x / 2.0) + (y * x)) + z; end
code[x_, y_, z_] := N[(N[(N[(x / 2.0), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{x}{2} + y \cdot x\right) + z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ (/ x 2.0) (* y x)) z))
double code(double x, double y, double z) {
return ((x / 2.0) + (y * 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 / 2.0d0) + (y * x)) + z
end function
public static double code(double x, double y, double z) {
return ((x / 2.0) + (y * x)) + z;
}
def code(x, y, z): return ((x / 2.0) + (y * x)) + z
function code(x, y, z) return Float64(Float64(Float64(x / 2.0) + Float64(y * x)) + z) end
function tmp = code(x, y, z) tmp = ((x / 2.0) + (y * x)) + z; end
code[x_, y_, z_] := N[(N[(N[(x / 2.0), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{x}{2} + y \cdot x\right) + z
\end{array}
(FPCore (x y z) :precision binary64 (fma x (+ y 0.5) z))
double code(double x, double y, double z) {
return fma(x, (y + 0.5), z);
}
function code(x, y, z) return fma(x, Float64(y + 0.5), z) end
code[x_, y_, z_] := N[(x * N[(y + 0.5), $MachinePrecision] + z), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y + 0.5, z\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
fma-define100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= y -3e+23)
(* x y)
(if (<= y -6e-96)
z
(if (<= y -1.25e-136)
(* x 0.5)
(if (<= y 3.15e-299)
z
(if (<= y 3.2e-282)
(* x 0.5)
(if (<= y 2.95e-235)
z
(if (<= y 2.7e-178)
(* x 0.5)
(if (<= y 4.3e-155)
z
(if (<= y 7.4e-92)
(* x 0.5)
(if (<= y 1.5e+34) z (* x y))))))))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3e+23) {
tmp = x * y;
} else if (y <= -6e-96) {
tmp = z;
} else if (y <= -1.25e-136) {
tmp = x * 0.5;
} else if (y <= 3.15e-299) {
tmp = z;
} else if (y <= 3.2e-282) {
tmp = x * 0.5;
} else if (y <= 2.95e-235) {
tmp = z;
} else if (y <= 2.7e-178) {
tmp = x * 0.5;
} else if (y <= 4.3e-155) {
tmp = z;
} else if (y <= 7.4e-92) {
tmp = x * 0.5;
} else if (y <= 1.5e+34) {
tmp = z;
} else {
tmp = x * 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 <= (-3d+23)) then
tmp = x * y
else if (y <= (-6d-96)) then
tmp = z
else if (y <= (-1.25d-136)) then
tmp = x * 0.5d0
else if (y <= 3.15d-299) then
tmp = z
else if (y <= 3.2d-282) then
tmp = x * 0.5d0
else if (y <= 2.95d-235) then
tmp = z
else if (y <= 2.7d-178) then
tmp = x * 0.5d0
else if (y <= 4.3d-155) then
tmp = z
else if (y <= 7.4d-92) then
tmp = x * 0.5d0
else if (y <= 1.5d+34) then
tmp = z
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3e+23) {
tmp = x * y;
} else if (y <= -6e-96) {
tmp = z;
} else if (y <= -1.25e-136) {
tmp = x * 0.5;
} else if (y <= 3.15e-299) {
tmp = z;
} else if (y <= 3.2e-282) {
tmp = x * 0.5;
} else if (y <= 2.95e-235) {
tmp = z;
} else if (y <= 2.7e-178) {
tmp = x * 0.5;
} else if (y <= 4.3e-155) {
tmp = z;
} else if (y <= 7.4e-92) {
tmp = x * 0.5;
} else if (y <= 1.5e+34) {
tmp = z;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3e+23: tmp = x * y elif y <= -6e-96: tmp = z elif y <= -1.25e-136: tmp = x * 0.5 elif y <= 3.15e-299: tmp = z elif y <= 3.2e-282: tmp = x * 0.5 elif y <= 2.95e-235: tmp = z elif y <= 2.7e-178: tmp = x * 0.5 elif y <= 4.3e-155: tmp = z elif y <= 7.4e-92: tmp = x * 0.5 elif y <= 1.5e+34: tmp = z else: tmp = x * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3e+23) tmp = Float64(x * y); elseif (y <= -6e-96) tmp = z; elseif (y <= -1.25e-136) tmp = Float64(x * 0.5); elseif (y <= 3.15e-299) tmp = z; elseif (y <= 3.2e-282) tmp = Float64(x * 0.5); elseif (y <= 2.95e-235) tmp = z; elseif (y <= 2.7e-178) tmp = Float64(x * 0.5); elseif (y <= 4.3e-155) tmp = z; elseif (y <= 7.4e-92) tmp = Float64(x * 0.5); elseif (y <= 1.5e+34) tmp = z; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3e+23) tmp = x * y; elseif (y <= -6e-96) tmp = z; elseif (y <= -1.25e-136) tmp = x * 0.5; elseif (y <= 3.15e-299) tmp = z; elseif (y <= 3.2e-282) tmp = x * 0.5; elseif (y <= 2.95e-235) tmp = z; elseif (y <= 2.7e-178) tmp = x * 0.5; elseif (y <= 4.3e-155) tmp = z; elseif (y <= 7.4e-92) tmp = x * 0.5; elseif (y <= 1.5e+34) tmp = z; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3e+23], N[(x * y), $MachinePrecision], If[LessEqual[y, -6e-96], z, If[LessEqual[y, -1.25e-136], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 3.15e-299], z, If[LessEqual[y, 3.2e-282], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 2.95e-235], z, If[LessEqual[y, 2.7e-178], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 4.3e-155], z, If[LessEqual[y, 7.4e-92], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 1.5e+34], z, N[(x * y), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+23}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -6 \cdot 10^{-96}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq -1.25 \cdot 10^{-136}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 3.15 \cdot 10^{-299}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-282}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 2.95 \cdot 10^{-235}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-178}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{-155}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{-92}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+34}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -3.0000000000000001e23 or 1.50000000000000009e34 < y Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 89.5%
associate-+r+89.5%
Simplified89.5%
Taylor expanded in y around inf 77.2%
if -3.0000000000000001e23 < y < -6e-96 or -1.25e-136 < y < 3.14999999999999976e-299 or 3.19999999999999983e-282 < y < 2.9500000000000002e-235 or 2.70000000000000009e-178 < y < 4.30000000000000008e-155 or 7.39999999999999954e-92 < y < 1.50000000000000009e34Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 70.9%
if -6e-96 < y < -1.25e-136 or 3.14999999999999976e-299 < y < 3.19999999999999983e-282 or 2.9500000000000002e-235 < y < 2.70000000000000009e-178 or 4.30000000000000008e-155 < y < 7.39999999999999954e-92Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 92.0%
associate-+r+92.0%
Simplified92.0%
Taylor expanded in x around inf 75.5%
Taylor expanded in y around 0 75.5%
Final simplification74.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.4e-73) (not (<= x 9.4e-51))) (* x (+ y 0.5)) z))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.4e-73) || !(x <= 9.4e-51)) {
tmp = x * (y + 0.5);
} else {
tmp = 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 ((x <= (-3.4d-73)) .or. (.not. (x <= 9.4d-51))) then
tmp = x * (y + 0.5d0)
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.4e-73) || !(x <= 9.4e-51)) {
tmp = x * (y + 0.5);
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.4e-73) or not (x <= 9.4e-51): tmp = x * (y + 0.5) else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.4e-73) || !(x <= 9.4e-51)) tmp = Float64(x * Float64(y + 0.5)); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.4e-73) || ~((x <= 9.4e-51))) tmp = x * (y + 0.5); else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.4e-73], N[Not[LessEqual[x, 9.4e-51]], $MachinePrecision]], N[(x * N[(y + 0.5), $MachinePrecision]), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{-73} \lor \neg \left(x \leq 9.4 \cdot 10^{-51}\right):\\
\;\;\;\;x \cdot \left(y + 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -3.40000000000000021e-73 or 9.3999999999999995e-51 < x Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 99.4%
associate-+r+99.4%
Simplified99.4%
Taylor expanded in x around inf 79.8%
if -3.40000000000000021e-73 < x < 9.3999999999999995e-51Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 71.1%
Final simplification76.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.5) (not (<= y 0.00088))) (+ z (* x y)) (+ z (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.5) || !(y <= 0.00088)) {
tmp = z + (x * y);
} else {
tmp = z + (x * 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 ((y <= (-0.5d0)) .or. (.not. (y <= 0.00088d0))) then
tmp = z + (x * y)
else
tmp = z + (x * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.5) || !(y <= 0.00088)) {
tmp = z + (x * y);
} else {
tmp = z + (x * 0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.5) or not (y <= 0.00088): tmp = z + (x * y) else: tmp = z + (x * 0.5) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.5) || !(y <= 0.00088)) tmp = Float64(z + Float64(x * y)); else tmp = Float64(z + Float64(x * 0.5)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.5) || ~((y <= 0.00088))) tmp = z + (x * y); else tmp = z + (x * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.5], N[Not[LessEqual[y, 0.00088]], $MachinePrecision]], N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(z + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.5 \lor \neg \left(y \leq 0.00088\right):\\
\;\;\;\;z + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z + x \cdot 0.5\\
\end{array}
\end{array}
if y < -0.5 or 8.80000000000000031e-4 < y Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.6%
if -0.5 < y < 8.80000000000000031e-4Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.5%
*-commutative99.5%
Simplified99.5%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (<= y -3.9e+23) (* x y) (if (<= y 3.8e+33) (+ z (* x 0.5)) (* x (+ y 0.5)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.9e+23) {
tmp = x * y;
} else if (y <= 3.8e+33) {
tmp = z + (x * 0.5);
} else {
tmp = x * (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 (y <= (-3.9d+23)) then
tmp = x * y
else if (y <= 3.8d+33) then
tmp = z + (x * 0.5d0)
else
tmp = x * (y + 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.9e+23) {
tmp = x * y;
} else if (y <= 3.8e+33) {
tmp = z + (x * 0.5);
} else {
tmp = x * (y + 0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.9e+23: tmp = x * y elif y <= 3.8e+33: tmp = z + (x * 0.5) else: tmp = x * (y + 0.5) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.9e+23) tmp = Float64(x * y); elseif (y <= 3.8e+33) tmp = Float64(z + Float64(x * 0.5)); else tmp = Float64(x * Float64(y + 0.5)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.9e+23) tmp = x * y; elseif (y <= 3.8e+33) tmp = z + (x * 0.5); else tmp = x * (y + 0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.9e+23], N[(x * y), $MachinePrecision], If[LessEqual[y, 3.8e+33], N[(z + N[(x * 0.5), $MachinePrecision]), $MachinePrecision], N[(x * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{+23}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+33}:\\
\;\;\;\;z + x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + 0.5\right)\\
\end{array}
\end{array}
if y < -3.9e23Initial program 99.9%
+-commutative99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-/l*99.9%
*-commutative99.9%
distribute-rgt-out--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 88.8%
associate-+r+88.8%
Simplified88.8%
Taylor expanded in y around inf 78.6%
if -3.9e23 < y < 3.80000000000000002e33Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.8%
*-commutative98.8%
Simplified98.8%
if 3.80000000000000002e33 < y Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 90.3%
associate-+r+90.3%
Simplified90.3%
Taylor expanded in x around inf 75.7%
Final simplification88.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.9e+111) (not (<= x 8.2e+95))) (* x 0.5) z))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.9e+111) || !(x <= 8.2e+95)) {
tmp = x * 0.5;
} else {
tmp = 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 ((x <= (-1.9d+111)) .or. (.not. (x <= 8.2d+95))) then
tmp = x * 0.5d0
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.9e+111) || !(x <= 8.2e+95)) {
tmp = x * 0.5;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.9e+111) or not (x <= 8.2e+95): tmp = x * 0.5 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.9e+111) || !(x <= 8.2e+95)) tmp = Float64(x * 0.5); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.9e+111) || ~((x <= 8.2e+95))) tmp = x * 0.5; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.9e+111], N[Not[LessEqual[x, 8.2e+95]], $MachinePrecision]], N[(x * 0.5), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{+111} \lor \neg \left(x \leq 8.2 \cdot 10^{+95}\right):\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -1.89999999999999988e111 or 8.19999999999999972e95 < x Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
associate-+r+100.0%
Simplified100.0%
Taylor expanded in x around inf 92.0%
Taylor expanded in y around 0 48.3%
if -1.89999999999999988e111 < x < 8.19999999999999972e95Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 55.9%
Final simplification53.3%
(FPCore (x y z) :precision binary64 (+ z (+ (/ x 2.0) (* x y))))
double code(double x, double y, double z) {
return z + ((x / 2.0) + (x * y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + ((x / 2.0d0) + (x * y))
end function
public static double code(double x, double y, double z) {
return z + ((x / 2.0) + (x * y));
}
def code(x, y, z): return z + ((x / 2.0) + (x * y))
function code(x, y, z) return Float64(z + Float64(Float64(x / 2.0) + Float64(x * y))) end
function tmp = code(x, y, z) tmp = z + ((x / 2.0) + (x * y)); end
code[x_, y_, z_] := N[(z + N[(N[(x / 2.0), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z + \left(\frac{x}{2} + x \cdot y\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (+ z (* x (- y -0.5))))
double code(double x, double y, double z) {
return z + (x * (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 = z + (x * (y - (-0.5d0)))
end function
public static double code(double x, double y, double z) {
return z + (x * (y - -0.5));
}
def code(x, y, z): return z + (x * (y - -0.5))
function code(x, y, z) return Float64(z + Float64(x * Float64(y - -0.5))) end
function tmp = code(x, y, z) tmp = z + (x * (y - -0.5)); end
code[x_, y_, z_] := N[(z + N[(x * N[(y - -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z + x \cdot \left(y - -0.5\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 z)
double code(double x, double y, double z) {
return z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z
end function
public static double code(double x, double y, double z) {
return z;
}
def code(x, y, z): return z
function code(x, y, z) return z end
function tmp = code(x, y, z) tmp = z; end
code[x_, y_, z_] := z
\begin{array}{l}
\\
z
\end{array}
Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-frac-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 40.0%
Final simplification40.0%
herbie shell --seed 2024096
(FPCore (x y z)
:name "Data.Histogram.Bin.BinF:$cfromIndex from histogram-fill-0.8.4.1"
:precision binary64
(+ (+ (/ x 2.0) (* y x)) z))