Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Embarrassing newbie mistake

Embarrassing newbie mistake

Scheduled Pinned Locked Moved The Weird and The Wonderful
css
5 Posts 4 Posters 43 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bill fleming 2022
    wrote on last edited by
    #1

    Once upon a time in a galaxy far, far away… When I was a new (less than 1 year) programmer and working on an IBM 1401 with no math co-processor, I noticed a program that took a long time to do percent calculations (divide). In those days a divide was a software subroutine (a.k.a. function) provided by the vendor to achieve desired results. I had the bright idea improving on it and figured that if you multiplied the numerator by 100 and then looped through a routine that subtracted the denominator you could get there faster. And it worked. Spectacularly. Until… When a numerator came through that was much larger than the denominator the machine virtually locked up. Lessons to new programmers, always test all use cases and never assume your data will be good – always assume the worst where data is concerned. Or as I heard somewhere: no matter how good the validation, some idiot will find a way to get bad data past it.

    M R 2 Replies Last reply
    0
    • B bill fleming 2022

      Once upon a time in a galaxy far, far away… When I was a new (less than 1 year) programmer and working on an IBM 1401 with no math co-processor, I noticed a program that took a long time to do percent calculations (divide). In those days a divide was a software subroutine (a.k.a. function) provided by the vendor to achieve desired results. I had the bright idea improving on it and figured that if you multiplied the numerator by 100 and then looped through a routine that subtracted the denominator you could get there faster. And it worked. Spectacularly. Until… When a numerator came through that was much larger than the denominator the machine virtually locked up. Lessons to new programmers, always test all use cases and never assume your data will be good – always assume the worst where data is concerned. Or as I heard somewhere: no matter how good the validation, some idiot will find a way to get bad data past it.

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #2

      Yeah, a denominator of 0 would be quite amusing! Or a negative one. :laugh:

      Latest Article:
      Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain

      1 Reply Last reply
      0
      • B bill fleming 2022

        Once upon a time in a galaxy far, far away… When I was a new (less than 1 year) programmer and working on an IBM 1401 with no math co-processor, I noticed a program that took a long time to do percent calculations (divide). In those days a divide was a software subroutine (a.k.a. function) provided by the vendor to achieve desired results. I had the bright idea improving on it and figured that if you multiplied the numerator by 100 and then looped through a routine that subtracted the denominator you could get there faster. And it worked. Spectacularly. Until… When a numerator came through that was much larger than the denominator the machine virtually locked up. Lessons to new programmers, always test all use cases and never assume your data will be good – always assume the worst where data is concerned. Or as I heard somewhere: no matter how good the validation, some idiot will find a way to get bad data past it.

        R Offline
        R Offline
        Rick York
        wrote on last edited by
        #3

        You might remember that several years Intel had a problem with division with a Pentium processor. The same thing had happened - some edge cases were overlooked. That prompted them to enact a rule that the guy who writes the microcode can not write the test vectors.

        "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

        T 1 Reply Last reply
        0
        • R Rick York

          You might remember that several years Intel had a problem with division with a Pentium processor. The same thing had happened - some edge cases were overlooked. That prompted them to enact a rule that the guy who writes the microcode can not write the test vectors.

          "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

          T Offline
          T Offline
          trønderen
          wrote on last edited by
          #4

          Rick York wrote:

          the guy who writes the microcode can not write the test vectors

          THAT is fundamental to all testing, certainly not limited to microcode!

          R 1 Reply Last reply
          0
          • T trønderen

            Rick York wrote:

            the guy who writes the microcode can not write the test vectors

            THAT is fundamental to all testing, certainly not limited to microcode!

            R Offline
            R Offline
            Rick York
            wrote on last edited by
            #5

            No, is not fundamental. It is highly recommended but not fundamental. Prior to this error Intel had not required it to be done by different people and I am certain they were not alone in that.

            "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups