Questions tagged [octal]

The octal numeral system, or oct for short, is the base-8 numeral system, using the digits 0 to 7. Often used to notate Unix permissions. It has also used to store the on/off state of digital seven-segment displays.

The octal numeral system, or oct for short, is the base-8 numeral system, using the digits 0 to 7.

More on the use of octal in computing.

Related tags

419 questions
13
votes
9 answers

how to set value of octal in java?

I am trying to write following code.but it gives me error kindly help me. int six=06; int seven=07; int abc=018; int nine=011; System.out.println("Octal 011 ="+nine); System.out.println("octal O18 =" + abc); why i cant give…
Kapil
  • 320
  • 6
  • 10
  • 23
12
votes
5 answers

int variable with leading zero?

Why is it that following results in 34? It doesn't seem to have anything to do with octal numbers. intval(042);
RoboTamer
  • 3,474
  • 2
  • 39
  • 43
12
votes
3 answers

Git/GitKraken – File Mode changes to unknown value (14001) after restoring repo from backup

Still new to Git(Kraken). Had a logic board go bad on me, and had to restore a repo from a backup, reinstall software, and get back up and running on a temporary machine till I can get the original back from the shop. Now I have the repo open in…
Halfacre
  • 565
  • 8
  • 26
12
votes
1 answer

octal expansion difference between [ and [[?

As far as I had known, [[ and [ can be expected to behave mostly the same, taking into account a few extra features [[ has. But recently I noticed a discrepancy in how bash treats octal expansions: $ b=010; echo $((b)) 8 $ [[ $b -eq 8 ]]; echo…
kojiro
  • 74,557
  • 19
  • 143
  • 201
11
votes
3 answers

Why do PHP and JavaScript have problems dealing with octal and hexadecimal numbers?

I have noticed that PHP and JavaScript treat octal and hexadecimal numbers with some difficulty while type juggling and casting: PHP: echo 16 == '0x10' ? 'true' : 'false'; //true, as expected echo 8 == '010' ? 'true' : 'false'; //false, o_O echo…
mingos
  • 23,778
  • 12
  • 70
  • 107
11
votes
4 answers

How to use Python to convert an octal to a decimal

I had this little homework assignment and I needed to convert decimal to octal and then octal to decimal. I did the first part and could not figure out the second to save my life. The first part went like this: decimal = int(input("Enter a decimal…
Austin Wildgrube
  • 113
  • 1
  • 3
  • 6
11
votes
2 answers

display an octal value as its string representation

I've got a problem when converting an octal number to a string. p = 01212 k = str(p) print k The result is 650 but I need 01212. How can I do this? Thanks in advance.
maphongba008
  • 2,114
  • 4
  • 20
  • 33
11
votes
2 answers

how to avoid python numeric literals beginning with "0" being treated as octal?

I am trying to write a small Python 2.x API to support fetching a job by jobNumber, where jobNumber is provided as an integer. Sometimes the users provide ajobNumber as an integer literal beginning with 0, e.g. 037537. (This is because they have…
David Alexander
  • 358
  • 1
  • 12
10
votes
5 answers

09 is not recognized where as 9 is recognized

I am using quartz for schedulling. TriggerUtils.getDateOf(0,40,18,09,06); it accept 5 parameter. (seconds, minutes, hours, daysOfMonth, month). When i pass fourth parameter as "09". Eclipse give me error "The literal Octal 09 (digit 9) of type int…
Shashi
  • 12,487
  • 17
  • 65
  • 111
10
votes
2 answers

How to work with leading zeros in integers

What is the proper way to deal with leading zeros in Ruby? 0112.to_s => "74" 0112.to_i => 74 Why is it converting 0112 into 74? How can convert 0112 to a string "0112" ? I want to define a method that takes integer as a argument and returns it…
Joel
  • 4,503
  • 1
  • 27
  • 41
10
votes
3 answers

Java int division confusing me

I am doing very simple int division and I am getting odd results. This code prints 2 as expected: public static void main(String[] args) { int i = 200; int hundNum = i / 100; System.out.println(hundNum); } This code prints 1 as not…
jjnguy
  • 136,852
  • 53
  • 295
  • 323
9
votes
4 answers

Why do Java octal escapes only go up to 255?

The Java language specification states that the escapes inside strings are the "normal" C ones like \n and \t, but they also specify octal escapes from \0 to \377. Specifically, the JLS states: OctalEscape: \ OctalDigit \ OctalDigit…
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
9
votes
3 answers

What is an Illegal octal digit?

I'm trying to make an array of zip codes. array = [07001, 07920] This returns : array = [07001, 07920] ^ from (irb):12 from :0 Never seen this before. Any workarounds?
Trip
  • 26,756
  • 46
  • 158
  • 277
8
votes
3 answers

Converting octal and hexadecimal numbers to base 10

I am trying to understand javascript octal and hexadecimal computations. I know I can use parseInt(string, radix) to get the Integer value. For example, when I try this why are the values different? var octal = parseInt('026', 8); var octal1 =…
theking963
  • 2,223
  • 7
  • 28
  • 42
8
votes
3 answers

Difference between 'character' and 'octet' in hashing

I see the term 'octet' popping up in literature about nonces for hashing, and it seems to be synonymous with 'character', although there is a kind of pattern to how the words are used. This leads me to believe that there is a formal distinction…
Jens Roland
  • 27,450
  • 14
  • 82
  • 104
1
2
3
27 28