Page 22 of 22 FirstFirst ... 121819202122
Results 211 to 217 of 217

Thread: The LaserBoy Thread

  1. #211
    Join Date
    Mar 2012
    Location
    Akron, Ohio USA
    Posts
    1,270

    Default

    There is a blog conversation about a guy who wrote an app to analyse data on a Linux machine and wanted to share it with people in Windows. He observed problems when using MSVC++ compiler and GCC for Windows. That's where I found the compiler switches.

    -msse2 -mfpmath=sse

    I put these in both the Linux and the Windows Makefile, but it is redundant in Linux as this is part of the default settings.

    You cannot understate the meaning of "default" with GNU GCC. It is what compiles the Linux kernel. (Yes. I know that is a special case with special magic.)

    James.
    Last edited by james; 03-08-2019 at 15:55.
    Creator of LaserBoy!
    LaserBoy is free and runs in Windows, MacOSX and Linux.
    http://laserboy.org/code/LaserBoy_Current.zip
    http://theamerikans.org/LaserBoy

    Ask me about my LaserBoy Correction Amp Kit for sale!

    Either do or do not do. There is no undo!

  2. #212
    Join Date
    Jul 2008
    Posts
    420

    Default

    Quote Originally Posted by james View Post
    There is a blog conversation about a guy who wrote an app to analyse data on a Linux machine and wanted to share it with people in Windows. He observed problems when using MSVC++ compiler and GCC for Windows. That's where I found the compiler switches.

    -msse2 -mfpmath=sse

    I put these in both the Linux and the Windows Makefile, but it is redundant in Linux as this is part of the default settings.

    You cannot understate the meaning of "default" with GNU GCC. It is what compiles the Linux kernel. (Yes. I know that is a special case with special magic.)

    James.
    I'm still a bit puzzled on how your app can make or break over how many angels can dance on the head of a pin.

    Just curious- what happens if you change the code from a <= pi to a < pi... does it still break in Windows w/o the magic
    compiler switches?
    Once milk has been poured over corn flakes, the clock starts ticking.

  3. #213
    Join Date
    Mar 2012
    Location
    Akron, Ohio USA
    Posts
    1,270

    Default

    I haven't tried that because it's not the right question. The value of pi radians means three points in a straight line. That and every angle less is exactly what i want to remove from the polygon.
    Creator of LaserBoy!
    LaserBoy is free and runs in Windows, MacOSX and Linux.
    http://laserboy.org/code/LaserBoy_Current.zip
    http://theamerikans.org/LaserBoy

    Ask me about my LaserBoy Correction Amp Kit for sale!

    Either do or do not do. There is no undo!

  4. #214
    Join Date
    Jul 2008
    Posts
    420

    Default

    Quote Originally Posted by james View Post
    I haven't tried that because it's not the right question. The value of pi radians means three points in a straight line. That and every angle less is exactly what i want to remove from the polygon.
    pi radians cannot truly be represented in FP- please reconsider my request.
    Once milk has been poured over corn flakes, the clock starts ticking.

  5. #215
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    2,043

    Default

    According to this page
    https://docs.microsoft.com/en-us/cpp...6?view=vs-2017
    Visual C++ uses sse and sse2 by default.

    I am still trying to understand what it is about Windows you think is broken.
    I think we have at least determined that this is not a Windows problem as you initially asserted and has everything to do with code generation and is controlled by your GCC C++ compiler settings.

    You should check to see how this is handled in a javascript environment. Will Chrome give different results when running on a Mac, Windows, Linux, Android? What about IE, Edge, Firefox. They all have different engines, I think.
    You should also check .NET Core, which is cross platform, so runs on Windows and Linux, as well as others.

    Let me know what you find.

    What am I missing?

  6. #216
    Join Date
    Mar 2012
    Location
    Akron, Ohio USA
    Posts
    1,270

    Default

    Quote Originally Posted by dchammonds View Post
    pi radians cannot truly be represented in FP- please reconsider my request.
    Of course not. But if I use a trig function like atan2 and I give it coordinates that I know are in a straight line, I better get a double that is as close to pi as it can be. It should match (4 * atan(1.0)).

    To find the angle between any two lines that are connected at one end, you take the atan2 of each line and subtract one from the other as each atan2 call gives you the angle from the x axis to each line (in the case of XY coordinates). What you actually get is a number from negative pi to positive pi. So if the number is less than zero, I add two pi to it to get a number from zero to one epsilon value less than two pi. (Epsilon being the smallest difference in a double in the magnitude range of zero to two pi. A rotational angle of exactly two pi is the same as zero.

    If I'm looking for the convex polygon that surrounds a perfect square that has a whole lot of points along the straight sides, I don't want all those points. I just want the four corners. If I leave the value pi out of my comparison as in a < pi, rather than a <= pi, I would not be able to find and remove those points.

    I'm not saying that Microsoft is broken when it comes to double float math. It's just setup for speed of compilation and execution at the cost of precision. I am quite certain I could make my executable behave the same way in Linux as it does in the default behavior of Windows.

    Like the other James said, there are reasons for every different way it's done and each use case has its reasons for making the right choice.

    But you can't choose if you don't even know there is a choice to me made!

    We haven't even touched on the bizarre anomalies that arise from using integer coordinates in 3D space. You know it's pretty much impossible to draw a straight line with a lot of points along it in any direction other than parallel or perpendicular to the axis, Right? 2D images that get rotated around either of their coordinate axis (into the 3rd dimension) cannot be co-planer either. But that's OK. Because when you convert integer to double you have enough resolution in the numbers to deal with this. It's not an error. It's just the way it is.
    Last edited by james; 03-09-2019 at 07:53.
    Creator of LaserBoy!
    LaserBoy is free and runs in Windows, MacOSX and Linux.
    http://laserboy.org/code/LaserBoy_Current.zip
    http://theamerikans.org/LaserBoy

    Ask me about my LaserBoy Correction Amp Kit for sale!

    Either do or do not do. There is no undo!

  7. #217
    Join Date
    Mar 2012
    Location
    Akron, Ohio USA
    Posts
    1,270

    Default

    Check this out. This is a video made from bmp files output from LaserBoy, put together using ffmpeg.

    http://laserboy.org/avi/centroid.mp4

    James.
    Last edited by james; 03-13-2019 at 13:48.
    Creator of LaserBoy!
    LaserBoy is free and runs in Windows, MacOSX and Linux.
    http://laserboy.org/code/LaserBoy_Current.zip
    http://theamerikans.org/LaserBoy

    Ask me about my LaserBoy Correction Amp Kit for sale!

    Either do or do not do. There is no undo!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •