fbpic icon indicating copy to clipboard operation
fbpic copied to clipboard

what about fbpic data type during running?

Open JBGuan opened this issue 11 months ago • 1 comments

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!

JBGuan avatar Feb 08 '25 06:02 JBGuan

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

RemiLehe avatar Mar 25 '25 13:03 RemiLehe