Literals/Integer: Difference between revisions

Content deleted Content added
added PowerShell
Rdm (talk | contribs)
J
Line 256:
True
</lang>
 
=={{header|J}}==
 
J's numeric [http://www.jsoftware.com/help/dictionary/dcons.htm mini-language] allows spaces, underlines, dots and lower case alphabetic characters in its numeric literals.
 
Arbitrary base numbers begin with a base ten literal (which represents the base of this number), and then the letter 'b' and then an arbitrary sequence of digits and letters which represents the number in that base. Letters a..z represent digits in the range 10..35.
 
10b123 16b123 8b123 20b123 2b123 1b123 0b123 100b123
123 291 83 443 11 6 3 10203
 
This may be used to enter hexadecimal or octal or binary numbers. However, also that J's primitives support a variety of binary operations on numbers represented as sequences of 0s and 1s, like this:
 
0 1 0 0 0 1 0 0 0 1 1 1 1
 
 
J also supports extended precision integers, if one member of a list ends with an 'x' when they are parsed. Extended precision literals can not be combined with arbitrary base literals.
 
123456789123456789123456789 100000000000x
123456789123456789123456789 100000000000
16b100 10x
|ill-formed number
 
J also allows integers to be entered using other notations, such as scientific or rational.
 
1e2 100r5
100 20
 
Internally, J freely [http://www.jsoftware.com/help/dictionary/dictg.htm converts] fixed precision integers to floating point numbers when they overflow, and numbers (including integers) of any type may be combined using any operation where they would individually be valid arguments.
 
=={{header|Java}}==