[bug #57715] Discontinuity time - event missed - oops?
anonymous <[email protected]> Fri, 31 Jan 2020 16:03:07 -0500 (EST)
| Newsgroups | gmane.comp.gnu.mcsim.bugs |
|---|---|
| Message-ID | <[email protected]> |
URL:
<https://savannah.gnu.org/bugs/?57715>
Summary: Discontinuity time - event missed - oops?
Project: MCSim simulation sofware
Submitted by: None
Submitted on: Fri 31 Jan 2020 09:03:06 PM UTC
Category: Sim
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Frédéric,
This concerns modelu.c, line 286. A model that we're working on, and that
makes use of events, produces the diagnostic:
UpdateSpikes: Discontinuity was passed over...
I upgraded the diagnostic output to be more informative:
UpdateSpikes: Discontinuity was passed over:
sim time = 1.90000000000000010
event time = 1.89999999999999990
So, the issue of an event being passed over seems to be caused by comparing
two double precision numbers for equality, a perennial source of software
bugs. Your "Oops" comment in the source code suggests you thought this was an
accident waiting to happen.
I have not tried our model on Linux. We are building MCSim on Windows using
mingw. The cc switches are just -O3, and we're linking with GSL.
C99 gives us nextafter() and nextforward(). Using nextafter() seems to offer a
fix. See attached, lines 293-308. This corrects the issue for our model but I
think a more robust solution is required here.
Alex
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Fri 31 Jan 2020 09:03:06 PM UTC Name: modelu.c Size: 24KiB By: None
<http://savannah.gnu.org/bugs/download.php?file_id=48318>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?57715>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/