Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the type for "half" (binary16) in C#?

Tags:

c#

value-type

I'm working in a context where nVidia GPU's are implied, which leads me to using the "half" (binary16, low precision floating-point number) type. However, I don't know to which type this translates in C#. Any idea?

http://en.wikipedia.org/wiki/Half_precision_floating-point_format

like image 915
Lazlo Avatar asked Jan 12 '11 22:01

Lazlo


2 Answers

Prior to .NET 5.0, .NET doesn't support "half" as a basic type. However, there are libraries providing conversion routines.

like image 161
Martin v. Löwis Avatar answered Nov 14 '22 23:11

Martin v. Löwis


.NET 5 includes System.Half to represent the IEEE 754-2008 binary16 floating point data type. There's no C# type for it (yet), though.

like image 30
omajid Avatar answered Nov 15 '22 00:11

omajid