octal

floating point hex octal binary

Hi, I am working on a calculator that allows you to perform calculations past the decimal point in octal, hexadecimal, binary, and of course decimal. I am having trouble though finding a way to convert floating point decimal numbers to floating point hexadecimal, octal, binary and vice versa. The plan is to do all the math in decimal a...

Python: Invalid Token

Some of you may recognize this as Project Euler's problem number 11. The one with the grid. I'm trying to replicate the grid in a large multidimensional array, But it's giving me a syntax error and i'm not sure why grid = [ [ 08, 02, 22, 97, 38, 15, 00, 40, 00, 75, 04, 05, 07, 78, 52, 12, 50, 77, 91, 08 ], [ 49, 49, 99, 40, 17, 81, 18...

AJAX Asp.net AutoCompleteExtender interpreting string 0010 as octal

I'm using the MS AJAX AutoCompleteExtender on a textbox. It's working fine, except when the web service returns strings like "0010" -- in which case, it displays "8". I eventually realised it was interpreting the string "0010" as an octal number (and then proved the point by adding strings like "0100" and "0x10".) How can I prevent thi...

What is the difference between a 'character' and an 'octet'?

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 between the two. If anyone could enlighten me to what it is, I'd appreciate it. (and please,...

Workarounds for JavaScript parseInt octal bug

Try executing the following in JavaScript: parseInt('01'); //equals 1 parseInt('02'); //equals 2 parseInt('03'); //equals 3 parseInt('04'); //equals 4 parseInt('05'); //equals 5 parseInt('06'); //equals 6 parseInt('07'); //equals 7 parseInt('08'); //equals 0 !! parseInt('09'); //equals 0 !! JavaScript, I just learned (the hard way), t...

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 is out of range ". But when i pass the fourth parameter as "9" instead of "09", it work...

strange behaviour on php

Can some one please tell me why I get odd results rurning the following code? <?php class Bank { var $ID; var $balance; var $name; function bank($name,$id,$balance=0) { $this->ID=$id; $this->balance=$balance; $this->name=$name; } function getBalance() { return $this->balance; } ...

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 expected: public static void main(String[] args) { int i = 0200; int hundNum = i /...

Octal to sign in string from array

Hi I want to convert octal sign like \46 to normal sign like &. The problem is that the input is created with preg_match_all(), put into an array and then retrieved. If I'd manually input the \46 octal notation into variable with double quotes, like $input="\046"; then PHP would convert it nicely. But when I have it into an array fr...

Where did the octal/hex notations come from?

After all of this time, I've never thought to ask this question; I understand this came from c++, but what was the reasoning behind it: Specify decimal numbers as you normally would Specify octal numbers by a leading 0 Specify hexadecimal numbers by a leading 0x Why 0? Why 0x? Is there a natural progression for base-32? ...

Invalid Token when using Octal numbers.

Hi, I'm a beginner in python and I'm trying to use a octal number in my script, but when I try it, it returns me that error: >>> a = 010 SyntaxError: invalid token (<pyshell#0>, line 1) >>> 01 SyntaxError: invalid token (<pyshell#1>, line 1) There's something wrong with my code? I'm using Python3 (and reading a python 2.2 book) ...

How does Casting work in PHP?

What doesn't this work: (int)08 == (int)09==0 But this and this does? (int)07==7 (int)06==6 ...

MS Calculator on windows 7. I need to know how it does its operations.

MS calculator on windows 7 has a "programmers" mode. When I type in (in binary): 1111111111111111111111111111111111111111111111111111111111111111 and then click "Dec", the binary turns into -1. When I click Oct, the value turns into 1777777777777777777777 However, whenever I use an online converter, it doesn't work. I need to know ho...

Handling numbers with leading zeros in Tcl

I am having trouble in Tcl using numbers with leading zeros. I am parsing some numbers that can have leading zeros, such as "0012", which should be interpreted as the integer "twelve". $ tclsh % set a 8 8 % set b 08 08 % expr $a - 1 7 % expr $b - 1 expected integer but got "08" (looks like invalid octal number) What is the best way ...

how do I print a binary double array from commandline (unix)

I got binary file, that contains doubles. How do i print that out to a terminal. I've tried octaldump 'od' but cant figure out the syntax I've tried something like head -c80 |od -f But that doesnt work, the man page for od is extremely bad. I've made a c program that does what I want, something like assuming 10double chunks. double...

Leading and Trailing '0' gives error

random.randint(50,9) or random.randint(5,09) give errors, although just random.randint(5,9) ..works! Leading and trailing zero's aren't allowed in python without converting it to string or using x.f formatting? ...

Can I customize syntax highlighting in Eclipse to show octal literals differently?

I think octal literals are Very Dangerous Things, and I'd like them to be glaringly obvious whenever I read source codes. There must be a way to do this in Eclipse, right? So it looks like standard Eclipse cannot be configured to do this? A custom colorer is required? ...

Working with PHP Octals and String conversions

I'm working with a database that has a bunch of serial numbers that are prefixed with leading 0's. So a serial number can look like 00032432 or 56332432. Problem is with PHP I don't understand how the conversion system with octals works. A specific example is that I'm trying to convert and compare all of these integer based numbers...

Python2.6 Decimal to Octal

How can i convert decimal to Octal in Python2.6, for 1 to 100000? I wanna get this converted result as .txt too. Can someone help me? ...

In what situations is octal base used?

I've seen binary and hex used quite often but never octal. Yet octal has it's own convention for being used in some languages (ie, a leading 0 indicating octal base). When is octal used? What are some typical situations when one would use octal or octal would be easier to reason about? Or is it merely a matter of taste? ...