Linked Questions

1 vote
2 answers
3k views

Half-float conversion algorithm in C? [duplicate]

Possible Duplicate: 32-bit to 16-bit Floating Point Conversion How do I convert between 32-bit floats and 16-bit half-precision floats in C?
Anton's user avatar
  • 5,992
0 votes
1 answer
2k views

How to convert decimal to IEEE 754 Half Precision Format in C++? [duplicate]

I am currently trying to convert a decimal value into IEEE 754 Half Precision Floating Point format but ran into some issues with the conversion. Currently this code only works in converting into ...
Kai's user avatar
  • 31
0 votes
0 answers
50 views

How to convert IEEE 754 half-precision number to float and vice versa [duplicate]

I am use the CCS compiler to microcontroller and I am taking a frame of reads from a RTU in hexadecimal of 2 bytes (16 bist) which I store in an int16 array, these stored data are floating point ...
DarioG's user avatar
  • 83
12 votes
3 answers
26k views

Float32 to Float16

Can someone explain to me how I convert a 32-bit floating point value to a 16-bit floating point value? (s = sign e = exponent and m = mantissa) If 32-bit float is 1s7e24m And 16-bit float is ...
Goz's user avatar
  • 61.9k
7 votes
4 answers
22k views

Convert int to 16bit float (half precision floating point) in c++

How can I convert an integer to a half precision float (which is to be stored into an array unsigned char[2]). The range to the input int will be from 1-65535. Precision is really not a concern. I am ...
Ross's user avatar
  • 14.4k
1 vote
1 answer
4k views

How to convert bytes to half-floats in Swift?

How can I convert two bytes (UInt8) to a half-precision (16-bit) Float in Swift, such as needed when reading the output of CIAreaHistogram with the kCIFormatRGBAh, as in the following example: func ...
Klaus's user avatar
  • 53
0 votes
3 answers
2k views

Save float16 max number in float32

How to save the float16 (https://en.wikipedia.org/wiki/Half-precision_floating-point_format) max number in float32 (https://en.wikipedia.org/wiki/Single-precision_floating-point_format) format? I ...
Zack's user avatar
  • 1,225
3 votes
0 answers
6k views

fp32 to fp16 and reverse conversion - Matlab or C++ code

I have a decimal number (such as 0.15625) which is stored as 32-bit floating point (fp32) number (0-01111100-01000000000000000000000 (sign-exponent-mantissa)) in memory. I want to convert that fp32 to ...
ard24ie's user avatar
  • 181
1 vote
2 answers
1k views

Bit shifting a half-float into a float

I have no choice but to read in 2 bytes that make up a half-float. I would like to work with this in the form of a 4 byte float. Ive done some research and the only thing I can come up with is bit ...
Justin Barren's user avatar
1 vote
2 answers
1k views

how to save a double matrix quickly and compactly if some loss of precision is acceptable?

I have a matrix of double whose size is 1024x1024. I want to write it to a file. Here is the solution for this. Accepted answer is 50-60% more time efficient than the second answer in the question as ...
smttsp's user avatar
  • 4,121
0 votes
1 answer
430 views

Convert ieee754 half-precision bytes to double and vise versa in Flutter

I have a device that provides temperature data in ieee754 half-precision float format, i.e. [78, 100] = +25.5C. Now, Dart/Flutter doesn't support HP-Float conversions out of the box. After googling ...
Pavel's user avatar
  • 655
1 vote
2 answers
188 views

How much perf can I get using half_floats for vertex attribs?

Currently I have a dynamic VBO (updated every frame, particle system). I send 4 floats for pos and 4 floats for color. How much perf can I expect if I move to half_float data type? Is it something ...
fen's user avatar
  • 9,905
0 votes
1 answer
269 views

Declaring Half precision floating point memory in SYCL

I would like to know and understand how can one declare half-precision buffers and pointers in SYCL namely in the following ways - Via the buffer class. Using malloc_device() function. Also, suppose ...
Atharva Dubey's user avatar
1 vote
1 answer
263 views

Copying to and from half-precision F16 allocation in android (renderscript)

Also asked here with no luck (https://groups.google.com/forum/#!topic/android-developers/Rh_L9Jv_S8Q) I'm trying to figure out how to do half-precision using types like half and half4. The only ...
Tim Ambrose's user avatar
1 vote
1 answer
124 views

How to create a custom winrt::Microsoft::AI::MachineLearning::TensorFloat16Bit?

How do I create a TensorFloat16Bit when manually doing a tensorization of the data? We tensorized our data based on this Microsoft example, where we are converting 255-0 to 1-0, and changing the RGBA ...
Anna Maule's user avatar

15 30 50 per page