multimeter/voltmeter now raise an exception if one tries to set a recording interval that is not a multiple of the resolution
It was always intended that multimeter/voltmeter should only accept recording intervals that were multiples of the resolution. Due to an implementation error, this did not happen and multimeter silently rounded to the nearest step. This PR ensures expected behavior and makes this explicit in the documentation. See also #3634.
Thanks for the PR! It looks good and a special thumbs up for the updated example in the docs. As another sanity check, I tried to set the interval to larger and larger numbers and it only broke when I got to nest.Create("multimeter", params={"interval": 123456789012345.}), so the current solution seems robust with respect to floating point representation issues until way past any reasonable value. However, I notice that an interval of 0.1001 silently gets rounded to 0.1. Is this expected behaviour?
Thanks for the PR! It looks good and a special thumbs up for the updated example in the docs. As another sanity check, I tried to set the interval to larger and larger numbers and it only broke when I got to
nest.Create("multimeter", params={"interval": 123456789012345.}), so the current solution seems robust with respect to floating point representation issues until way past any reasonable value. However, I notice that an interval of 0.1001 silently gets rounded to 0.1. Is this expected behaviour?
Thanks for checking the boundaries. With the upper limit, we are close to 4000 years if my calculations are right, that should suffice :). Concerning the silent rounding of 0.1001 to 0.1, this is a feature: To handle the numerical limitations of floating point numbers, NEST internally represents time in tics, which by default are 1µs. Any time passed as a floating point number will be rounded to the nearest tic and evaluation of whether it corresponds to a time step is then done in integer arithmetic based on the tics.
Thanks for the explanation, all signals green then from my side!