There is no reason to use float for counting votes. You only need to do addition or in rare case subtraction.
Unless, there's a weighting operation where you multiply with fraction. Hmmmm... Even then you can easily recast the result back to integer. These people are really dumb.
Raw amounts should always be in integers, and unsigned if your language supports it.
Yet I see programs all the time where they just use a float or double for these sorts of things. Programming is not being taught correctly in many places.
"Pass a pointer to a curl_off_t to receive the total amount of bytes that were downloaded."
A curl_off_t is an unsigned integer. Which is a more sensible variable type.
Voting machine source code should be 100% open and auditable and ensured it's not written by amateur programmers who cannot even get basic data types right.
However, over here it's not a bug, it's a feature. These voting machines allow for tabulating "weighted votes" in which case the result is using a floating point decimal.
Can you imagine any amateur coder using a floating point decimal to store vote tallies? That shit is the biggest red flag off the bat.
There is no reason to use float for counting votes. You only need to do addition or in rare case subtraction.
Unless, there's a weighting operation where you multiply with fraction. Hmmmm... Even then you can easily recast the result back to integer. These people are really dumb.
Raw amounts should always be in integers, and unsigned if your language supports it.
Yet I see programs all the time where they just use a float or double for these sorts of things. Programming is not being taught correctly in many places.
Here's an example of a major program with this error, libcurl: https://curl.se/libcurl/c/CURLINFO_SIZE_DOWNLOAD.html
"Pass a pointer to a double to receive the total amount of bytes that were downloaded."
Since it's an amount, double is definitely wrong.
It continues: "CURLINFO_SIZE_DOWNLOAD_T is a newer replacement that returns a more sensible variable type."
That function is described here: https://curl.se/libcurl/c/CURLINFO_SIZE_DOWNLOAD_T.html
"Pass a pointer to a curl_off_t to receive the total amount of bytes that were downloaded."
A curl_off_t is an unsigned integer. Which is a more sensible variable type.
Voting machine source code should be 100% open and auditable and ensured it's not written by amateur programmers who cannot even get basic data types right.
However, over here it's not a bug, it's a feature. These voting machines allow for tabulating "weighted votes" in which case the result is using a floating point decimal.
See this video explaining that this feature is included in voting machines and some of the algorithms backing it up: https://www.youtube.com/watch?v=Ztu5Y5obWPk