Feature #4612
closed
Encode/decode floating-point number in TLV-VALUE
Added by Junxiao Shi over 6 years ago.
Updated almost 6 years ago.
Description
Define a convention of serializing floating-point number in TLV-VALUE.
Implement encoding and decoding functions in encoding/block-helpers.hpp
.
One use case is serializing a set of hyperbolic coordinates that contains floating-point numbers.
- Related to Bug #4609: NLSR unit test failing on ARM added
- Blocks Task #4615: Use the double encoding/decoding functions for hyperbolic coordinates added
- Assignee set to Tianxing Ma
- Status changed from New to Code review
- Target version set to v0.7
What do we do with NaN and infinite values?
Also, why are the new helpers named readFloat
/makeFloatBlock
/etc..? They deal with doubles so using "Double" in the name instead of "Float" sounds more intuitive to me.
They deal with doubles so using "Double" in the name instead of "Float" sounds more intuitive to me.
"Float" is not wrong. double
is one of the C types for floating point numbers.
You're missing my point. I didn't say it's wrong, I said it's not intuitive because "float" is also a floating-point type in C/C++, and the fact that e.g. readFloat
returns a double
instead of a float
is probably surprising/confusing to most readers.
Davide Pesavento wrote:
You're missing my point. I didn't say it's wrong, I said it's not intuitive because "float" is also a floating-point type in C/C++, and the fact that e.g. readFloat
returns a double
instead of a float
is probably surprising/confusing to most readers.
Yes, I think readDouble is more accurate here.
@Tianxing, could you please check whether we need representation of zero, NAN, infinite in NLSR hyperbolic coordinates encoding/decoding?
- Subject changed from Represent floating-point number as TLV-VALUE to Encode/decode floating-point number in TLV-VALUE
- Status changed from Code review to Feedback
- % Done changed from 0 to 100
Code has been merged. Do we need to document the encoding format somewhere?
- Status changed from Feedback to Closed
Also available in: Atom
PDF