Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Unexpected fun (or fun facts)

    Coding
    fun
    8
    23
    1784
    Loading More Posts
    • 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.
    • spikey
      spikey F last edited by

      @vinicity thats valuable information, thanks. But I am sure, you got some coding fun too to share😉?

      1 Reply Last reply Reply Quote 1
      • R
        romain337 last edited by

        Wow this is very nice! thanks you for sharing!

        1 Reply Last reply Reply Quote 0
        • spikey
          spikey F last edited by

          I got another one: never seen a thread going off topic as quick as this one 😂

          1 Reply Last reply Reply Quote 0
          • vinicity
            vinicity F last edited by

            OK, here is a joke:

            A Programmer was walking out of door for work, his wife said “while you’re out, buy some milk” and he never came home.

            1 Reply Last reply Reply Quote 6
            • pianofire
              pianofire Fuze Team last edited by

              My wife said: "Please go to the store and buy a carton of milk and if they have eggs, get six." I came back with 6 cartons of milk She said, "why in the hell did you buy six cartons of milk"

              "They had eggs"

              1 Reply Last reply Reply Quote 8
              • spikey
                spikey F last edited by

                Yes, guys, you nailed it. 😄😆

                1 Reply Last reply Reply Quote 1
                • PickleCatStars
                  PickleCatStars F last edited by PickleCatStars

                  How do mathematicians deal with constipation?

                  They sit down and work it out with a pencil.

                  1 Reply Last reply Reply Quote 3
                  • JMM161437
                    JMM161437 F last edited by

                    what is a computers favorite food?... bits and chips

                    1 Reply Last reply Reply Quote 3
                    • spikey
                      spikey F last edited by spikey

                      Depending on your integer size 4294967297 + 4294967297 = 2 ;-) also you can get over it if you use int() to define your integer value.
                      (further down in the code you need a update() and sleep(10) , not shown in the screenshot)
                      bild.jpg
                      bild.jpg

                      We seem to have 4 bytes available if we use a normal int assignment (not over the int() return value).
                      FFFF FFFF = 0 = 4294967296 = 2^32
                      Maybe int() returns a 64 bit integer?

                      Gothon 1 Reply Last reply Reply Quote 2
                      • Gothon
                        Gothon F @spikey last edited by

                        Yes, Fuze integers are 64 bit signed values, but the constant literals (numbers typed into the code editor) are 32 bit signed values. It is somewhat unusual for literals to be a smaller type than the variables they are assigned to. It makes for some interesting code if you want to use larger integers.

                        1 Reply Last reply Reply Quote 1
                        • PickleCatStars
                          PickleCatStars F last edited by

                          ...so if you do ’x = 4294967296
                          y = x+x
                          Print(y)’

                          You’ll get the right answer?

                          spikey 1 Reply Last reply Reply Quote 0
                          • spikey
                            spikey F @PickleCatStars last edited by spikey

                            @toxibunny well not wrong, but probably not what you would expect. The number is stored in x as 0. So the result will be zero. @Gothon mentioned that the editor or interpreter is assigning only 2 bytes 4 bytes for the number you type in the editor. If you generate that number with a function like int() and pow() you get the right value into x and it will show correctly. (Hope i got that right)

                            1 Reply Last reply Reply Quote 1
                            • PickleCatStars
                              PickleCatStars F last edited by

                              What if x was set to be 4294967295?

                              Gothon 1 Reply Last reply Reply Quote 0
                              • Gothon
                                Gothon F @PickleCatStars last edited by Gothon

                                @toxibunny said in Unexpected fun (or fun facts):

                                What if x was set to be 4294967295?

                                You will get 4294967295 + 4294967295 = -2 because 4294967295 = 2^32 - 1. Valid values for 32 bit (4 byte) signed numbers go from -2^31 to 2^31 - 1 (-2147483648 to 2147483647), anything outside that range wraps around. Eg, 2147483648 = -2147483648

                                1 Reply Last reply Reply Quote 1
                                • Ben 2.0
                                  Ben 2.0 last edited by

                                  I asked my lawyer if it was a crime to throw Sodium Chloride at a person.
                                  Lawyer: yes, it's assault
                                  Me: I know it's a salt but is it a crime?!?

                                  1 Reply Last reply Reply Quote 6
                                  • JMM161437
                                    JMM161437 F last edited by

                                    So I told my boss there were some bugs in the server and he hired an exterminator to spray it down

                                    1 Reply Last reply Reply Quote 3
                                    • First post
                                      Last post