
(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 -560.0)
(* x y)
(if (<= y -7.8e-214)
(* x 0.5)
(if (<= y -2.4e-255)
z
(if (<= y 6e-212)
(* x 0.5)
(if (or (<= y 1.7e+19) (and (not (<= y 2.5e+221)) (<= y 4.8e+240)))
z
(* x y)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -560.0) {
tmp = x * y;
} else if (y <= -7.8e-214) {
tmp = x * 0.5;
} else if (y <= -2.4e-255) {
tmp = z;
} else if (y <= 6e-212) {
tmp = x * 0.5;
} else if ((y <= 1.7e+19) || (!(y <= 2.5e+221) && (y <= 4.8e+240))) {
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 <= (-560.0d0)) then
tmp = x * y
else if (y <= (-7.8d-214)) then
tmp = x * 0.5d0
else if (y <= (-2.4d-255)) then
tmp = z
else if (y <= 6d-212) then
tmp = x * 0.5d0
else if ((y <= 1.7d+19) .or. (.not. (y <= 2.5d+221)) .and. (y <= 4.8d+240)) 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 <= -560.0) {
tmp = x * y;
} else if (y <= -7.8e-214) {
tmp = x * 0.5;
} else if (y <= -2.4e-255) {
tmp = z;
} else if (y <= 6e-212) {
tmp = x * 0.5;
} else if ((y <= 1.7e+19) || (!(y <= 2.5e+221) && (y <= 4.8e+240))) {
tmp = z;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -560.0: tmp = x * y elif y <= -7.8e-214: tmp = x * 0.5 elif y <= -2.4e-255: tmp = z elif y <= 6e-212: tmp = x * 0.5 elif (y <= 1.7e+19) or (not (y <= 2.5e+221) and (y <= 4.8e+240)): tmp = z else: tmp = x * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -560.0) tmp = Float64(x * y); elseif (y <= -7.8e-214) tmp = Float64(x * 0.5); elseif (y <= -2.4e-255) tmp = z; elseif (y <= 6e-212) tmp = Float64(x * 0.5); elseif ((y <= 1.7e+19) || (!(y <= 2.5e+221) && (y <= 4.8e+240))) tmp = z; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -560.0) tmp = x * y; elseif (y <= -7.8e-214) tmp = x * 0.5; elseif (y <= -2.4e-255) tmp = z; elseif (y <= 6e-212) tmp = x * 0.5; elseif ((y <= 1.7e+19) || (~((y <= 2.5e+221)) && (y <= 4.8e+240))) tmp = z; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -560.0], N[(x * y), $MachinePrecision], If[LessEqual[y, -7.8e-214], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, -2.4e-255], z, If[LessEqual[y, 6e-212], N[(x * 0.5), $MachinePrecision], If[Or[LessEqual[y, 1.7e+19], And[N[Not[LessEqual[y, 2.5e+221]], $MachinePrecision], LessEqual[y, 4.8e+240]]], z, N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -560:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -7.8 \cdot 10^{-214}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq -2.4 \cdot 10^{-255}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-212}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+19} \lor \neg \left(y \leq 2.5 \cdot 10^{+221}\right) \land y \leq 4.8 \cdot 10^{+240}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -560 or 1.7e19 < y < 2.5000000000000001e221 or 4.7999999999999998e240 < 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.9%
+-commutative90.9%
+-commutative90.9%
associate-+l+90.9%
+-commutative90.9%
Simplified90.9%
Taylor expanded in y around inf 82.1%
if -560 < y < -7.80000000000000076e-214 or -2.3999999999999998e-255 < y < 6.0000000000000005e-212Initial 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.0%
+-commutative90.0%
+-commutative90.0%
associate-+l+90.0%
+-commutative90.0%
Simplified90.0%
Taylor expanded in x around inf 60.5%
Taylor expanded in y around 0 58.2%
*-commutative58.2%
Simplified58.2%
if -7.80000000000000076e-214 < y < -2.3999999999999998e-255 or 6.0000000000000005e-212 < y < 1.7e19 or 2.5000000000000001e221 < y < 4.7999999999999998e240Initial 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--99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 64.8%
Final simplification70.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ y 0.5))))
(if (<= y -2.95e-7)
t_0
(if (<= y 6.5)
(+ z (* x 0.5))
(if (<= y 2.5e+221) t_0 (if (<= y 4.8e+240) z (* x y)))))))
double code(double x, double y, double z) {
double t_0 = x * (y + 0.5);
double tmp;
if (y <= -2.95e-7) {
tmp = t_0;
} else if (y <= 6.5) {
tmp = z + (x * 0.5);
} else if (y <= 2.5e+221) {
tmp = t_0;
} else if (y <= 4.8e+240) {
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) :: t_0
real(8) :: tmp
t_0 = x * (y + 0.5d0)
if (y <= (-2.95d-7)) then
tmp = t_0
else if (y <= 6.5d0) then
tmp = z + (x * 0.5d0)
else if (y <= 2.5d+221) then
tmp = t_0
else if (y <= 4.8d+240) then
tmp = z
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (y + 0.5);
double tmp;
if (y <= -2.95e-7) {
tmp = t_0;
} else if (y <= 6.5) {
tmp = z + (x * 0.5);
} else if (y <= 2.5e+221) {
tmp = t_0;
} else if (y <= 4.8e+240) {
tmp = z;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z): t_0 = x * (y + 0.5) tmp = 0 if y <= -2.95e-7: tmp = t_0 elif y <= 6.5: tmp = z + (x * 0.5) elif y <= 2.5e+221: tmp = t_0 elif y <= 4.8e+240: tmp = z else: tmp = x * y return tmp
function code(x, y, z) t_0 = Float64(x * Float64(y + 0.5)) tmp = 0.0 if (y <= -2.95e-7) tmp = t_0; elseif (y <= 6.5) tmp = Float64(z + Float64(x * 0.5)); elseif (y <= 2.5e+221) tmp = t_0; elseif (y <= 4.8e+240) tmp = z; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (y + 0.5); tmp = 0.0; if (y <= -2.95e-7) tmp = t_0; elseif (y <= 6.5) tmp = z + (x * 0.5); elseif (y <= 2.5e+221) tmp = t_0; elseif (y <= 4.8e+240) tmp = z; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.95e-7], t$95$0, If[LessEqual[y, 6.5], N[(z + N[(x * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+221], t$95$0, If[LessEqual[y, 4.8e+240], z, N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(y + 0.5\right)\\
\mathbf{if}\;y \leq -2.95 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6.5:\\
\;\;\;\;z + x \cdot 0.5\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+221}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+240}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -2.94999999999999981e-7 or 6.5 < y < 2.5000000000000001e221Initial 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 91.0%
+-commutative91.0%
+-commutative91.0%
associate-+l+91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in x around inf 80.8%
if -2.94999999999999981e-7 < y < 6.5Initial 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.7%
*-commutative99.7%
Simplified99.7%
if 2.5000000000000001e221 < y < 4.7999999999999998e240Initial 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 94.9%
if 4.7999999999999998e240 < y Initial 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.2%
+-commutative88.2%
+-commutative88.2%
associate-+l+88.2%
+-commutative88.2%
Simplified88.2%
Taylor expanded in y around inf 86.4%
Final simplification91.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.9e-109) (not (<= x 1.3e-41))) (* x (+ y 0.5)) z))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.9e-109) || !(x <= 1.3e-41)) {
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 <= (-1.9d-109)) .or. (.not. (x <= 1.3d-41))) 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 <= -1.9e-109) || !(x <= 1.3e-41)) {
tmp = x * (y + 0.5);
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.9e-109) or not (x <= 1.3e-41): tmp = x * (y + 0.5) else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.9e-109) || !(x <= 1.3e-41)) 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 <= -1.9e-109) || ~((x <= 1.3e-41))) tmp = x * (y + 0.5); else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.9e-109], N[Not[LessEqual[x, 1.3e-41]], $MachinePrecision]], N[(x * N[(y + 0.5), $MachinePrecision]), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-109} \lor \neg \left(x \leq 1.3 \cdot 10^{-41}\right):\\
\;\;\;\;x \cdot \left(y + 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -1.90000000000000001e-109 or 1.3e-41 < 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 98.9%
+-commutative98.9%
+-commutative98.9%
associate-+l+98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 81.4%
if -1.90000000000000001e-109 < x < 1.3e-41Initial 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 73.5%
Final simplification78.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -3500000.0) (not (<= y 6e-9))) (+ z (* x y)) (+ z (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3500000.0) || !(y <= 6e-9)) {
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 <= (-3500000.0d0)) .or. (.not. (y <= 6d-9))) 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 <= -3500000.0) || !(y <= 6e-9)) {
tmp = z + (x * y);
} else {
tmp = z + (x * 0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3500000.0) or not (y <= 6e-9): tmp = z + (x * y) else: tmp = z + (x * 0.5) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3500000.0) || !(y <= 6e-9)) 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 <= -3500000.0) || ~((y <= 6e-9))) tmp = z + (x * y); else tmp = z + (x * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3500000.0], N[Not[LessEqual[y, 6e-9]], $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 -3500000 \lor \neg \left(y \leq 6 \cdot 10^{-9}\right):\\
\;\;\;\;z + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z + x \cdot 0.5\\
\end{array}
\end{array}
if y < -3.5e6 or 5.99999999999999996e-9 < 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.0%
if -3.5e6 < y < 5.99999999999999996e-9Initial 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.2%
*-commutative98.2%
Simplified98.2%
Final simplification98.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.5e+28) (not (<= x 6.5e+58))) (* x 0.5) z))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.5e+28) || !(x <= 6.5e+58)) {
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 <= (-4.5d+28)) .or. (.not. (x <= 6.5d+58))) 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 <= -4.5e+28) || !(x <= 6.5e+58)) {
tmp = x * 0.5;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.5e+28) or not (x <= 6.5e+58): tmp = x * 0.5 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.5e+28) || !(x <= 6.5e+58)) tmp = Float64(x * 0.5); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.5e+28) || ~((x <= 6.5e+58))) tmp = x * 0.5; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.5e+28], N[Not[LessEqual[x, 6.5e+58]], $MachinePrecision]], N[(x * 0.5), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{+28} \lor \neg \left(x \leq 6.5 \cdot 10^{+58}\right):\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -4.4999999999999997e28 or 6.49999999999999998e58 < 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.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 87.4%
Taylor expanded in y around 0 44.3%
*-commutative44.3%
Simplified44.3%
if -4.4999999999999997e28 < x < 6.49999999999999998e58Initial 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 57.8%
Final simplification51.3%
(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 36.8%
Final simplification36.8%
herbie shell --seed 2024059
(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))