encode_double

Function encode_double 

Source
pub fn encode_double(value: f64) -> Vec<u8> 
Expand description

Encodes a double-precision floating-point number (f64) into its binary representation.

The encoding process converts the f64 value into its little-endian byte representation and appends the bytes to a buffer.

§Arguments

  • value - The f64 value to be encoded.

§Returns

A Vec<u8> containing the binary representation of the input f64 value.

§Example

use rustwire::encode_double;

let value: f64 = 2.71828;
let encoded = encode_double(value);
assert_eq!(encoded, vec![0x90, 0xF7, 0xAA, 0x95, 0x9, 0xBF, 0x5, 0x40]);