10-08-2007 02:55 PM
tst wrote "To be honest, this bug really scares me now. "
Same here. I wonder if this is in some way associated with Kevin's scepticism about the timestamps returned in the waveforms of DAQ reads. He has written that he does not think they are precise enough for what he does. Although I have never seen anything close myself, my DAQ systems timing requirements are not pushing that many sig-figs.
Ben
10-08-2007 03:38 PM
10-08-2007 04:42 PM
@sth wrote:
Does NI use the same library as excel and does the "close to 65535" bug show up in LV on windows?
You should note that the problem is not LV's math skills - I assume LV implements all the math in straight C to conform to IEEE 754 and *maybe* uses some external libraries for it. The problem here is that sometimes, when you (the user) call a Microsoft external code function, it changes the precision of the CPU to double and doesn't set it back after it's done. That means your thread now has double precision when it thinks it has extended precision.
10-08-2007 05:15 PM
12-04-2007 12:17 PM
Here's an example of the issue I mentioned in reply 16. It's the same program, so it's probably the same cause.
The VI rounds an array of DBLs to a precision. When this was working wrong, the VI rounded these numbers wrongly (e.g. 200.41500000000002 with a precision of 2 was rounded to 200.410000000000025000 instead of 200.420000000000016000, which caused it to be 200.41 instead of 200.42). I saved the VI with the current values as default after a wrong run, so running the VI now will show this clearly, as it produces the correct result, which you can see alongside the wrong result.
12-04-2007 04:11 PM
Not to divert the thread, but Ben mentioned my skepticism about timestamps in DAQ and I figured I should clarify. My skepticism concerns other matters that seem entirely unrelated to the issue in this thread. For example:
1. In a triggered or an externally clocked acquisition, the "t0" value is set by the call to DAQmx Start, even if the trigger edge or external clock edge doesn't occur for several minutes or hours. Thus the t0 timestamp field of a waveform datatype can be misleading.
2. In an externally clocked acquisition, the "dt" value of an AI waveform seems to be set by whatever you wire into DAQmx Timing as the "rate". I guess that's the only sensible behavior, but it still burned me the following way. I configured a counter pulsetrain to clock my AI. Then I queried the counter task for its frequency which I wired into the AI task as the "rate" input. Trouble was: the user-specified rate wasn't possible to implement on the counter, but my query to the counter task returned the requested freq rather than the actual freq. I don't now recall whether this was *only* because the counter task had not yet been started, or whether there was a flaw in an older DAQmx version that did this even after the task started. In any event, it was another reason for me to be wary of waveform timing info.
Back to the regularly-scheduled thread...
-Kevin P.
12-05-2007 01:38 PM - edited 12-05-2007 01:41 PM
12-05-2007 02:19 PM
This is the same program and the same section of the program as before, so it has all the same interaction with .NET, which is probably the source of this. This VI is actually several weeks old, but I didn't get to uploading it until now. At some point I changed the execution system of either the VIs that do the calculations or the .NET VIs as a workaround and I haven't seen it since, but I only get to work on this program about one day a week, so it's also possible that it didn't help.
This also happened the same way as the other issue (intermittently), which is why I noticed it. What I actually wanted to point out here was that a number which was clearly supposed to be rounded up (since it had a *500...01 as a fraction) was rounded down, presumably because the changing resolution moved it below the 5 value. This also shows clearly that this affects numerical calculations as well (like Brian said) and not just conversions to strings.
P.S. Yes, I'm aware that the IEEE 754 standard implements banker's rounding, but my client didn't want it.
12-05-2007 02:21 PM - edited 12-05-2007 02:26 PM
With regards to this problem specifically, I'd really like to see if anyone else can reproduce this... if not, it seems to be specific to your system (perhaps it's a problem with your processor or memory) or with the unique software configuration you are using (i.e. are you concurrently running anything that would interfere with the precision like was mentioned by Brian).