Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

16 bit floating point numpy


#define half_ctype_add(a, b, outp) *(outp) = 
        npy_float_to_half(npy_half_to_float(a) + npy_half_to_float(b))
#define half_ctype_subtract(a, b, outp) *(outp) = 
        npy_float_to_half(npy_half_to_float(a) - npy_half_to_float(b))
#define half_ctype_multiply(a, b, outp) *(outp) = 
        npy_float_to_half(npy_half_to_float(a) * npy_half_to_float(b))
#define half_ctype_divide(a, b, outp) *(outp) = 
        npy_float_to_half(npy_half_to_float(a) / npy_half_to_float(b))

Source by w3programmers.org #
 
PREVIOUS NEXT
Tagged: #bit #floating #point #numpy
ADD COMMENT
Topic
Name
1+8 =