flavray / avro-rs

Avro client library implementation in Rust
MIT License
169 stars 95 forks source link

Fix f32 and f64 encoding/decoding #116

Closed cpcloud closed 4 years ago

cpcloud commented 4 years ago

avro-rs currently doesn't conform to the binary encoding spec for f32 and f64 values which states:

* a float is written as 4 bytes. The float is converted into a 32-bit integer using a method equivalent to Java's floatToIntBits and then encoded in little-endian format.
* a double is written as 8 bytes. The double is converted into a 64-bit integer using a method equivalent to Java's doubleToLongBits and then encoded in little-endian format.

This PR fixes that.

ref: https://avro.apache.org/docs/1.8.1/spec.html#binary_encode_primitive

poros commented 4 years ago

Thanks for the fix!