(Freedom from the octal confers a more zero-like zero: 721 == 000721 == 00721 == 0721 == 721.)

Hexadecimal constants prefix '0x' to one or more hex digits (at least one, 0x is an invalid numerical cons).

Binary constants would prefix '0b' to one or more binary digits (at least one, 0b would be invalid, like 0x).

Allowing the empty string as prefix, decimal constants follow the this same pattern.

Decimal constants prefix '' to one or more decimal digits (at least one, '' is an invalid numerical constant).

+1 for binary consts that are part of the solution, eg when writing software to control circuitry.

Julia has hexadecimal integer constants, and does not have hexadecimal float constants.

Where precise, reproducible values are necessary, best practice is to use hex float literals:

"Hexadecimal floating-point constants, also known as hexadecimal floating-point literals,

are an alternative way to represent floating-point numbers in a computer program.

A hexadecimal floating-point constant is shorthand for binary scientific notation,

which is an abstract — yet direct — representation of a binary floating-point number.

As such, hexadecimal floating-point constants have exact representations in binary

floating-point, unlike decimal floating-point constants, which in general do not.

Hexadecimal floating-point constants are useful for two reasons: they bypass

decimal to floating-point conversions, which are sometimes done incorrectly,

and they bypass floating-point to decimal conversions which, even if done

correctly, are often limited to a fixed number of decimal digits. In short,

their advantage is that they allow for direct control of floating-point variables,

letting you read and write their exact contents."

+1 for hex floats as best practice

On Friday, May 18, 2012 12:53:43 AM UTC, John Cowan wrote:

On Thu, May 17, 2012 at 8:14 PM, Stefan Karpinski <ste...@karpinski.org> wrote:

> The leading zero syntax for octal is downright evil.

> Hate it.

Quite apart from the notation, base 8 is a relic of computers that

stopped being made in 1986. There is no excuse for it in a modern

programming language. (I made this case to the Go people before Go

was released, to no avail. Apparently some people just love them

their 3 bits at a time notation.)

Binary is more general, but marginal enough that I'd say don't worry about it.

--

GMail doesn't have rotating .sigs, but you can see mine at

http://www.ccil.org/~cowan/signatures