Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
10000000010 = 1026,
1026-1023 = 3,
2^3 = 8,
8 != 15
Use spoiler flag next time please.
This comment is hidden because it contains spoiler information about the solution
thanks for the reply I was really confused at fist :D
Because by using
Number.toString(2)
, you're converting the number to base 2, which is not what the kata is asking.What
Number.toString(base)
does is converting a decimal number to another base.Let's take for example
-11.625
. When callingtoString(2)
on it, you will get-1011.101
. This is because11.625
is2³ + 2¹ + 2⁰ + 2⁻¹ + 2⁻³
But JavaScript doesnt use this representation to store
-11.625
, or any otherNumber
. It represents it as a group of 64 bits following the IEEE 754 double-precision format.Before calling the
toString(2)
method, you have to find a way to read aNumber
as if it was a 64-bits integer.Hope I helped :)
Why is the binary of 15 = 10000000010 . When W convert it it's 00001111 . Is there a formula for this or am I converting numbers in the wrong way ? ( number.toString(2) )
really impressive
This comment is hidden because it contains spoiler information about the solution
i did the exact same thing
wait, what?