Structures for non-primitive numerical data types #51046
Replies: 3 comments 1 reply
-
This is a BCL feature request, not a C# one. Arithmetic operators are totally BCL feature request. |
Beta Was this translation helpful? Give feedback.
-
Transferring to dotnet/runtime for this API request. If the BCL added this, we might consider having aliases for this in the c# language itself (similar to |
Beta Was this translation helpful? Give feedback.
-
We already expose
If you would like to see any of these added I would suggest opening individual API proposals following our template: https://github.com/dotnet/runtime/issues/new?assignees=&labels=api-suggestion&template=02_api_proposal.md |
Beta Was this translation helpful? Give feedback.
-
Please excuse my terrible explanation skills, it is very late and I am very tired
Overview
Currently in C#, there is no built-in analogs to
half
,binary256
,int128
, and other such types seen in both the IEEE754 specification, and other programming languages. Such numerical types, although less flexible than theBigInteger
andBigDecimal
structures of theSystem.Numerics
namespace, would theoretically allow for faster code, as the need for dynamic sizing would be eliminated.Larger Numeric Values
In scientific and data-analysis oriented programs, it is often found that the provided numerical types of C# are insufficient to represent the data needed. As such, the following structures should be added to the Standard library, using the primitive type
ulong
to store the raw data:Half-precision Floating Point Values
Furthermore, several graphics engines require the usage of half-precision floating point values. As such, a
System.Half
struct would prove extremely useful (and can be created relatively easily, using aushort
backing). For example:The above code would provide library creators with much simpler ways to interace with existing code, like OpenGL, which uses half-precision floats.
Notes
All above types should define the following:
Beta Was this translation helpful? Give feedback.
All reactions