Open GPMueller opened 5 years ago
The main issue with using scalar
for the API would be that even in cases where only the API has to use float
(e.g. JS), the entire core library would have to use float
.
This could be avoided by using
#define SPIRIT_API_SCALAR float
typedef SPIRIT_API_SCALAR spirit_scalar;
in the API, while using the regular scalar
inside the core library.
Note also the related issue #477
I believe the rationale behind using
float
wasfloat
to be used in the APIHowever, several functions therefore return very imprecise values, even though they are known to higher precision in the core. The API should therefore return scalar values with the same precision as the core is working with.
This could be achieved by using the definition of
scalar
in the API, forcing the usage offloat
in the JS build and checking the precision in the Python API and using ac_scalar
type, which is eitherctypes.c_float
orctypes.c_double
accordingly.