octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #59979] Unexpected format for output from date


From: anonymous
Subject: [Octave-bug-tracker] [bug #59979] Unexpected format for output from datevec
Date: Sat, 30 Jan 2021 15:06:45 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0

Follow-up Comment #1, bug #59979 (project octave):

This sounds like no more than a floating point rounding issue. The value of
your 20 minute difference is 0.01388888887595385.

octave:2>
datenum_20_min_diff=datenum([2021,1,27,17,0,0])-datenum([2021,1,27,16,40,0])
datenum_20_min_diff = 0.01388888887595385


Which upon multiplying by 86400 seconds in a day falls short of 20 minutes by
1.117 microseconds:

octave:3> datenum_20_min_diff * 86400
ans = 1199.999998882413
octave:4> datenum_20_min_diff * 86400 - 1200
ans = 1.117587089538574e-06


You may want to try setting your 20 minute difference to 1200/86400 since you
know it's exactly 20 minutes, or even better, work in units that don't need
small fractions until you're ready to print.

In either case, this doesn't look like a bug.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59979>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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