
(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 8 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 (+ (+ (/ x 2.0) (* x y)) z))
double code(double x, double y, double z) {
return ((x / 2.0) + (x * 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 / 2.0d0) + (x * y)) + z
end function
public static double code(double x, double y, double z) {
return ((x / 2.0) + (x * y)) + z;
}
def code(x, y, z): return ((x / 2.0) + (x * y)) + z
function code(x, y, z) return Float64(Float64(Float64(x / 2.0) + Float64(x * y)) + z) end
function tmp = code(x, y, z) tmp = ((x / 2.0) + (x * y)) + z; end
code[x_, y_, z_] := N[(N[(N[(x / 2.0), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{x}{2} + x \cdot y\right) + z
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= y -0.32)
(* x y)
(if (<= y -1.15e-252)
(* x 0.5)
(if (<= y -1.5e-293)
z
(if (<= y 2.65e-264) (* x 0.5) (if (<= y 440000000000.0) z (* x y)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -0.32) {
tmp = x * y;
} else if (y <= -1.15e-252) {
tmp = x * 0.5;
} else if (y <= -1.5e-293) {
tmp = z;
} else if (y <= 2.65e-264) {
tmp = x * 0.5;
} else if (y <= 440000000000.0) {
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 <= (-0.32d0)) then
tmp = x * y
else if (y <= (-1.15d-252)) then
tmp = x * 0.5d0
else if (y <= (-1.5d-293)) then
tmp = z
else if (y <= 2.65d-264) then
tmp = x * 0.5d0
else if (y <= 440000000000.0d0) 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 <= -0.32) {
tmp = x * y;
} else if (y <= -1.15e-252) {
tmp = x * 0.5;
} else if (y <= -1.5e-293) {
tmp = z;
} else if (y <= 2.65e-264) {
tmp = x * 0.5;
} else if (y <= 440000000000.0) {
tmp = z;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -0.32: tmp = x * y elif y <= -1.15e-252: tmp = x * 0.5 elif y <= -1.5e-293: tmp = z elif y <= 2.65e-264: tmp = x * 0.5 elif y <= 440000000000.0: tmp = z else: tmp = x * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -0.32) tmp = Float64(x * y); elseif (y <= -1.15e-252) tmp = Float64(x * 0.5); elseif (y <= -1.5e-293) tmp = z; elseif (y <= 2.65e-264) tmp = Float64(x * 0.5); elseif (y <= 440000000000.0) tmp = z; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -0.32) tmp = x * y; elseif (y <= -1.15e-252) tmp = x * 0.5; elseif (y <= -1.5e-293) tmp = z; elseif (y <= 2.65e-264) tmp = x * 0.5; elseif (y <= 440000000000.0) tmp = z; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -0.32], N[(x * y), $MachinePrecision], If[LessEqual[y, -1.15e-252], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, -1.5e-293], z, If[LessEqual[y, 2.65e-264], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 440000000000.0], z, N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.32:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -1.15 \cdot 10^{-252}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq -1.5 \cdot 10^{-293}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{-264}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 440000000000:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -0.320000000000000007 or 4.4e11 < y Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.0%
mul-1-neg99.0%
distribute-rgt-neg-out99.0%
Simplified99.0%
Taylor expanded in y around inf 98.9%
Taylor expanded in z around 0 75.3%
if -0.320000000000000007 < y < -1.1499999999999999e-252 or -1.5000000000000001e-293 < y < 2.6499999999999999e-264Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 66.6%
+-commutative66.6%
Simplified66.6%
Taylor expanded in y around 0 65.5%
*-commutative65.5%
Simplified65.5%
if -1.1499999999999999e-252 < y < -1.5000000000000001e-293 or 2.6499999999999999e-264 < y < 4.4e11Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 64.4%
mul-1-neg64.4%
distribute-rgt-neg-out64.4%
Simplified64.4%
Taylor expanded in y around inf 45.1%
Taylor expanded in y around 0 63.4%
Final simplification69.5%
(FPCore (x y z)
:precision binary64
(if (or (<= x -5.1e+41)
(not (or (<= x -5.6e-8) (and (not (<= x -9.8e-116)) (<= x 1.1e-98)))))
(* x (+ y 0.5))
z))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.1e+41) || !((x <= -5.6e-8) || (!(x <= -9.8e-116) && (x <= 1.1e-98)))) {
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 <= (-5.1d+41)) .or. (.not. (x <= (-5.6d-8)) .or. (.not. (x <= (-9.8d-116))) .and. (x <= 1.1d-98))) 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 <= -5.1e+41) || !((x <= -5.6e-8) || (!(x <= -9.8e-116) && (x <= 1.1e-98)))) {
tmp = x * (y + 0.5);
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.1e+41) or not ((x <= -5.6e-8) or (not (x <= -9.8e-116) and (x <= 1.1e-98))): tmp = x * (y + 0.5) else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.1e+41) || !((x <= -5.6e-8) || (!(x <= -9.8e-116) && (x <= 1.1e-98)))) 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 <= -5.1e+41) || ~(((x <= -5.6e-8) || (~((x <= -9.8e-116)) && (x <= 1.1e-98))))) tmp = x * (y + 0.5); else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.1e+41], N[Not[Or[LessEqual[x, -5.6e-8], And[N[Not[LessEqual[x, -9.8e-116]], $MachinePrecision], LessEqual[x, 1.1e-98]]]], $MachinePrecision]], N[(x * N[(y + 0.5), $MachinePrecision]), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.1 \cdot 10^{+41} \lor \neg \left(x \leq -5.6 \cdot 10^{-8} \lor \neg \left(x \leq -9.8 \cdot 10^{-116}\right) \land x \leq 1.1 \cdot 10^{-98}\right):\\
\;\;\;\;x \cdot \left(y + 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -5.09999999999999978e41 or -5.5999999999999999e-8 < x < -9.79999999999999955e-116 or 1.09999999999999998e-98 < x Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 85.2%
+-commutative85.2%
Simplified85.2%
if -5.09999999999999978e41 < x < -5.5999999999999999e-8 or -9.79999999999999955e-116 < x < 1.09999999999999998e-98Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 95.5%
mul-1-neg95.5%
distribute-rgt-neg-out95.5%
Simplified95.5%
Taylor expanded in y around inf 83.1%
Taylor expanded in y around 0 78.9%
Final simplification82.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -8.8e-27) (not (<= z 4.3e-48))) (+ (* x y) z) (* x (+ y 0.5))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.8e-27) || !(z <= 4.3e-48)) {
tmp = (x * y) + z;
} 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 ((z <= (-8.8d-27)) .or. (.not. (z <= 4.3d-48))) then
tmp = (x * y) + z
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 ((z <= -8.8e-27) || !(z <= 4.3e-48)) {
tmp = (x * y) + z;
} else {
tmp = x * (y + 0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8.8e-27) or not (z <= 4.3e-48): tmp = (x * y) + z else: tmp = x * (y + 0.5) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8.8e-27) || !(z <= 4.3e-48)) tmp = Float64(Float64(x * y) + z); else tmp = Float64(x * Float64(y + 0.5)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -8.8e-27) || ~((z <= 4.3e-48))) tmp = (x * y) + z; else tmp = x * (y + 0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8.8e-27], N[Not[LessEqual[z, 4.3e-48]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision], N[(x * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{-27} \lor \neg \left(z \leq 4.3 \cdot 10^{-48}\right):\\
\;\;\;\;x \cdot y + z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + 0.5\right)\\
\end{array}
\end{array}
if z < -8.79999999999999948e-27 or 4.3e-48 < z Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 89.0%
mul-1-neg89.0%
distribute-rgt-neg-out89.0%
Simplified89.0%
*-commutative89.0%
cancel-sign-sub89.0%
*-commutative89.0%
+-commutative89.0%
*-commutative89.0%
Applied egg-rr89.0%
if -8.79999999999999948e-27 < z < 4.3e-48Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 88.7%
+-commutative88.7%
Simplified88.7%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.5) (not (<= y 0.5))) (+ (* x y) z) (- z (* x -0.5))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.5) || !(y <= 0.5)) {
tmp = (x * y) + z;
} 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.5d0))) then
tmp = (x * y) + z
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.5)) {
tmp = (x * y) + z;
} else {
tmp = z - (x * -0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.5) or not (y <= 0.5): tmp = (x * y) + z else: tmp = z - (x * -0.5) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.5) || !(y <= 0.5)) tmp = Float64(Float64(x * y) + z); 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.5))) tmp = (x * y) + z; 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.5]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + z), $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.5\right):\\
\;\;\;\;x \cdot y + z\\
\mathbf{else}:\\
\;\;\;\;z - x \cdot -0.5\\
\end{array}
\end{array}
if y < -0.5 or 0.5 < y Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.1%
mul-1-neg99.1%
distribute-rgt-neg-out99.1%
Simplified99.1%
*-commutative99.1%
cancel-sign-sub99.1%
*-commutative99.1%
+-commutative99.1%
*-commutative99.1%
Applied egg-rr99.1%
if -0.5 < y < 0.5Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.0%
*-commutative98.0%
Simplified98.0%
Final simplification98.5%
(FPCore (x y z) :precision binary64 (if (<= z -9.8e-27) z (if (<= z 6.5e-45) (* x 0.5) z)))
double code(double x, double y, double z) {
double tmp;
if (z <= -9.8e-27) {
tmp = z;
} else if (z <= 6.5e-45) {
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 (z <= (-9.8d-27)) then
tmp = z
else if (z <= 6.5d-45) 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 (z <= -9.8e-27) {
tmp = z;
} else if (z <= 6.5e-45) {
tmp = x * 0.5;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9.8e-27: tmp = z elif z <= 6.5e-45: tmp = x * 0.5 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9.8e-27) tmp = z; elseif (z <= 6.5e-45) tmp = Float64(x * 0.5); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9.8e-27) tmp = z; elseif (z <= 6.5e-45) tmp = x * 0.5; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9.8e-27], z, If[LessEqual[z, 6.5e-45], N[(x * 0.5), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.8 \cdot 10^{-27}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-45}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -9.79999999999999952e-27 or 6.4999999999999995e-45 < z Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 89.0%
mul-1-neg89.0%
distribute-rgt-neg-out89.0%
Simplified89.0%
Taylor expanded in y around inf 73.3%
Taylor expanded in y around 0 61.0%
if -9.79999999999999952e-27 < z < 6.4999999999999995e-45Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
distribute-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 88.7%
+-commutative88.7%
Simplified88.7%
Taylor expanded in y around 0 46.2%
*-commutative46.2%
Simplified46.2%
Final simplification54.1%
(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-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-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-neg-in100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
unsub-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-lft-out--100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 73.2%
mul-1-neg73.2%
distribute-rgt-neg-out73.2%
Simplified73.2%
Taylor expanded in y around inf 64.8%
Taylor expanded in y around 0 38.7%
Final simplification38.7%
herbie shell --seed 2024115
(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))