Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

55
Vistas
Spooky bit operation with five

When typing these three statements in a JavaScript-Console (for example node.js)

console.log(5 & 0x5555555555555);
console.log(5 & 0x55555555555555);
console.log(5 & 0x555555555555555);

...then I get the following answers:

> console.log(5 & 0x5555555555555);
5
undefined
> console.log(5 & 0x55555555555555);
4
undefined
> console.log(5 & 0x555555555555555);
0
undefined

This seems to be very spooky: The first hexadecimal value has 13 5-digits, the last has 15 5-digits. Every three outputs should be "5" but the second and third are wrong.

Of course I want to make bit-manipulation with 64bit values (which can have up to 16 hexadecimal digits). Can anyone tell me, what my mistake is in this situation?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda