dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.21k stars 5.86k forks source link

Where are floating point literals for C# explained? #7782

Closed svick closed 4 years ago

svick commented 5 years ago

I was looking for the documentation of "real literals" (e.g. 3.14e-2m) in the C# guide and couldn't find anything. I think this syntax is likely going to be confusing to newcomers and so it should be explained somewhere.

I tried various search terms on Google and also clicked through the TOC of the C# guide and didn't find anything. Did I just miss the article? (In which case, maybe its SEO could be improved.) Or does it actually not exist?

mikedn commented 5 years ago

I tried various search terms on Google

Did you mean that you used Google to search the entire Internet or only the docs site? That "real literal" (BTW where did you get the term, is that what the docs say?) thing is known as scientific notation and it's pretty common/well known.

svick commented 5 years ago

Did you mean that you used Google to search the entire Internet or only the docs site?

I searched the whole internet. Ideally, I think docs.MS should be in the first page of results. But I understand that's not going to happen every time.

where did you get the term, is that what the docs say?

It's what the spec calls them.

thing is known as scientific notation and it's pretty common/well known

Yeah, "c# scientific notation" is one of the search terms I used. Lots of results from Stack Overflow, none I could see from docs.MS.

mikedn commented 5 years ago

It's what the spec calls them.

Right, I forgot that they use "real" rather than "floating point" for literals.

Yeah, "c# scientific notation" is one of the search terms I used. Lots of results from Stack Overflow, none I could see from docs.MS.

I see. "scientific notation" alone produces quite different search result. I'm not sure if MS docs is the right place to explain common notions that can be found in pretty much every programming language and even in old pocket calculators. But it could at least mention the term so that interested people know what to search for.

pkulikov commented 5 years ago

@svick there is one mention here (with the link to the spec): https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/value-types-table#remarks

Though, it says "real numerical literal", not "real literal".