|
From: | Dave NotTelling |
Subject: | Re: [Discuss-gnuradio] PMT serialization/deserialization of doubles |
Date: | Thu, 16 Jun 2016 18:52:23 -0400 |
I recently ran across this "bug":(running ipython)[code]In [18]: import pmtIn [19]: pmt.to_double(pmt.deserialize_str(pmt.serialize_str(pmt.from_double(1234567890.0))))Out[19]: 1234567936.0In [20]: pmt.to_double(pmt.from_double(1234567890.0))Out[20]: 1234567890.0[/code]Here is the C++ code:[code]#include <stdio.h>#include <stdlib.h>#include <pmt/pmt.h>// compiled with "g++ doublesTest.cc -o doublesTest -lgnuradio-pmt"int main(){const double orig = 1234567890.0;const double serdes = pmt::to_double(pmt::deserialize_str(pmt::serialize_str(pmt::from_double(orig))));const double normal = pmt::to_double(pmt::from_double(orig));printf("original:%0.3f, serdes:%0.3f, noserdes:%0.3f\n", orig, serdes, normal);return 0;}[/code][output from c++]original:1234567890.000, serdes:1234567936.000, noserdes:1234567890.000[/output from c++]Is this an intended outcome?Thanks!-Dave
[Prev in Thread] | Current Thread | [Next in Thread] |