help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Joining large and small float into array - difference in result


From: Pavel Hofman
Subject: Joining large and small float into array - difference in result
Date: Mon, 11 Mar 2019 23:10:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

Hi,

I am encountering a weird problem.

I need to place float timestamp (time()) and another float into one vector.

debug> a
a =    1.70434168467182e-06
debug> timestamp
timestamp =  1552340333.21415
debug> a
a =    1.70434168467182e-06
debug> b = [timestamp, a]
b =

   1.55234035200000e+09   1.70434168467182e-06


Please note the difference in the original timestamp and the first item in vector b. It is not only rounding since the whole number is different (1552340333 vs. 1552340352).


This rounded and modified value is stored into file using the save() method in default text mode, I see the exact text value. With load() it gets loaded correctly - as the changed 1.55234035200000e+09.

When trying the same in octave prompt (not in debug mode) I get correct values:


>> a = 1.70434168467182e-06
a =    1.70434168467182e-06
>> timestamp = 1552340333.21415
>> b = [timestamp, a]
b =

   1.55234033321415e+09   1.70434168467182e-06

Please how can I preserve (and save to file) the the original timestamp float value while the program runs?

Octave 4.2.2, Linux.

Thanks a lot,

Pavel.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]