[ 
https://issues.apache.org/jira/browse/THRIFT-964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12924361#action_12924361
 ] 

Arvind Jayaprakash commented on THRIFT-964:
-------------------------------------------

Mathias, it should be possible to take the underlying 4 bytes that represent a 
single precision number and shove it into some other data type of a similar 
size. Two problems exist with this approach

(1) The need for a custom serialization/deserialization will end up making it 
an "out of trunk" feature against which the library users will have to code 
their application.

(2) Space+time inefficiency.
Outside of C (& ASM), I do not know of any language where a contiguous region 
of memory can be reinterpreted as an array of another type. As I mentioned, 
size a reason for asking this feature in the first place. If I deserialize the 
4 bytes as anything but a float and then assign it to a float, it will be a 
value copy in most languages. If I had to go through such memory overheads, I 
might as well stick to double.

> Support for single precision floating point numbers
> ---------------------------------------------------
>
>                 Key: THRIFT-964
>                 URL: https://issues.apache.org/jira/browse/THRIFT-964
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Compiler (General)
>            Reporter: Arvind Jayaprakash
>
> We have an application that uses "float", the IEEE single precision numbers. 
> The reasons are the two obvious ones: the lack of need for precision as high 
> as "double" and data size given that we have millions of such numbers.
> I'd like to see support for this data format.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to