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


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

BUG: binary data is not being interpreted correctly

Started byadrian.hawryluk@gmail.com
First post2016-06-10 17:11 -0700
Last post2016-06-10 19:08 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  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

#3339 — BUG: binary data is not being interpreted correctly

Fromadrian.hawryluk@gmail.com
Date2016-06-10 17:11 -0700
SubjectBUG: binary data is not being interpreted correctly
Message-ID<aa0d5af4-e41e-4e11-8eb2-3549bd29aea2@googlegroups.com>
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.

[toc] | [next] | [standalone]


#3340

FromJack Adrian Zappa <adrian.hawryluk@gmail.com>
Date2016-06-10 19:08 -0700
Message-ID<0989d240-3369-411c-9e2f-f4c879e87481@googlegroups.com>
In reply to#3339
Never mind.  I found the bug tracking site.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web