BIN2DEC.php 783 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. return [
  3. ['178', '10110010'],
  4. ['100', '1100100'],
  5. ['#NUM!', '111001010101'], // Too large
  6. ['5', '101'],
  7. ['2', '10'],
  8. ['0', '0'],
  9. ['5', 101],
  10. ['100', 1100100],
  11. ['#NUM!', '21'], // Invalid binary number
  12. ['#VALUE!', 'true'], // Boolean okay for ODS, not for Excel/Gnumeric
  13. ['#VALUE!', 'false'], // Boolean okay for ODS, not for Excel/Gnumeric
  14. ['-107', '1110010101'], // 2's Complement
  15. ['-1', '1111111111'], // 2's Complement
  16. ['-512', '1000000000'], // lowest negative
  17. ['511', '111111111'], // highest positive
  18. ['0', '0000000000'],
  19. ['1', '000000001'],
  20. ['256', '0100000000'],
  21. ['256', '100000000'],
  22. ['-256', '1100000000'],
  23. [5, 'A2'],
  24. ['#NUM!', '"A2"'],
  25. [0, 'A3'],
  26. ['exception', ''],
  27. ];