Floating type names matching integer type names?

I have to say that I was pleased when I opened C # to see what integer data types are Int16,Int32 and Int64. He removed any ambiguity, such as int, increasing with age.

What surprises me is why it doesnโ€™t or doesnโ€™t seem to be, Float16,Float32 and Float64 or at least not in normal mode: MSDN quick search refers to float64, because R8 (unmanaged type) does not match double

I assume that in Single and Double (or even Extended (Float80), which does not exist in C #, as far as I know, there is not much ambiguity, I'm not sure how this could be set up for this question.) Although Decimal, seems to be Float128, and I noted that it is called "Extended Floating Point Precision", should we see Int128 to match it?
EDIT: There is no ambiguity at all in Single or Double (it was an assumption, but it seems to be true, and I thought I would add this for clarity.)

Should we expect this kind of naming convention? / Would you appreciate it if you did?

Or should we go further and have Int<N>harsh numbers for sizes? (yes, I understand that there are libraries that support such things)

+3
source share
2 answers

Well, there are different things here:

  • Types open by .NET.
    • What is available
    • What each type is called
  • What ends up being superimposed on other languages, for example. C # using intto denoteSystem.Int32

Personally, I would prefer Float32and Float64how CLR types. I can, of course, see some confusion in F # by naming the types "float" (for System.Double) and "float32" (for System.Single). I would not want to be Decimalcalled Float128; possibly Decimal128to use other similar types.

, Byte UInt8 - , , .

, Int<N>. , , , , . ( , , BigInteger .NET 4.0.)

+1

, #, , . , # . , F # BigInteger, , , , , , CLR.

, โ€‹โ€‹ IEEE. , , , " " IEEE . , , float (, 2x2 = 3.9999999999999), .

-, , , , F # #. , , ... .

... #... # - , . , , .

0

Source: https://habr.com/ru/post/1734533/


All Articles