Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #3339

BUG: binary data is not being interpreted correctly

X-Received by 10.66.83.230 with SMTP id t6mr3511258pay.37.1465603910296; Fri, 10 Jun 2016 17:11:50 -0700 (PDT)
X-Received by 10.36.113.199 with SMTP id n190mr66320itc.0.1465603910225; Fri, 10 Jun 2016 17:11:50 -0700 (PDT)
Path csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!p34no5282303qgp.1!news-out.google.com!v8ni43qgv.0!nntp.google.com!p34no5282299qgp.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.graphics.apps.gnuplot
Date Fri, 10 Jun 2016 17:11:49 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=184.151.37.99; posting-account=knJcvwoAAADp-ek5wb0bTx3AMge3cPAA
NNTP-Posting-Host 184.151.37.99
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <aa0d5af4-e41e-4e11-8eb2-3549bd29aea2@googlegroups.com> (permalink)
Subject BUG: binary data is not being interpreted correctly
From adrian.hawryluk@gmail.com
Injection-Date Sat, 11 Jun 2016 00:11:50 +0000
Content-Type text/plain; charset=UTF-8
X-Received-Bytes 2129
X-Received-Body-CRC 155209339
Xref csiph.com comp.graphics.apps.gnuplot:3339

Show key headers only | View raw


I create a small binary file and it is ok, but when the binary file gets to a certain size, it goes all wonky.  Here is a C++ binary file generator:

#include <limits>
#include <iostream>
#include <assert.h>

template <typename T1, typename T2>
void write(std::ostream& os, T1 x, T2 y)
{
	using namespace std;
	static int counter = 0;
	assert(0 <= x);
	assert(0 <= y);
	assert(x < numeric_limits<double>::max());
	assert(y < numeric_limits<double>::max());
	double array[2] = { (double)x, (double)y };
	os.write((char*)array, sizeof(array));
	os.flush();
	++counter;
}

int main()
{
	using namespace std;
	ofstream os;
	os.open("data.dat");
	uint64_t y_value = 0;
	for (uint64_t x_value = 0; x_value < 5000; ++x_value)
	{
		write(os, x_value, y_value);
		if (x_value % 10 == 0)
		{
			++y_value;
		}
	}
	return 0;
}

It just creates a stepping function, increasing 1 every 10.  I then read the file using the command:

plot 'data.dat' binary format='%lf%lf' 0:1

If I read the file before it gets too big, I get an increasing stepping function.  If I get to around 2000, I get some negative values.

Back to comp.graphics.apps.gnuplot | Previous | NextNext in thread | Find similar


Thread

BUG: binary data is not being interpreted correctly adrian.hawryluk@gmail.com - 2016-06-10 17:11 -0700
  Re: BUG: binary data is not being interpreted correctly Jack Adrian Zappa <adrian.hawryluk@gmail.com> - 2016-06-10 19:08 -0700

csiph-web