octal

PHP: Why the 'abs' function returns a wrong number if it begins with zero?

The code "abs(070000)" returns 28672, but the code "abs(70000)" returns 70000. Did the zero at the beginning means that the number is interpreted as hex? Thank you! ...

what is the reason for the difference between setprecision (12) and setprecision (012) for example,in c++?

In c++ when you write setprecision (12) for example, 12 is in the base of 10 but when you write it like setprecision (012) it is an octal number,why? ...

C++ question on file formats and od

I have the following simple code: ofstream output("test"); output << 'a'; When I do an octal dump of the file, I get this: 0000000 000141 0000001 I can see that 000141 (in base 8) is 8 bits wide and 0000001 is probably EOF. What is the first byte of all 0's and why is it there? I know it is null is ascii but what is its purpose? ...

converting hexadecimal , octal numbers into decimal form using python script

There are many inbulit functions like int(octal) which can be used to convert octal numbers into decimal numbers on command line but these doesn't work out in script . int(0671) returns 0671 in script, where as it represent decimal form of octal number on python command line. Help??? Thank You ...

How to convert string "0671" or "0x45" into integer form with 0 and 0x in the beginning.

I wanted to make my own encryption algorithm and decryption algorithm , encryption algorithm works fine and converts ascii value of the characters into alternate hexadecimal and octal representations. But when I tried decryption, problem occured as it return int('0671') = 671, as 0671 is string type in the following code. Is there a meth...

How do I convert an octal number to decimal in Ruby?

I am trying to find a clean way of referencing an array's index using octal numbering. If I am looking for the array index that is octal 13 it should return the value for a[11]. This is what I have come up with to accomplish it, but it doesn't seem very elegant or efficient: a = [ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62 ] ...

How to print hex value of 255 in Unix ?

Hi, can you please tell me How to use printf to find out the hex and octal values of 255? Thanks a lot. ...