|
Quote: I am using an OOP language, but probably not one that you use. Delphi
Hah Not quite ...
While not an expert, I've done a few desktop GUI projects in Lazarus recently (2018). I chose Lazarus over Delphi because my primary target was Linux and Delphi had poor-to-non-existent support for Linux, *BSDs, etc.
Besides, Lazarus appears to be in active development while Delphi development has stagnated in recent years.
|
|
|
|
|
The points are somewhat well known - but you then need to think of the situation in actual practice.
Work on a typical bill for online sales. "Pretend prices are stored as FP values"
Now generate an order. What you have is, almost invariably, a series of two-digit prices that are, indeed, subject to round-off errors. As you calculate the bill, you can add to or diminish item-counts and the price recalculated. When an amount reaches 0 (a uniquely annoying case as presented by the comment you responded to), it's 0 (an integer, by the way) * the price. This would be equal to true 0. For those that are not zeroed, there will, in general, be a round-off error in the representations. These will ultimately all be represented in the total. The total, however, is always rounded to a (for most currencies) a 2-decimal value (for Yen, as an example, they could possibly use integers?). So - if you consider the magnitude of the accumulated round-off errors, how will they effect the value in the second decimal place after rounding?
The reality, in a Real World Transaction, is that the given example using 0.1, 0.2, and 0.3 displays the error but does not display a retail reality: By how much do they actually differ in YOUR system? That is, (0.1 +0.2) - 0.3 = how much? Not zero? Correct! How close to even .01 does it get, that is, the smallest unit of currency?
Indeed, in the financial world, with money in the billions and even trillions of units, the errors can accumulate to real amounts (for each transaction, and this could be exploited). Possibly a uniquely bad problem in currency exchange markets.* But my point was about a business, even as large as Amazon, where transactions errors are trivial compared to the round-off point, and, at least where I live, they charge sales taxes - which themselves are number that essentially always result in fractional parts of currency and rounding. Frequently very close to that .005 of a unit.
With a transaction load as vibrant as amazons, the overhead in the precise representation vs. FP "native" types can add up. For a Point-of-Sale system I created quite some years ago, customers included Australian business: they currency is calculated in .01 $Aus units but the smallest coin was .05 $Aus. I needed to handle this, including possible refunds and unwinding/recalculating final bills after changes. Do you really think the difference is the 10th decimal place for a dry-cleaning bill will be significant by comparison? Especially, for the full-wide scope, with various regional taxes, environmental fees, &etc. multiplying these as well? Indeed, every step accumulate a tiny bit of error - and when the calculations were done and it went to the accountants, it was already "severely" modified to the nearest .01 (or, .05 ). That was what was paid/billed.
Solving a problem . . . requires a judicious balance between (alleged) best practices and the realities imposed by resources. If you're not working in an industry that requires specific data model by statute then you should read "Best Practices" as a recommendation and not the only way to do something. 'Best' is not at all the same as 'only'. That's where the thinking comes in.
* On such markets, even currencies that do not have decimal sub-units are, nonetheless, traded out to several decimal places. At this particular moment, the US$ is worth 103.9490 Japanese Yen. How much would a retail transaction in an online store have to buy for you to worry about the round-off errors if FP vs one of the other options? And what if stored as the integer (1039490), then final result divided by 10000 when done?
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Member 13301679 wrote: Quote: 2 - Store as string values -
That's also not how it's done. Currencies have to be stored as a fixed-numeric type.
Not strictly true. When I worked on SAP, it stored currency values as fixed length numeric strings. Similar to fixed-numeric type, but using characters rather than a binary type to avoid any issue with the underlying nature of binary storage (e.g. big-endian vs. little-endian).
|
|
|
|
|
Where are the packed decimal instructions when you need them.
|
|
|
|
|
W∴ Balboos, GHB wrote: How does that explain the hand sanitizer? Face Masks? Sandpaper? Those are items needed everywhere you go and anywhere you are so it makes sense that anything you are searching for would also need those related items.
|
|
|
|
|
Makes perfect sense . . . if the toilet paper is gone you can use the sandpaper.
Brilliant deduction !
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
W∴ Balboos, GHB wrote: if the toilet paper is gone you can use the sandpaper.
... and then spray the hand sanitizer on the affected area?
(ouch)
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
I don't disagree, but when I want to buy a "4S 850 mAh 95 C" LiPo battery for one of my racing/freestyle drones, it gets really annoying that the only batteries with the specs I actually specified are on, like, page 9, 15, and 22 of the search results. I miss Alta Vista.
Eagles my fly, but weasels don't get sucked into jet engines.
|
|
|
|
|
I don't disagree, but when I want to buy a "4S 850 mAh 95 C" LiPo battery for one of my racing/freestyle drones, it gets really annoying that the only batteries with the specs I actually specified are on, like, page 9, 15, and 22 of the search results. I miss Alta Vista.
Eagles my fly, but weasels don't get sucked into jet engines.
|
|
|
|
|
eBay has this great "feature" that if you search for "stuff I want" -"ugly rotten crap" you will get emails for "the ugly rotten crap you're looking for".
The minus works on search results, but then they recommend what you excluded.
|
|
|
|
|
John C. Dvorak, long-time PC Mag columnist (who, in his own words, got unceremoniously deplatformed for his views on 5G), had a great article on this sort of thing a good while ago. As I recall he referred to it as the big data lie. Basically, it amounts to this:
They have access to the largest purchasing history database in the world, yet the best they can do is, after you've bought a hat, start showing you ads for hats.
AI has a long way to go.
|
|
|
|
|
dandy72 wrote: he best they can do is, after you've bought a hat, start showing you ads for hats. Now, for any normal logic, one would realize you just bought that so you won't need one for a while. However,
perhaps their marketing is run by women and they feel that if you just bought shoes (in particular) then you obviously want to buy more shoes. In their minds it absolutely logical.
Deep down in side, the all idolize Amelda Marcos[^].
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
W∴ Balboos, GHB wrote: Now, for any normal logic, one would realize you just bought that so you won't need one for a while.
Exactly
W∴ Balboos, GHB wrote: perhaps their marketing is run by women and they feel that if you just bought shoes (in particular) then you obviously want to buy more shoes. In their minds it absolutely logical.
I would've said that's the marketing approach and not have made such a general, sexist comment, but given your example...I have no counterargument.
I only have two feet. I think I own 3 pairs of shoes, including a pair of winter boots, and a pair of dress shoes I haven't had a reason to wear in about a decade. Ok, make that 4, if slippers count.
|
|
|
|
|
Indeed - how many new cars can you buy one after the other (facebook after I bought a car - and how did it even find out given that I bought it in person, the internet wasn't involved)? How many new projectors do you need (Amazon after I bought one)?
I don't think Skynet is quite ready yet - and if it is, would probably drop megatons of sanitary products on women and "men's" products on men.
8)
I can't believe it would be difficult to tell the AI to ignore non-consumable products for a while after you bought them, rather than instantly assuming you are buying them for the entire population of your home country.
|
|
|
|
|
I often find it easier to bypass their search altogether and use a search engine. E.g. 1/16" FOOBARS site:amazon.com
|
|
|
|
|
Your proposal seemed like an interesting option so I tried it with a recent shopping event. The listing I got was difficult to use (no sorting or anything) - so I modified the search by clicking the shopping link. At that point, site:amazon.com was no longer part of the picture.
Deja-vu all over again.
Too bad.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Amazon search has a lot of room for improvement. They could learn a lot from Craigslist which has a pretty thorough syntax. You can't add "not" to Amazon searches to weed out the noise. I was searching for 4 cell LiPos and had no way to filter out the 2S, 3S, 6S. There are a lot of 3S to wade through!
I think Amazon had "not" and "and" syntax at one time but took it away? I could be mis-remembering.
Not to say Craigslist is perfect. Used car dealers know how to make their crap shows up show up for stuff you really don't want to see by adding a block of "keywords". Interestingly, it is hidden on the mobile search but you can see it on the desktop browser experience. Just add another "not" clause and you're good to go. I'd think that Craigslist could easily detect these and keep them from being posted.
|
|
|
|
|
Shmoken99 wrote: You can't add "not" to Amazon searches to weed out the noise Actually you can:
"4 cell LiPo" -2S Will look for exact text, and exclude results with "2S" in them.
I've been using it for years!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Funny enough, my buddy and I where on about this a little while back.
It's NOT just the shopping sites, but the search experience in general, to whit, we came to the conclusion they are just NOT trying as hard as they used to, and are more interested (Esp the main search engines outside the market places) in putting results in front of you that they hope will lead you to buy things.
I've lost count of the amount of searches in "Bing" and "Google" where I have been really, really specific, I mean
"this phrase" AND "that phrase" "keyword" "keyword" "keyword"
specific.
And got back either a bunch of shopping results, or an instant "sorry nothing found and where not even gonna try" response.
There was a time, when (Particularly with google) you could put in a general query, then spend a few minutes tweaking it, by enclosing some things in quotes and using operators like the minus symbol to exclude stuff, or filetype:xxx domain:blah.blah to filter stuff out you didn't want.
And you could tell that your tweaking was doing a more through search because it took noticeably longer.
Even google them selves documented it at one point stating that "if you fine tune your search, it cause the search engine to do a deeper more intensive search, that often reveals hits not in the general index"
Now however, I'm increasingly seeing tweaks like this being ignored. Don't want those ads for some product or other to appear try -"keyword" and watch the ad still appear along with more just like it.
It feels largely like the search engines leave the syntax in to make folks think they have control, but they ignore it anyway in favour of potential money making hits.
|
|
|
|
|
Maybe it's an audience assessment thing:
People live in a world of ignorance because their hand-held device is connected right to google. The "need to know" doesn't seem to be an interest, let a lone an imperative.
By this, I mean, they don't need to know anything since they can ask someone (something) to look it up for them. They take what they get - without question. That's the beauty of the system, a "closure" if you wish: the less you know the more you need them and the less capable you are to realize they're ing with you.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
@GregUtas
Where is the CCC?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
|
These idiots were running around the Capitol in full view - and ironically because they detest the COVID face mask orders - so the datasets will be there to compare against. I wonder if they even remotely understand how the mathematics of eigenvalues will put them in prison.
|
|
|
|
|
|