# Error running Macro

**URL:** <https://root-forum.cern.ch/t/error-running-macro/45126>\
**Category:** ROOT\
**Created:** [May 28, 2021, 12:46am UTC](https://root-forum.cern.ch/t/error-running-macro/45126 "2021-05-28T00:46:10Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [May 31, 2021, 8:27am UTC](https://root-forum.cern.ch/t/error-running-macro/45126/5 "2021-05-31T08:27:42Z")

</div>

Can you try to make your arrays `x` and `y` `std::vectors` instead of `double[100000]`, please?

Unrelated but still problematic, you are doing several floating point to integer conversion, where your result is basically “random”, e.g. `g1->SetPoint(i*4, i, sum);` with `i` being a double: it might store your intended 0.25 as `0.249999998` and that `*4` and converted to `int` might give 0, not 1!

I don’t see anything obviously wrong, so either allow us to reproduce this by sharing the required files, or consider running `valgrind` (if you’re on Linux) on it to see what’s broken. See [Valgrind and ROOT](https://root-forum.cern.ch/t/valgrind-and-root/28506)

---

_[View the full topic](https://root-forum.cern.ch/t/error-running-macro/45126)._
