CrazyEngineers
  • Writing programmes is easier than Mathematics.

    Abhishek Rawal

    Abhishek Rawal

    @abhishek-fg9tRh
    Updated: Oct 21, 2024
    Views: 916
    I was confused whether I should post this thread in Mathematics section or Computer section.

    Whatever,
    Read this link : gambasdoc.org/help/doc/formula?view&en

    Interesting stuff 😀
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • rahul69

    MemberJan 26, 2013

    I checked out this link, and I think that whoever wrote this was just having fun as a programmer 😲. Check out my reasoning and then tell me if I am wrong:
    He wrote a small code to prove 1+2+3..= -1
    and the result printed gave values -1,-1 etc..
    Trick: He used two variables a and b to hold values and declared those as Integers.
    Now the range of Unsigned Integers for 32 bit compiler:
    -2147483648 to 2147483647.
    Now to carry this out he doesnot used simple a=a+1, but a=a+b,so that when "a" printed 2147483647, b became -2147483648, and in next iteration when a+b is calculated, it gives 2147483647+(-2147483648)=-1.
    Here since b's value went out of range, hence it rollbacked to least value (way by which most compilers handle out of range values)
    Hence programmers rock!!😉😁
    Are you sure? This action cannot be undone.
    Cancel
  • safiajen0055

    MemberFeb 9, 2013

    Troll_So_Hard
    I was confused whether I should post this thread in Mathematics section or Computer section.

    Whatever,
    Read this link : gambasdoc.org/help/doc/formula?view&en

    Interesting stuff 😀
    Interesting to read but i have more knowledge about mathematics than programming , think math is easier till😀
    Are you sure? This action cannot be undone.
    Cancel
  • zaveri

    MemberFeb 9, 2013

    writing programs and creating algorithms, does involve some analytical skills, and they can be pretty fun to do.

    but i prefer solid mechanics and thermodynamics.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register