sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    C != C

    Scheduled Pinned Locked Moved Developers' Forum
    18 Posts 7 Posters 680 Views 7 Watching
    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.
    • tbdT Offline
      tbd
      last edited by

      Javascript

      
      var c = NaN;
      alert(c==c);
      
      > false
      
      

      SketchUp Ruby Consultant | Podium 1.x developer
      http://plugins.ro

      1 Reply Last reply Reply Quote 0
      • AdamBA Offline
        AdamB
        last edited by

        Correct! IEEE NaN is defined as always failing comparison.

        Or in Ruby:

        a = 1.0 / 0 b = a - a b == b

        Developer of LightUp Click for website

        1 Reply Last reply Reply Quote 0
        • tbdT Offline
          tbd
          last edited by

          let's optimize that πŸ˜„

          
          b = 0.0/0
          b == b
          
          => false
          
          

          SketchUp Ruby Consultant | Podium 1.x developer
          http://plugins.ro

          1 Reply Last reply Reply Quote 0
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            well now that is odd! NaN does not compare equal to itself essentially? or is it something else?

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

            1 Reply Last reply Reply Quote 0
            • tbdT Offline
              tbd
              last edited by

              http://en.wikipedia.org/wiki/NaN - A comparison with a NaN always returns an unordered result even when comparing with itself.

              SketchUp Ruby Consultant | Podium 1.x developer
              http://plugins.ro

              1 Reply Last reply Reply Quote 0
              • M Offline
                MartinRinehart
                last edited by

                function strange() { return (3/0) == (2/0); }

                Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  What does it return is the question? I don't know how to run js snippets.

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply Reply Quote 0
                  • tbdT Offline
                    tbd
                    last edited by

                    @chris fullmer said:

                    What does it return is the question?

                    => true

                    because Infinity == Infinity πŸ˜‰

                    @unknownuser said:

                    I don't know how to run js snippets.

                    javascript:alert((3/0)==(2/0)) in your browser location

                    SketchUp Ruby Consultant | Podium 1.x developer
                    http://plugins.ro

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      todd burch
                      last edited by

                      @chris fullmer said:

                      What does it return is the question? I don't know how to run js snippets.

                      Ah, come on Chris... πŸ˜‰

                      webdialog.execute_script("your javscript here...") ;

                      1 Reply Last reply Reply Quote 0
                      • Chris FullmerC Offline
                        Chris Fullmer
                        last edited by

                        I barely comprehend how Ruby can control things inside my SketchUp program. Thinking about how to execute js through ruby that is installed by SU makes my head. Which is why I have not wrapped my head around webdialogs yet. js to run html, or vice versa?, all controlled through ruby. Its like a bad nightmare πŸ˜„

                        Lately you've been tan, suspicious for the winter.
                        All my Plugins I've written

                        1 Reply Last reply Reply Quote 0
                        • chrisglasierC Offline
                          chrisglasier
                          last edited by

                          @chris fullmer said:

                          Which is why I have not wrapped my head around webdialogs yet. ... Its like a bad nightmare πŸ˜„

                          Seems a little paranoiac Chris ...

                          With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                          1 Reply Last reply Reply Quote 0
                          • Chris FullmerC Offline
                            Chris Fullmer
                            last edited by

                            Its a little bit more of laziness than anything.

                            I started reading a book on js, HTML and DOM scripting. The first 10 chapters were just the author ranting about how bad people have mis-used javascript in the past. I didn't want his bitter history report, I just wanted to learn js. Sort of put me off the language for now.

                            ACtually js seems straightforward enough. It was the interaction with HTML where I got quickly confused because I'm so unfamiliar with HTML, css, etc.

                            Lately you've been tan, suspicious for the winter.
                            All my Plugins I've written

                            1 Reply Last reply Reply Quote 0
                            • M Offline
                              MartinRinehart
                              last edited by

                              @chris fullmer said:

                              What does it return is the question? I don't know how to run js snippets.

                              My JavaScript Console runs JS, rather like Jim's WebConsole runs Ruby. Chapter 17, Reference Resources includes it, fourth tab.

                              The next two chapters will get you started WebDialoging, even if you know no HTML, CSS or JavaScript. Chapter 16 has a fairy tale. You might be in it.

                              Here's a minimal snippet tester:

                              
                              <html><body><script>
                              
                              alert( 'put your snippet here' )
                              
                              </script></body></html>
                              
                              

                              Save it as whatever.html and open it in your favorite browser. (Notepad++ is much smarter about HTML and JavaScript than it is about Ruby.)

                              Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

                              1 Reply Last reply Reply Quote 0
                              • chrisglasierC Offline
                                chrisglasier
                                last edited by

                                Why always so complicated?

                                @unknownuser said:

                                javascript:alert((3/0)==(2/0)) in your browser location

                                With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                                1 Reply Last reply Reply Quote 0
                                • AdamBA Offline
                                  AdamB
                                  last edited by

                                  @chris fullmer said:

                                  well now that is odd! NaN does not compare equal to itself essentially? or is it something else?

                                  So its a really useful side-effect. You can have a line in your code:

                                  if (a != a)
                                  puts "its all gone pear-shaped"
                                  end

                                  for debugging.

                                  Developer of LightUp Click for website

                                  1 Reply Last reply Reply Quote 0
                                  • A Offline
                                    agamemnus
                                    last edited by

                                    @chris fullmer said:

                                    I started reading a book on js, HTML and DOM scripting. The first 10 chapters were just the author ranting about how bad people have mis-used javascript in the past. I didn't want his bitter history report, I just wanted to learn js. Sort of put me off the language for now.

                                    JS is a very permissive scripting language! People can make all sorts of mistakes and not even realize it until it's time to expand their little program into "the real world" (tm). I would highly recommend learning the basics as it can make a website much more than plain html. With the recent Google Chrome's and Firefox's very fast Canvas (graphics) rendering, JS has become even more useful.

                                    1 Reply Last reply Reply Quote 0
                                    • M Offline
                                      MartinRinehart
                                      last edited by

                                      @agamemnus said:

                                      With the recent Google Chrome's and Firefox's very fast Canvas (graphics) rendering, JS has become even more useful.

                                      I second that emotion! <canvas> is great. It's just about the most fun you can have in 2D.

                                      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

                                      1 Reply Last reply Reply Quote 0
                                      • 1 / 1
                                      • First post
                                        Last post
                                      Buy SketchPlus
                                      Buy SUbD
                                      Buy WrapR
                                      Buy eBook
                                      Buy Modelur
                                      Buy Vertex Tools
                                      Buy SketchCuisine
                                      Buy FormFonts

                                      Advertisement