fbpic
fbpic copied to clipboard
what about fbpic data type during running?
I noticed that the variable defined in the simulation is of type float, while the data read at the end is of type double. Could you please let me know whether the data type used in the calculations within FBPIC is float or double? Thank you!
Thanks for the question and sorry for the late reply.
FBPIC uses double-precision floating-point representation everywhere (i.e. double in the C/C++ nomenclature).
In the context of Python, the type float does not necessarily correspond to single-precision representation (unlike in the C/C++ nomenclature), as you can see from this quick example:
In [1]: import numpy as np
In [2]: np.pi # 15 significant digits, i.e. double-precision
Out[2]: 3.141592653589793
In [3]: type(np.pi)
Out[3]: float