Thread: Interesting Question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    Salem's answer involves integer ranges, and I think that's too complex. Besides, it doesn't answer the question.
    I was never so much for the coding part, but rather the fact that he mentions that you can't be sure that the computer adds correctly, and therefore, in essence, the programmer has to convince himself that the output is expected.

    Even with an operation as trivial as addition, the computer is no replacement for the human brain. Only the programmer can know what is right and what is wrong.
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Quote Originally Posted by Happy_Reaper View Post
    you can't be sure that the computer adds correctly, and therefore, in essence, the programmer has to convince himself that the output is expected.
    But that's misleading. I think the original question was really whether the computer could make basic mistakes like adding 1 and 1 and getting 3. It was a 5-year-old asking the question.

    The programmer can do only so much. He can check that no overflow will occur, but for the actual calculation he has to trust the CPU. What will he do? assert() that a+b == a+b?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    To be honest I'd frankly tell him to try it and see if the computer gets it wrong. And if that doesn't convince him, to tell him to keep trying until he either finds the computer making a mistake, or is convinced it won't make a mistake.
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  2. A question about an interesting Makefile
    By meili100 in forum Tech Board
    Replies: 2
    Last Post: 08-12-2008, 03:56 PM
  3. interesting question about new and nothrow new
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 01-29-2008, 03:53 AM
  4. Design layer question
    By mdoland in forum C# Programming
    Replies: 0
    Last Post: 10-19-2007, 04:22 AM
  5. Question type program for beginners
    By Kirdra in forum C++ Programming
    Replies: 7
    Last Post: 09-15-2002, 05:10 AM