Skip to content

Commit 1e1c1b5

Browse files
committed
Added parenthesis to equation to show explicit order of operations
Made the intended calculation clear.
1 parent 5008045 commit 1e1c1b5

File tree

2 files changed

+4
-4
lines changed
  • Oscilloscopes/PerformanceScopes/src/CurvestreamExample
    • CurvestreamExample-IVI-VISA.NET/CurvestreamExample-IVI-VISA.NET
    • CurvestreamExample-NI-VISA/CurvestreamExample

2 files changed

+4
-4
lines changed

Oscilloscopes/PerformanceScopes/src/CurvestreamExample/CurvestreamExample-IVI-VISA.NET/CurvestreamExample-IVI-VISA.NET/frmMain.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ private void cmdStartTest_Click(object sender, EventArgs e)
242242
}
243243

244244
// Calculate the xvalue for the first point in the record
245-
xvalue = (float)-pt_off * xinc + xzero;
245+
xvalue = (((float)(-pt_off)) * xinc) + xzero;
246246

247247
// Get the number of bytes that make up the data length string
248248
NumBytesCharCount = Int32.Parse(BlockHeader.TrimStart('#'), System.Globalization.NumberStyles.HexNumber);
@@ -272,7 +272,7 @@ private void cmdStartTest_Click(object sender, EventArgs e)
272272
// Convert byte values to floating point values then write to .csv file
273273
foreach (byte DataPoint in DataBuffer)
274274
{
275-
yvalue = (float)(Convert.ToSingle((sbyte)DataPoint) - yoff) * ymult + yzero;
275+
yvalue = ((Convert.ToSingle((sbyte)DataPoint) - yoff) * ymult) + yzero;
276276
if (saveToDisk)
277277
SaveFile.WriteLine(xvalue.ToString() + "," + yvalue.ToString());
278278
// Note: Converting to .CSV is very time consuming operation.

Oscilloscopes/PerformanceScopes/src/CurvestreamExample/CurvestreamExample-NI-VISA/CurvestreamExample/frmMain.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ private void cmdStartTest_Click(object sender, EventArgs e)
229229
StreamWriter SaveFile = new StreamWriter(FileName, false, Encoding.ASCII, BUFFER_SIZE * 10);
230230

231231
// Calculate the xvalue for the first point in the record
232-
xvalue = (float)-pt_off * xinc + xzero;
232+
xvalue = (((float)(-pt_off)) * xinc) + xzero;
233233

234234
// Get the number of bytes that make up the data length string
235235
NumBytesCharCount = Int32.Parse(BlockHeader.TrimStart('#'), System.Globalization.NumberStyles.HexNumber);
@@ -258,7 +258,7 @@ private void cmdStartTest_Click(object sender, EventArgs e)
258258
// Convert byte values to floating point values then write to .csv file
259259
foreach (byte DataPoint in DataBuffer)
260260
{
261-
yvalue = (float)(Convert.ToSingle((sbyte)DataPoint) - yoff) * ymult + yzero;
261+
yvalue = ((Convert.ToSingle((sbyte)DataPoint) - yoff) * ymult) + yzero;
262262
SaveFile.WriteLine(xvalue.ToString() + "," + yvalue.ToString());
263263
// Note: Converting to .CSV is very time consuming operation.
264264
// Save in a binary format to maximize speed. Highly recommended for waveforms >= 1 Million points.

0 commit comments

Comments
 (0)