Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

53
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!