mercredi 25 mars 2015

Difficulty converting from binary to hexadecimal using bc


I read how to calculate using the command line calculator and a HERE-document, but nevertheless I do not get what I expected and can not find my error, what I did in the shell was:



bc << HERE
>ibase=2
>obase=16
>1001
>HERE
100


I expected to get 9 as result since binary 1001 is hexadecimal 9, but I got 100.



Aucun commentaire:

Enregistrer un commentaire