Problem 1165. Convert double scalar to half-precision floating point (IEEE 754r)
Use MATLAB to convert a scalar double into a half-precision floating point. The return value should be a uint16.
The half-precision floating point format is specified here, and is the source for much of the test suite:
http://en.wikipedia.org/wiki/Half-precision_floating-point_format
This is an implementation in C if you want some inspiration to get started:
As other problems related to half-precision are added, I will try to link them here.
Solution Stats
Problem Comments
-
1 Comment
The only thing missing from the test suite are nans,regardless, it's a very good problem. Learned how to extract minus from minus 0, and finally took my time to learn about the controversial denormal floating-points numbers.
Solution Comments
Show commentsProblem Recent Solvers6
Suggested Problems
-
Test if a Number is a Palindrome without using any String Operations
235 Solvers
-
10323 Solvers
-
367 Solvers
-
Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
226 Solvers
-
When can one be the Life Member of the IEEE?
74 Solvers
More from this Author2
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!