Writing programmes is easier than Mathematics.

Abhishek Rawal

Abhishek Rawal

@abhishek-fg9tRh Oct 21, 2024
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 😀

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • rahul69

    rahul69

    @rahul69-97fAOs Jan 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!!😉😁
  • safiajen0055

    safiajen0055

    @safiajen0055-ARWNeS Feb 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😀
  • zaveri

    zaveri

    @zaveri-5TD6Sk Feb 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.