-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculate prices in cent integers #52
Comments
This is a breaking change. Although I definitely see the need for this "fix" I would like to postpone it for an eventual V3 of the API. How would you generate a string prince in python, since you probably will have the same problem, like you have shown here. |
@COM8: I would calculate the prices in cent in a variable like |
Yes, this would be an option. |
Calculating the prices in integers of cents are a valid option. Even though, strings or numbers for prices probably wouldn't make a big difference at the moment, I still think for a good API, we shouldn't provide formatted values. |
Price formatting should be done in frontend by a library specifically made for this purpose so changing this to cents in v3 is probably the best option |
Since floats are mathmatically uncountable, Python does not always calculate them correctly. This problem occurs, e.g. with some prices in the FMIParser.
E.g.:
Solution:
Calculate prices in cents. Then format them to a string containing the euro-format.
The text was updated successfully, but these errors were encountered: