Click here to Skip to main content
15,881,173 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: The Decline and Fall of Search Engines Pin
Member 133016798-Jan-21 7:19
Member 133016798-Jan-21 7:19 
GeneralRe: The Decline and Fall of Search Engines Pin
W Balboos, GHB8-Jan-21 7:59
W Balboos, GHB8-Jan-21 7:59 
GeneralRe: The Decline and Fall of Search Engines Pin
Member 133016798-Jan-21 8:44
Member 133016798-Jan-21 8:44 
GeneralRe: The Decline and Fall of Search Engines Pin
W Balboos, GHB8-Jan-21 9:16
W Balboos, GHB8-Jan-21 9:16 
GeneralRe: The Decline and Fall of Search Engines Pin
Member 133016798-Jan-21 9:42
Member 133016798-Jan-21 9:42 
GeneralRe: The Decline and Fall of Search Engines Pin
W Balboos, GHB11-Jan-21 3:04
W Balboos, GHB11-Jan-21 3:04 
GeneralRe: The Decline and Fall of Search Engines Pin
Daniel Will9-Jan-21 4:30
Daniel Will9-Jan-21 4:30 
GeneralRe: The Decline and Fall of Search Engines Pin
W Balboos, GHB11-Jan-21 2:34
W Balboos, GHB11-Jan-21 2:34 
Instead of dogma, do the tests I noted: how large is the difference in the example given? When would it (ever) show up in a result? Retail sales and financial institutions both deal in money/curacy, but not in the same way.

Well - I happened to have my SQL open and here's a test, done for you:
SQL
DECLARE @a float = 0.1
DECLARE @b float = 0.2
DECLARE @c float = 0.3
SELECT  @c-@a-@b

Result:
-2.77555756156289E-17

Now, you tell me how this would effect retail when prices are rounded to 1E-2 ?

Sure - you can work out a unique scenario. Note, too, that when I did it like this:
SELECT (0.3 - (0.2+0.1) ) I got 0.0 as the result
Also, if I declared a DECIMAL (instead of FLOAT) I get zero.

Am I saying that FP doesn't suffer from a loss of precision due to the inability to represent most non-whole-numbers precisely? NO. I'm saying that for practical use, in normal business environment, the loss would never show. Comparisons - done after rounding - would work fine. Indeed, even in the most precise decimal representation, if some item is priced at 3 for $1, how much does one cost? How is that represented? An infinite number of 3's or a round off error? If you buy the 3 items as 3 separate line items, does it now equal $1.00? Yes? The system has rules to handle it. No? Then you have gained nothing in a retail scenario, except the more CPU-intensive processing.



[edit]
These values eventually need to be stored: what data type do you use in MS SQL Server ?
[/edit]
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


modified 11-Jan-21 9:00am.

GeneralRe: The Decline and Fall of Search Engines Pin
Frank Malcolm8-Jan-21 10:40
Frank Malcolm8-Jan-21 10:40 
GeneralRe: The Decline and Fall of Search Engines Pin
Member 133016798-Jan-21 11:16
Member 133016798-Jan-21 11:16 
GeneralRe: The Decline and Fall of Search Engines Pin
Frank Malcolm8-Jan-21 15:17
Frank Malcolm8-Jan-21 15:17 
GeneralRe: The Decline and Fall of Search Engines Pin
Member 133016799-Jan-21 0:04
Member 133016799-Jan-21 0:04 
GeneralRe: The Decline and Fall of Search Engines Pin
W Balboos, GHB10-Jan-21 2:43
W Balboos, GHB10-Jan-21 2:43 
GeneralRe: The Decline and Fall of Search Engines Pin
StarNamer@work21-Jan-21 4:36
professionalStarNamer@work21-Jan-21 4:36 
GeneralRe: The Decline and Fall of Search Engines Pin
Member 132567508-Jan-21 5:25
Member 132567508-Jan-21 5:25 
GeneralRe: The Decline and Fall of Search Engines Pin
20212a7-Jan-21 1:46
20212a7-Jan-21 1:46 
GeneralRe: The Decline and Fall of Search Engines Pin
W Balboos, GHB7-Jan-21 1:49
W Balboos, GHB7-Jan-21 1:49 
GeneralRe: The Decline and Fall of Search Engines Pin
Daniel Pfeffer7-Jan-21 3:41
professionalDaniel Pfeffer7-Jan-21 3:41 
GeneralRe: The Decline and Fall of Search Engines Pin
qmartens8-Jan-21 19:45
qmartens8-Jan-21 19:45 
GeneralRe: The Decline and Fall of Search Engines Pin
qmartens8-Jan-21 19:45
qmartens8-Jan-21 19:45 
GeneralRe: The Decline and Fall of Search Engines Pin
Paul Kemner7-Jan-21 4:35
Paul Kemner7-Jan-21 4:35 
GeneralRe: The Decline and Fall of Search Engines Pin
dandy727-Jan-21 4:22
dandy727-Jan-21 4:22 
GeneralRe: The Decline and Fall of Search Engines Pin
W Balboos, GHB7-Jan-21 4:29
W Balboos, GHB7-Jan-21 4:29 
GeneralRe: The Decline and Fall of Search Engines Pin
dandy727-Jan-21 5:03
dandy727-Jan-21 5:03 
GeneralRe: The Decline and Fall of Search Engines Pin
Mike Winiberg7-Jan-21 22:15
professionalMike Winiberg7-Jan-21 22:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.