Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -0,0 +1,11 @@
|
|||
function vdc(n) {
|
||||
const bits = [...n.toString(2)].toReversed();
|
||||
const exps = [...Array(bits.length).keys()].map(x => -x);
|
||||
let res = 0;
|
||||
for (let i = 0; i < bits.length; i++) {
|
||||
res += bits[i] * 2 ** (exps[i] - 1);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
console.log([...Array(10).keys()].map(vdc).join(" "));
|
||||
Loading…
Add table
Add a link
Reference in a new issue