Wikipedia:Reference desk/Archives/Computing/2012 December 29

Computing desk
< December 28 << Nov | December | Jan >> December 30 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


December 29

edit

New tablets

edit

Does anyone know exactly when manufacturers are going to publicly announce new tablet models for 2013? 74.15.143.46 (talk) 06:15, 29 December 2012 (UTC)[reply]

Quite a number have already been launched for the 2012 holiday season. Those that will be launched only in 2013 will obviously not be launched for another two days. ¦ Reisio (talk) 23:36, 29 December 2012 (UTC)[reply]

C++ double comparison

edit

Suppose you have this C++ function:

void func(double a, double b) {
 if (a > b) do something;
 else if (a <= b) do something else;
 else do 3rd thing;
}

Does C++ guarantee that the "3rd thing" will never be done? Is it ever possible, due to numerical error, that neither a>b nor a<=b are satisfied? --140.180.249.194 (talk) 10:00, 29 December 2012 (UTC)[reply]

That's an astute question; it's always wise to think hard about how floating point number comparisons work. What your question amounts to is whether IEEE double precision floating point numbers form a strictly ordered set. As the floating point article says, they almost do - " Finite floating-point numbers are ordered in the same way as their values (in the set of real numbers)". That leaves special values NaN, -ve infinity, and +ve infinity. And here's the rub. NaN is not < NaN, > NaN, or even == Nan. As the NaN article says "A comparison with a NaN always returns an unordered result even when comparing with itself". So if you pass 0.0/0.0 (which is NaN) as both either of the arguments to your function, it will do the third thing. -- Finlay McWalterTalk 10:52, 29 December 2012 (UTC)[reply]
Exactly. And in the more general case, you can overload the operators with any binary relation. It's not a good idea to overload > and <= independently, but there is nothing in the language to stop you. --Stephan Schulz (talk) 11:13, 29 December 2012 (UTC)[reply]
Unequal comparisons are a slight variation on the rule, they are treated exactly the same as not equal so the idiom (x != x) { NaN case } works okay. Only the equals and unequal comparisons are guaranteed to not signal if a signalling rather than quiet NaN is given to them. Dmcq (talk) 13:29, 29 December 2012 (UTC)[reply]
not terribly familiar with C++ but what happens with null/missing variables? in some languages, if either or both variables are null/missing, a comparison would fail >, <, and =, and fire the third thing. Gzuckier (talk) 04:14, 31 December 2012 (UTC)[reply]
The only imprecision in IEEE 754 floating point calculations is in the rounding, and comparisons don't involve any rounding, so it's impossible for < and ≥ to give inconsistent answers due to numerical error. I'm not 100% sure the C++ standard guarantees this, though. -- BenRG (talk) 04:44, 1 January 2013 (UTC)[reply]

Apple business strategy

edit

Why did Apple release a new ipad in November so soon after they releases one in March? Some say it's to capitalise on the christmas season and others say its to change to a bi-annual product release cycle to compete better with other manufacturers. But at the same time launching all their major products so close to each other towards the end of the year would take away the hype a bit. Tbo 157(talk) 22:19, 29 December 2012 (UTC)[reply]

It's not necessarily intentional. Some projects get delayed while others are on-time. They could intentionally hold up a release to space them out better, but technology changes so rapidly, that would risk depreciating their product. StuRat (talk) 23:00, 29 December 2012 (UTC)[reply]
Apple has a long history of releasing newer/better/improved products at an interval short enough to annoy the less wealthy consumers of their products. :p Realistically there is likely no interval that would both annoy no one and not be competitive business suicide. ¦ Reisio (talk) 23:39, 29 December 2012 (UTC)[reply]