Skip to content
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

Revamp string_to_decimal_converter.cpp #219

Open
adisidev opened this issue Nov 21, 2024 · 2 comments
Open

Revamp string_to_decimal_converter.cpp #219

adisidev opened this issue Nov 21, 2024 · 2 comments

Comments

@adisidev
Copy link
Collaborator

Currently, the following CSV will not work as expected because Thailand will will become 70.33, whereas we would treat others as if the decimal is absent.

name,Population (m. people),Color
Brunei,0.451,#7570b3
Cambodia,17.353,#e7298a
Indonesia,284.416,#7570b3
Laos,7.788,#66a61e
Malaysia,33.852,#7570b3
Myanmar,54.813,#d95f02
Philippines,114.365,#e7298a
Singapore,5.978,#1b9e77
Thailand,70.33,#1b9e77
Vietnam,101.589,#66a61e

We should either figure out how we can avoid such problems in the future, or we request the input CSV to be a particular format. What are your thoughts @mgastner

@mgastner
Copy link
Owner

Could you please elaborate? If Brunei's population is treated "as if the decimal is absent," would it be interpreted as zero? Additionally, why are the trailing decimals treated correctly only for Thailand?

@adisidev
Copy link
Collaborator Author

The decimal being absent would mean Brunei's population becomes 451. Our current assumption is that if there is a decimal point at the end followed by 3 numbers, we should treat it as a separator not a decimal. (101.589 --> 101,589, but 70.33 --> 70.33. Similarly, 5.978 --> 5,978)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants