Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Letter after a number, what is it called?

Tags:

What is this called?

double  d1 = 0d; decimal d2 = 0L; float   d3 = 0f; 

And where can I find a reference of characters I can use? If I want to cast 0 to short, which letter I need?

like image 249
BrunoLM Avatar asked Jul 13 '11 15:07

BrunoLM


People also ask

What are the letters after number called?

(Background: numbers that have the additional letters, like st, nd, rd, and th are called ordinals: 1st, 2nd, 3rd, and 4th. When you shrink the letters and elevate them, they're called superscript ordinals: 1st, 2nd, 3rd, and 4th.)

What is a word with letters and numbers?

An alphanumeric character is one which is either alphabetic or numeric — that is, either a letter or a digit. As a noun, we can talk about alphanumerics for the collection of them, as I do here in this answer.

What is M after number C#?

Notice the "f" and "m" after the numbers - it tells the compiler that we are assigning a float and a decimal value. Without it, C# will interpret the numbers as double, which can't be automatically converted to either a float or decimal.

What are the letters on 1st called?

Ordinal numbers may be written in English with numerals and letter suffixes: 1st, 2nd or 2d, 3rd or 3d, 4th, 11th, 21st, 101st, 477th, etc., with the suffix acting as an ordinal indicator. Written dates often omit the suffix, although it is nevertheless pronounced.


1 Answers

The best source is the C# specification, specifically section Literals.

The relevant bits:

The type of an integer literal is determined as follows:

  • If the literal has no suffix, it has the first of these types in which its value can be represented: int, uint, long, ulong.
  • If the literal is suffixed by U or u, it has the first of these types in which its value can be represented: uint, ulong.
  • If the literal is suffixed by L or l, it has the first of these types in which its value can be represented: long, ulong.
  • If the literal is suffixed by UL, Ul, uL, ul, LU, Lu, lU, or lu, it is of type ulong.

If no real_type_suffix is specified, the type of the real literal is double. Otherwise, the real type suffix determines the type of the real literal, as follows:

  • A real literal suffixed by F or f is of type float. […]

  • A real literal suffixed by D or d is of type double. […]

  • A real literal suffixed by M or m is of type decimal. […]

That means the letter (or letters) is called “suffix”. There is no way to represent short this way, so you have to use (short)0, or just short x = 0;.

like image 54
svick Avatar answered Oct 17 '22 20:10

svick