Julia numeric separator
Julia's encoding shows that using underscore as an integer separator works in Julia.
x = 1_000_000
and
x = 1000000
are basically the same thing.
However, I cannot find any documentation for this to read more details. Can anyone point me to this.
Also, is the digit separator a common thing in different languages? What is the delimiter character in C ++, java and Python?
source to share
The proposal document for the C ++ 14 document contains a very lengthy discussion of the rationale and possible choices for the digit separator. Considered `
, '
, _
, ::
and
(blank). Some discussions include other languages. According to the document, _
it is also used in Ada, VHDL, Verilog, and possibly in Algol68. Underscores are also apparently used in Java 7 ( fooobar.com/questions/73015 / ... , suggestion ). C ++ set '
as their separator.
Julia has not officially documented underscore delimited numeric literals, but you can find some information in this GitHub issue (# 848) and this julia-dev thread .
It doesn't look like Python has a numeric literal separator.
source to share