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. The Lounge
  3. Floating Point Math

Floating Point Math

Scheduled Pinned Locked Moved The Lounge
csharpdatabasecomtoolsquestion
40 Posts 24 Posters 7 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.
  • C CPallini

    I would like to have a bunch of smart developers, you know the ones able to write hurricane damage simulators using only four places of precision.

    THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite

    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #9

    I can to it with 8 bit integers! It won't be a even slightly accurate simulation, of course, but... :laugh:

    Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    P 1 Reply Last reply
    0
    • C Chris Losinger

      i have a couple of image processing fns which input and output BYTEs but need to convert the input to doubles for the internals because even floats run out of precision well within reasonable parameters. i'd love to be able to not have to use 24 bytes per pixel, but...

      image processing toolkits | batch image processing

      enhzflepE Offline
      enhzflepE Offline
      enhzflep
      wrote on last edited by
      #10

      Chris Losinger wrote:

      i'd love to be able to not have to use 24 bytes per pixel,

      er, bits? But, as we all know - palletized images suck when it comes to performing any real manipulation on them, since you're stuck with looking-up the 24 bit values anyway. Alpha-blending images with a pallette? :shudder: Uhhhrgh! Please dont make me do that again. Recomputing a new pallete is more effort than the image processing itself.

      C U 2 Replies Last reply
      0
      • T thrakazog

        Ennis Ray Lynch, Jr. wrote:

        I wrote a hurricane damage simulator

        I didn't know you worked on Sim City.

        Play my game Gravity: Android[^], Windows Phone 7[^]

        E Offline
        E Offline
        Ennis Ray Lynch Jr
        wrote on last edited by
        #11

        Mine isn't nearly as accurate. Wind fields in real-life are surprisingly non-deterministic and literally change with the phase of the moon.

        Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost "All users always want Excel" --Ennis Lynch

        Sander RosselS J 2 Replies Last reply
        0
        • enhzflepE enhzflep

          Chris Losinger wrote:

          i'd love to be able to not have to use 24 bytes per pixel,

          er, bits? But, as we all know - palletized images suck when it comes to performing any real manipulation on them, since you're stuck with looking-up the 24 bit values anyway. Alpha-blending images with a pallette? :shudder: Uhhhrgh! Please dont make me do that again. Recomputing a new pallete is more effort than the image processing itself.

          C Offline
          C Offline
          Chris Losinger
          wrote on last edited by
          #12

          no, BYTEs. doubles are 8 bytes each. 3x8 = 24 bytes.

          image processing toolkits | batch image processing

          enhzflepE 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            I can to it with 8 bit integers! It won't be a even slightly accurate simulation, of course, but... :laugh:

            Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #13

            You find yourself in a small Sailboat 10 miles East of Cuba. There is a Class 5 Hurricane approaching from the South at 10 miles per hour.

            You'll never get very far if all you do is follow instructions.

            OriginalGriffO 1 Reply Last reply
            0
            • E Ennis Ray Lynch Jr

              Query for all the naysayers ... which would you rather have fast floating point operations or 15 places of accurate precision? Most of my work four places is good enough and I wrote a hurricane damage simulator.

              Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost "All users always want Excel" --Ennis Lynch

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

              Ennis Ray Lynch, Jr. wrote:

              Most of my work four places is good enough and I wrote a hurricane damage simulator.

              Well, how much precision do you need to say $15 billion (or whatever the number is in billions of dollar?) Marc

              Latest Articles - APOD Scraper and Hunt the Wumpus Short video on Membrane Computing Hunt the Wumpus (A HOPE video)

              E 1 Reply Last reply
              0
              • E Ennis Ray Lynch Jr

                Query for all the naysayers ... which would you rather have fast floating point operations or 15 places of accurate precision? Most of my work four places is good enough and I wrote a hurricane damage simulator.

                Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost "All users always want Excel" --Ennis Lynch

                C Offline
                C Offline
                Chris Maunder
                wrote on last edited by
                #15

                Someone, somewhere, is thinking "I am a hurricane damage simulator".

                cheers Chris Maunder

                N 1 Reply Last reply
                0
                • P PIEBALDconsult

                  You find yourself in a small Sailboat 10 miles East of Cuba. There is a Class 5 Hurricane approaching from the South at 10 miles per hour.

                  You'll never get very far if all you do is follow instructions.

                  OriginalGriffO Offline
                  OriginalGriffO Offline
                  OriginalGriff
                  wrote on last edited by
                  #16

                  So, provided I can do 11 mph due north, I'm fine and dandy! (I don't want to go to Cuba today - I don't smoke)

                  Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  L 1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    So, provided I can do 11 mph due north, I'm fine and dandy! (I don't want to go to Cuba today - I don't smoke)

                    Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #17

                    Instead of running before a speeding object, I'd recommend stepping aside. Go West.

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                    OriginalGriffO 1 Reply Last reply
                    0
                    • M Marc Clifton

                      Ennis Ray Lynch, Jr. wrote:

                      Most of my work four places is good enough and I wrote a hurricane damage simulator.

                      Well, how much precision do you need to say $15 billion (or whatever the number is in billions of dollar?) Marc

                      Latest Articles - APOD Scraper and Hunt the Wumpus Short video on Membrane Computing Hunt the Wumpus (A HOPE video)

                      E Offline
                      E Offline
                      Ennis Ray Lynch Jr
                      wrote on last edited by
                      #18

                      You are not supposed to point out flaws in my argument!

                      Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost "All users always want Excel" --Ennis Lynch

                      1 Reply Last reply
                      0
                      • L Lost User

                        Instead of running before a speeding object, I'd recommend stepping aside. Go West.

                        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                        OriginalGriffO Offline
                        OriginalGriffO Offline
                        OriginalGriff
                        wrote on last edited by
                        #19

                        Depends how fast I can move, and the size and initial distance to the storm. Going west means I need to move faster than running directly away.

                        Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

                        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                        L 1 Reply Last reply
                        0
                        • OriginalGriffO OriginalGriff

                          Depends how fast I can move, and the size and initial distance to the storm. Going west means I need to move faster than running directly away.

                          Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #20

                          OriginalGriff wrote:

                          Depends how fast I can move, and the size and initial distance to the storm.

                          Size! ..that's the thing I did not take into account. Ah, just a small bug :laugh:

                          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                          OriginalGriffO M 2 Replies Last reply
                          0
                          • L Lost User

                            OriginalGriff wrote:

                            Depends how fast I can move, and the size and initial distance to the storm.

                            Size! ..that's the thing I did not take into account. Ah, just a small bug :laugh:

                            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                            OriginalGriffO Offline
                            OriginalGriffO Offline
                            OriginalGriff
                            wrote on last edited by
                            #21

                            There's always something, isn't there? :laugh:

                            Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

                            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                            L 1 Reply Last reply
                            0
                            • OriginalGriffO OriginalGriff

                              There's always something, isn't there? :laugh:

                              Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #22

                              Not always, but very often :rolleyes:

                              1 Reply Last reply
                              0
                              • C Chris Losinger

                                no, BYTEs. doubles are 8 bytes each. 3x8 = 24 bytes.

                                image processing toolkits | batch image processing

                                enhzflepE Offline
                                enhzflepE Offline
                                enhzflep
                                wrote on last edited by
                                #23

                                Chris Losinger wrote:

                                but need to convert the input to doubles for the internals

                                :doh: Of course. Must be about time for bed for me... Those images sure do get pretty big, pretty quick, at that rate of memory consumption.

                                1 Reply Last reply
                                0
                                • E Ennis Ray Lynch Jr

                                  Query for all the naysayers ... which would you rather have fast floating point operations or 15 places of accurate precision? Most of my work four places is good enough and I wrote a hurricane damage simulator.

                                  Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost "All users always want Excel" --Ennis Lynch

                                  D Offline
                                  D Offline
                                  Dr Walt Fair PE
                                  wrote on last edited by
                                  #24

                                  I work on stuff where 15 digits is marginally OK, using plenty of trickery.

                                  CQ de W5ALT

                                  Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

                                  1 Reply Last reply
                                  0
                                  • L Lost User

                                    OriginalGriff wrote:

                                    Depends how fast I can move, and the size and initial distance to the storm.

                                    Size! ..that's the thing I did not take into account. Ah, just a small bug :laugh:

                                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                                    M Offline
                                    M Offline
                                    Mycroft Holmes
                                    wrote on last edited by
                                    #25

                                    Eddy Vluggen wrote:

                                    Size!

                                    It does matter apparently!

                                    Eddy Vluggen wrote:

                                    Ah, just a small bug

                                    That's what she said.

                                    Never underestimate the power of human stupidity RAH

                                    1 Reply Last reply
                                    0
                                    • C Chris Maunder

                                      Someone, somewhere, is thinking "I am a hurricane damage simulator".

                                      cheers Chris Maunder

                                      N Offline
                                      N Offline
                                      Nagy Vilmos
                                      wrote on last edited by
                                      #26

                                      Sean been at the hamsters' sunflower hooch again?

                                      1 Reply Last reply
                                      0
                                      • E Ennis Ray Lynch Jr

                                        Query for all the naysayers ... which would you rather have fast floating point operations or 15 places of accurate precision? Most of my work four places is good enough and I wrote a hurricane damage simulator.

                                        Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost "All users always want Excel" --Ennis Lynch

                                        Sander RosselS Offline
                                        Sander RosselS Offline
                                        Sander Rossel
                                        wrote on last edited by
                                        #27

                                        I'll have my math float away, thank you! :D

                                        It's an OO world.

                                        public class SanderRossel : Lazy<Person>
                                        {
                                        public void DoWork()
                                        {
                                        throw new NotSupportedException();
                                        }
                                        }

                                        J 1 Reply Last reply
                                        0
                                        • E Ennis Ray Lynch Jr

                                          Mine isn't nearly as accurate. Wind fields in real-life are surprisingly non-deterministic and literally change with the phase of the moon.

                                          Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost "All users always want Excel" --Ennis Lynch

                                          Sander RosselS Offline
                                          Sander RosselS Offline
                                          Sander Rossel
                                          wrote on last edited by
                                          #28

                                          Ennis Ray Lynch, Jr. wrote:

                                          and literally change with the phase of the moon.

                                          So do I! Oh no... It's a full moo OOOOOOOOOOH!!! *Howl*

                                          It's an OO world.

                                          public class SanderRossel : Lazy<Person>
                                          {
                                          public void DoWork()
                                          {
                                          throw new NotSupportedException();
                                          }
                                          }

                                          J 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