{"id":753,"date":"2006-06-23T16:17:00","date_gmt":"2006-06-23T21:17:00","guid":{"rendered":"http:\/\/www.starkeith.net\/coredump\/?p=753"},"modified":"2009-06-11T18:28:39","modified_gmt":"2009-06-11T22:28:39","slug":"when-n","status":"publish","type":"post","link":"https:\/\/www.starkeith.net\/coredump\/2006\/06\/23\/when-n\/","title":{"rendered":"When n&lt;0 won&#8217;t do"},"content":{"rendered":"<p>I found this classic &#8220;WTF&#8221; example over at a site called <a href=\"http:\/\/thedailywtf.com\">The Daily WTF<\/a>:<\/p>\n<div class=\"ForumPostBodyArea\">\n<div class=\"ForumPostContentText\" id=\"_ctl0__ctl1_bcr__ctl0___PostRepeater__ctl1_PostViewWrapper\">\n<blockquote><p>This isn&#8217;t the <a href=\"http:\/\/thedailywtf.com\/archive\/2004\/08\/12\/1063.aspx\">first time<\/a> we&#8217;ve seen programmers having a difficult time gasping the intricacies of negative numbers. Heck, I&#8217;m sure we all had a little difficulty understanding at first, in the fifth grade. But you&#8217;d really think that someone able to program (am I giving too much credit here?), would have a little more sophistication than to distinguish positive and negative numbers with the \u201clittle line thing\u201c in prefixing the number.<\/p><\/blockquote>\n<blockquote style=\"margin-right: 0px\" dir=\"ltr\">\n<pre style=\"color: #000000\"><span style=\"color: #008200\">\/\/return whether a double is negative<\/span> <span style=\"color: #0000ff\">bool<\/span> IsNegative(<span style=\"color: #0000ff\">double<\/span> n)\r\n{\r\n<span style=\"color: #0000ff\">string<\/span> nStr = n.ToString();\r\n<span style=\"color: #0000ff\">if<\/span> (nstr.IndexOf('-', 0, 1)) <span style=\"color: #0000ff\">return<\/span> <span style=\"color: #0000ff\">true<\/span>;\r\n<span style=\"color: #0000ff\">return<\/span> <span style=\"color: #0000ff\">false<\/span>;\r\n}<\/pre>\n<\/blockquote>\n<blockquote><p>I must say, I do appreciate the irony that many students shy away from Computer Science because they fear the complicated math. If only they knew.<\/p><\/blockquote>\n<\/div>\n<\/div>\n<p>I literally sat stunned for a full minute after seeing this.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This isn&#8217;t the first time we&#8217;ve seen programmers having a difficult time gasping the intricacies of negative numbers. But you&#8217;d really think that someone able to program (am I giving too much credit here?), would have a little more sophistication than to distinguish positive and negative numbers with the &#8220;little line thing&#8221; in prefixing the number.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"webmentions_disabled_pings":false,"webmentions_disabled":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_post_was_ever_published":false},"categories":[5],"tags":[],"class_list":["post-753","post","type-post","status-publish","format-standard","hentry","category-technology","entry"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pimUj-c9","jetpack-related-posts":[{"id":1017,"url":"https:\/\/www.starkeith.net\/coredump\/2008\/01\/04\/on-being-a-programmer-in-a-world-of-non-programmers\/","url_meta":{"origin":753,"position":0},"title":"On Being a Programmer in a World of Non-Programmers","author":"Keith Survell","date":"January 4, 2008","format":false,"excerpt":"This post over at The Daily WTF struck a chord with me. I can definitely feel the pain of trying to explain programming to non-programmer \u2013 or even just explaining what it is I do. Most times, I just get blank stares. To most people, \"I work with computers\" is\u2026","rel":"","context":"In &quot;Rants&quot;","block_context":{"text":"Rants","link":"https:\/\/www.starkeith.net\/coredump\/category\/rants\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5869,"url":"https:\/\/www.starkeith.net\/coredump\/2022\/11\/14\/mental-multitasking\/","url_meta":{"origin":753,"position":1},"title":"Mental Multitasking","author":"Keith Survell","date":"November 14, 2022","format":false,"excerpt":"There is a common stereotype of programmers, which is that they are inherently good at multitasking due to the type of work we do. The idea is that you're dealing with all sorts of things at once - the analogy of \"juggling chainsaws\" is often mentioned, as is how disruptive\u2026","rel":"","context":"In &quot;personal&quot;","block_context":{"text":"personal","link":"https:\/\/www.starkeith.net\/coredump\/category\/personal\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1462,"url":"https:\/\/www.starkeith.net\/coredump\/2008\/11\/03\/a-programmers-perspective-on-politics\/","url_meta":{"origin":753,"position":2},"title":"A Programmer&#8217;s Perspective on Politics","author":"Keith Survell","date":"November 3, 2008","format":false,"excerpt":"Election time always finds me musing on the nature of politics. Of course I must admit that being a computer programmer colors my view of the whole process more than just a little bit. I mean, I know that the political process in this country is one that has evolved\u2026","rel":"","context":"In &quot;politics&quot;","block_context":{"text":"politics","link":"https:\/\/www.starkeith.net\/coredump\/category\/politics\/"},"img":{"alt_text":"Image courtesty Flikr user umjanedoan","src":"https:\/\/i0.wp.com\/www.starkeith.net\/coredump\/wp-content\/uploads\/\/2008\/11\/really-old-law-books.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1212,"url":"https:\/\/www.starkeith.net\/coredump\/2008\/07\/19\/the-quixotic-quest-for-invulnerability\/","url_meta":{"origin":753,"position":3},"title":"The Quixotic Quest for Invulnerability","author":"Keith Survell","date":"July 19, 2008","format":false,"excerpt":"Schneier on Security: Homeland Security Cost-Benefit Analysis. A very worthwhile read - basically: The premises: The number of potential terrorist targets is essentially infinite. The probability that any individual target will be attacked is essentially zero. If one potential target happens to enjoy a degree of protection, the agile terrorist\u2026","rel":"","context":"In &quot;politics&quot;","block_context":{"text":"politics","link":"https:\/\/www.starkeith.net\/coredump\/category\/politics\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1283,"url":"https:\/\/www.starkeith.net\/coredump\/2008\/08\/11\/music-to-code-by\/","url_meta":{"origin":753,"position":4},"title":"Music to Code By","author":"Keith Survell","date":"August 11, 2008","format":false,"excerpt":"I read a post over at Coding Horror today about \"Music to (Not) Code By,\" and it got me thinking about the music I code by - which, let me just say, is not anything like the music mentioned in Jeff's article! There's always been a sort of unspoken rule\u2026","rel":"","context":"In &quot;My Life&quot;","block_context":{"text":"My Life","link":"https:\/\/www.starkeith.net\/coredump\/category\/personal\/my-life\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1288,"url":"https:\/\/www.starkeith.net\/coredump\/2008\/08\/15\/horsepower-and-torque\/","url_meta":{"origin":753,"position":5},"title":"Horsepower and Torque","author":"Keith Survell","date":"August 15, 2008","format":false,"excerpt":"We're thinking about getting a second car - Yay! We've been looking rather longingly at the Mazda3 5-door. But when I look at the numbers, I get a little... confused. Mazda 3 (2008 5-door) Outlander (2003 AWD) 2983 lbs 3461 lbs 4.8 inches ground clearance 8.3 inches ground clearance Fully\u2026","rel":"","context":"In &quot;Cars and Trucks&quot;","block_context":{"text":"Cars and Trucks","link":"https:\/\/www.starkeith.net\/coredump\/category\/cars-and-trucks\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/posts\/753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/comments?post=753"}],"version-history":[{"count":0,"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/posts\/753\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/media?parent=753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/categories?post=753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.starkeith.net\/coredump\/wp-json\/wp\/v2\/tags?post=753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}