If you're printing doubles in scientific form you should print it to at least 15 digits or something. 6 digits is far from enough to resolve tiny differences.
"delete &" is not what you want, the & makes no sense there.
The memcpy code is also wrong. You are only copying 1000 bytes, not 1000 ints.
Much simpler:
It(should_work_for_random_tests_n_1000_An_10000) {
srand((unsigned)time(NULL));
cout << "<p><font color=\"blue\">n == 1000, a[n] <= 10000</font></p>" << endl;
int count = 3;
while (count--) {
std::array<int, 1000> array;
for (auto i = 0; i < 1000; ++i)
array[i] = rand() % 10000;
Assert::That(don't see this!);
}
}
This comment is hidden because it contains spoiler information about the solution
Einstellung Effect
This comment is hidden because it contains spoiler information about the solution
Thanks! It's already approved :)
I've lowered the radius values for C++ random tests, could you try again?
If you're printing
double
s in scientific form you should print it to at least 15 digits or something. 6 digits is far from enough to resolve tiny differences.Rounding function seems ok, maybe the problem is in the rest of your code. I agree the error message isn't helpful in that case.
but the spoiler flag is... :p (comments visible in the dashboard of anyone)
Description updated.
Many thanks! I've done the changes.
"delete &" is not what you want, the & makes no sense there.
The memcpy code is also wrong. You are only copying 1000 bytes, not 1000 ints.
Much simpler:
And should you need a copy you can then simply:
Any idea about this problem? (I've rewritten the tests using
std::array
)My code:
Which is raising:
Process exited prematurely with a SIGSEGV signal.
Thanks again for your suggestion and help! :D
Shit, the edited codes are lost. Maybe I should try to rewrite one tomorrow. It's 0:00 a.m. in my timezone. I have to sleep.
I'll try, thanks
Loading more items...