%% Convert Value to Half Precision
% To cast a double-precision number to half precision, use the half function.

a = half(pi)

% You can also use the half function to cast an existing variable to half precision.

v = single(magic(3))
a = half(v)

%
% Copyright 2019 The MathWorks, Inc.