|
Did you know that both 1 < double.NaN and 1 > double.NaN are false?!
|
|
|
|
|
I thought Julian Assange had called off his latest announcement of new WikiLeak content: [^].
Revelations like this, calling into question the entire structure of the way we view reality and the code tools we use to model it, is going to really shake things up.
The thought of the vast infinite hordes that NaN could mobilize and unleash on Primes and NotPrimes and SubPrimes ... frightening. I'm going to start building my bunker, now.
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
Doom is upon us!
Or will be anytime soon now!
|
|
|
|
|
I know, which makes its behavior in Min and Max even more random
Although, as it turns out, it's not random at all. Min and Max just treat NaN as lower than anything else.
|
|
|
|
|
You need to check for NaN before passing to min/max and eventually root out them by code.
What happened to the simple rule of checking for unexpected/invalid values before using them? Does everybody now cross the streets without looking, eventually launching an exception if hit by a car?
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
|
|
|
|
|
den2k88 wrote: What happened to the simple rule of checking for unexpected/invalid values before using them? Now you're talking a religion of which I am a true believer ! So many questions on C# QA could be answered by the posters, themselves, if they had learned to check input values before calling them, and how to use a debugger.
I am also in favor of disabling, or hiding, UI controls that are irrelevant to the current context, or which would create errors if clicked, or, which should only be used after specific action(s) by the user.
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
BillWoodruff wrote: I am also in favor of disabling, or hiding, UI controls that are irrelevant to the current context, or which would create errors if clicked, or, which should only be used after specific action(s) by the user. Absolutely. Even when I start not doing so I end up fixing it because during the tests I elephant up myself.
The real problem is that noone programs anymore: now there are frameworks! Never release resources anymore, there is The Framework. Never think about what you have to do, The Framework has already a solution for you! If the solution is not right for your problem, modify the problem! Don't write your components: The Framework is better and there's no discussion on it!
The Framework weights several hundred megabytes, has its own version of DLL hell which is not called Dll hell, can cease backwards compatibility every moment and lose its support or be replaced by The Next Framework, which is better! And incompatible. And so on so forth...
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
|
|
|
|
|
I'm writing the function that will be called by users that didn't check their input.
At least I should know how to handle their crap
|
|
|
|
|
Remember that not only the users can insert unacceptable values but that other parts of your code can produce them. Either you're 100% sure that to some point in your code the values are all ammissible or you check them, or you document that the values must be checked beforehand.
For example I made some extrafast buffer rotation procedures in Assembler (we needed them) and they crash if the number of columns is not a multiple of 64. Since checking each time the function is called would lower the extra speed it is clearly documented to make sure the buffers are allocated in 64 colums multiples. Otherwise I should check them.
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
|
|
|
|
|
IIRC, IEEE Std 754-2008 does define a set of recommended functions, including min() and max() of a vector of numbers. C# still uses IEEE Std 754-1985, so they have their own, quirky, handing of min() and max().
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
... it was announced in 2013, and I don't think you can buy it, but...
Remember Ring[^]
If you have a problem remembering the anniversary or her birthday, this could save your life (or worse, your marriage).
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Hey good idea! matter of interest you didn't forget herselfs birthday did you
|
|
|
|
|
No chance: January 1st.
Which makes it impossible to forget, but a PITA to find a good present for that close to Crimble...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I feel your pain. The D is 27 December and impossible if you don't opt for alcohol based gifts. Luckily I take after him.
veni bibi saltavi
|
|
|
|
|
A couple of hours you say? This 'couple' is akin to going to have a 'couple' of beers. I just can't accept that after two days it can still be called as a couple of hours of slowness.
veni bibi saltavi
|
|
|
|
|
Canadian hours!
They pass more slowly than hours in the rest of the world. A bit like sitting in a History lesson when you were a kid...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
14 laments the fact that history lessons are too short! One cousin just graduated with a 1st in History, another is reading History at the moment and she loves it and hopes to take it on to degree level and maybe further.
What is it with these girls? Not one of them* can write even the simplest program!
* Daughter and nieces, not girls in general.
veni bibi saltavi
|
|
|
|
|
Okay, did you send the financial information necessary for the site to transfer your refund to you ?
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
Sorry - forgot to unpin.
And then I hopped on a plane to Australia.
No, I'm not kidding. (And sorry Mr Martin, no beers because I've only got a few days in Melbourne before I'm hauled, kicking and screaming, back to Canadia)
cheers
Chris Maunder
|
|
|
|
|
Wait, what?! If you're in Melbourne, the beer thing is to be done with me because I'm in Melbourne now.
Seriously though, let me know and we could catch up over a cuppa.
|
|
|
|
|
A cuppa would be great. Which part of town?
Email me and we'll sort something out.
cheers
Chris Maunder
|
|
|
|
|
So I setup a new website out there and it does not contain any user specific information but it is in finance space. Anyone can use it without registering or providing any private information. I can see in IIS log that there are lot of 404 calls as if someone is trying to access site's back-end via various urls which does not exists. https://s11.postimg.org/hiq7mfqg3/IIS_LOG.png[^] One thing is sure that they are not going to get anything because I don't have any user specific information but I am thinking of adding some new features which will be user specific later. Should I be worried ? Any suggestions ?
Zen and the art of software maintenance : rm -rf *
Maths is like love : a simple idea but it can get complicated.
|
|
|
|
|
Set up a honeypot for them to find and let them waste their time attacking that?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Why is it a honeypot, no one really likes homey that much. Now a gin bottle ...
veni bibi saltavi
|
|
|
|
|
Flies like honey. Hackerz are like Fliez...
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|