€12.00 × 2 = ?
-
Came across this today when trying to order something online:
-
The old "overcharge all customers by one cent" scam.
-
@anonymous234 said in €12.00 × 2 = ?:
The old "overcharge all customers by one cent" scam.
Otherwise known as "floating point works fine!"
-
@anonymous234 said in €12.00 × 2 = ?:
The old "overcharge all customers by one cent" scam.
Didn't they do that in Superman II?
-
@dcon said in €12.00 × 2 = ?:
@anonymous234 said in €12.00 × 2 = ?:
The old "overcharge all customers by one cent" scam.
Otherwise known as "floating point works fine!"
I'm not aware of a floating point format that can't accurately represent 12.
-
@ben_lubar said in €12.00 × 2 = ?:
@dcon said in €12.00 × 2 = ?:
@anonymous234 said in €12.00 × 2 = ?:
The old "overcharge all customers by one cent" scam.
Otherwise known as "floating point works fine!"
I'm not aware of a floating point format that can't accurately represent 12.
What about 12.0025?
-
@dangeruss said in €12.00 × 2 = ?:
@ben_lubar said in €12.00 × 2 = ?:
@dcon said in €12.00 × 2 = ?:
@anonymous234 said in €12.00 × 2 = ?:
The old "overcharge all customers by one cent" scam.
Otherwise known as "floating point works fine!"
I'm not aware of a floating point format that can't accurately represent 12.
What about 12.0025?
Best I can do is 12.0024999999999995026200849679298698902130126953125.
-
@ben_lubar said in €12.00 × 2 = ?:
I'm not aware of a floating point format that can't accurately represent 12.
How about 7, 10, 19.50, or 25.50,? The site I ordered it from has various things priced at €7.00 as well as €7.01, €19.50 and €19.51, etc. I doubt the pricing is like that deliberately, but I have a hard time thinking of a reason why some items would have “correct” pricing and others are one cent off.
Oh, and it also has
<span class="unvisible">
:)
-
@gurth said in €12.00 × 2 = ?:
@ben_lubar said in €12.00 × 2 = ?:
I'm not aware of a floating point format that can't accurately represent 12.
How about 7, 10, 19.50, or 25.50,? The site I ordered it from has various things priced at €7.00 as well as €7.01, €19.50 and €19.51, etc. I doubt the pricing is like that deliberately, but I have a hard time thinking of a reason why some items would have “correct” pricing and others are one cent off.
Oh, and it also has
<span class="unvisible">
:)In binary formats, numbers ending in .00, .25, .50 and .75 can be represented exactly (unless the amount is ridiculously large). Other numbers of cents require rounding.
Maybe it's because the displayed price is the result of some calculation (like adding VAT), so it's already rounded in binary.
-
@gurth said in €12.00 × 2 = ?:
Oh, and it also has
<span class="unvisible">
:)
-
Could this be caused by how they calculate the VAT amount?
(i.e. calculating a tax value for total qty of items instead of each item)If an item has a 23% tax, the price is €9.76 before tax, or €12 (12.0048) with it.
For two items, that's €19.52 without tax, and after adding the 23% you get €24.01 (24.0096).
-
@ben_lubar said in €12.00 × 2 = ?:
@dcon said in €12.00 × 2 = ?:
@anonymous234 said in €12.00 × 2 = ?:
The old "overcharge all customers by one cent" scam.
Otherwise known as "floating point works fine!"
I'm not aware of a floating point format that can't accurately represent 12.
How about decimal floating point numbers?
-
@gąska They exist (the type is called Decimal in .NET, for instance), but not all languages support them, and the most commonly used formats are the binary ones (even though any calculations that involve money should be done in decimal).
-
@khudzlin said in €12.00 × 2 = ?:
@gąska They exist (the type is called Decimal in .NET, for instance), but not all languages support them
Define "support". It's entirely possible to use decimal type everywhere you need it in every Turing-complete language.
-
@gąska said in €12.00 × 2 = ?:
Define "support". It's entirely possible to use decimal type everywhere you need it in every Turing-complete language.
Having a dedicated type included in the language.
-
@khudzlin no they don't. But it only makes them marginally more difficult to use.
-
@timmytime said in €12.00 × 2 = ?:
Could this be caused by how they calculate the VAT amount?
Though that makes a lot of sense, it still doesn’t explain why some prices are listed as (for example) €7.00 and others as €7.01. It’s a Belgian site, BTW, so VAT is 21%. 7.00 ÷ 1.21 = 5.785124; maybe they entered some prices as €5.78 (making €6.9938 including VAT) and others as €5.79 (making €7.0059).
-
@gurth said in €12.00 × 2 = ?:
Though [inclusion of vat calcs] makes a lot of sense, it still doesn’t explain why some prices are listed as (for example) €7.00 and others as €7.01.
Because they couldn't decide if it's a biscuit or cake so didn't know whether VAT was 20% or 0%?
-
@pjh Unlikely, given the products the site sells. None of it would fall into the “necessities” category unless you have a diet in which polyurethane resin features prominently.
-
@pjh said in €12.00 × 2 = ?:
@gurth said in €12.00 × 2 = ?:
Though [inclusion of vat calcs] makes a lot of sense, it still doesn’t explain why some prices are listed as (for example) €7.00 and others as €7.01.
Because they couldn't decide if it's a biscuit or cake so didn't know whether VAT was 20% or 0%?
I've overheard long discussions between @Joel and some other people in Sausagefest about the legal status of Jaffa cakes.