Page 21 of 27 FirstFirst ... 11171819202122232425 ... LastLast
Results 201 to 210 of 263

Thread: The LaserBoy Thread

  1. #201
    Join Date
    Mar 2012
    Location
    Akron, Ohio USA
    Posts
    1,356

    Default

    There are many individual factors that influence the accuracy of floating point math. One of the big ones is the mode of the CPU / FPU. This is something that can be controlled with switches in the compiler. But you have to know that your code might be effected by this issue. The default behavior of the FPU is different from one OS to another. Same code, same compiler produces different results in Linux and Windows. The switches in the g++ compiler are not necessary in Linux. Accuracy is the preferred methodology in Linux. At some point the designers of any OS that runs on X86 / X87 hardware must make a decision on how to deal with floating point math. Fortunately it is possible for a programmer to choose, but it is the OS that determines the default behavior.
    Creator of LaserBoy!
    LaserBoy is free and runs in Windows, MacOSX and Linux.
    http://laserboy.org/code/LaserBoy_Current.zip
    http://theamerikans.org/LaserBoy

    http://laserboy.org/formatt/
    Ask me about my LaserBoy Correction Amp Kit for sale!

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

  2. #202
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    2,065

    Default

    Quote Originally Posted by james View Post
    There are many individual factors that influence the accuracy of floating point math. One of the big ones is the mode of the CPU / FPU. This is something that can be controlled with switches in the compiler. But you have to know that your code might be effected by this issue. The default behavior of the FPU is different from one OS to another. Same code, same compiler produces different results in Linux and Windows. The switches in the g++ compiler are not necessary in Linux. Accuracy is the preferred methodology in Linux. At some point the designers of any OS that runs on X86 / X87 hardware must make a decision on how to deal with floating point math. Fortunately it is possible for a programmer to choose, but it is the OS that determines the default behavior.
    So, if I write some machine code in assembly that does some math operations and run it on an x86 or x64 processor where one has a Linux OS and one has a Windows OS I should expect different results?
    The OS is going to step in and make the CPU and its registers work differently than the instructions tell it? Seems far fetched.

  3. #203
    Join Date
    Mar 2012
    Location
    Akron, Ohio USA
    Posts
    1,356

    Default

    From what I have read there is a specific x86 instruction that sets the FPU internal resolution and fp math semantics. So, unless you know the magic instruction and what value to pass to it, then yes. That's the general idea. You know an OS kernel has everything to do with memory management and process control.

    Apparently there is a floating point type that only exists inside the FPU that never gets written to RAM. It's called extended precision. There are semantics about how math is done inside the FPU and rounded to a float, double or long double. That can be setup by the OS kernel or over-ridden by specific instructions.
    Last edited by james; 03-07-2019 at 20:32.
    Creator of LaserBoy!
    LaserBoy is free and runs in Windows, MacOSX and Linux.
    http://laserboy.org/code/LaserBoy_Current.zip
    http://theamerikans.org/LaserBoy

    http://laserboy.org/formatt/
    Ask me about my LaserBoy Correction Amp Kit for sale!

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

  4. #204
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    2,065

    Default

    Quote Originally Posted by james View Post
    From what I have read there is a specific x86 instruction that sets the FPU internal resolution and fp math semantics. So, unless you know the magic instruction and what value to pass to it, then yes. That's the general idea. You know an OS kernel has everything to do with memory management and process control.

    Apparently there is a floating point type that only exists inside the FPU that never gets written to RAM. It's called extended precision. There are semantics about how math is done inside the FPU and rounded to a float, double or long double. That can be setup by the OS kernel or over-ridden by specific instructions.
    Again, it is the compiler that controls that the behavior of floating point math. That is why there are compiler flags IN THE COMPILER that allow you to decide how it will work instead of settings in the Windows registry that determines how the application behaves. Once the code is compiled, it does what it does. Windows doesn't override instructions sets to make your math give you the wrong answers.
    Yes, the OS manages the processes and the memory space where they run but memory management within those spaces is still controlled by the language's runtime. C++ does it one way. .NET does it a completely different way. But, that is something completely unrelated.

  5. #205
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    2,065

    Default

    Quote Originally Posted by JohnYayas View Post
    Again, it is the compiler that controls that the behavior of floating point math. That is why there are compiler flags IN THE COMPILER that allow you to decide how it will work instead of settings in the Windows registry that determines how the application behaves. Once the code is compiled, it does what it does. Windows doesn't override instructions sets to make your math give you the wrong answers.
    Yes, the OS manages the processes and the memory space where they run but memory management within those spaces is still controlled by the language's runtime. C++ does it one way. .NET does it a completely different way. But, that is something completely unrelated.
    Anyway, I sent an email to one of the guys at Microsoft that works on the compiler and is on the ISO C++ committee. We'll see if he replies. If I am wrong I'll be happy to admit it.

  6. #206
    Join Date
    Mar 2012
    Location
    Akron, Ohio USA
    Posts
    1,356

    Default

    Maybe you should think of it as an operating system convention, like the carriage return line feed combo in Windows vs the newline character in just about every other OS. Sure it is possible to write code that produces text files with newline characters in Windows, but Notepad can't deal with it. Just about any other text application in Windows can. At this point in computer history, why does MS still hold on to the CR/LF convention? What purpose does it serve? What purpose did it ever serve?
    Last edited by james; 03-08-2019 at 09:46.
    Creator of LaserBoy!
    LaserBoy is free and runs in Windows, MacOSX and Linux.
    http://laserboy.org/code/LaserBoy_Current.zip
    http://theamerikans.org/LaserBoy

    http://laserboy.org/formatt/
    Ask me about my LaserBoy Correction Amp Kit for sale!

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

  7. #207
    Join Date
    Jul 2009
    Location
    Orlando, FL
    Posts
    357

    Default

    Quote Originally Posted by james View Post
    At this point in computer history, why does MS still hold on to the CR/LF convention? What purpose does it serve? What purpose did it ever serve?
    It's a holdover from the teletype days. As they were capable of things like overprinting/double strike type, they required you to command the carriage to reset and then advance the paper feed as separate steps.

    That's also why there is a "bell" character (0x07) in the ASCII table. Teletypes had a physical bell that an application could ring.

    ...maybe Seņor Gates was feeling nostalgic about his Altair and insisted on CR/LF.
    Last edited by CountFunkula; 03-08-2019 at 11:42.

  8. #208
    Join Date
    Mar 2012
    Location
    Akron, Ohio USA
    Posts
    1,356

    Default

    Are you suggesting that UNIX machines didn't write to teletype printers?

    What is the point of storing teletype editing and reporting characters in a disk file?

    I'm not sure what the current state of affairs is, but the MS telnet client that came with Windows was ridiculously busted. It was black on white only, no ANSI character colors or reverse. Character positioning on the screen was pretty sketchy too.
    Creator of LaserBoy!
    LaserBoy is free and runs in Windows, MacOSX and Linux.
    http://laserboy.org/code/LaserBoy_Current.zip
    http://theamerikans.org/LaserBoy

    http://laserboy.org/formatt/
    Ask me about my LaserBoy Correction Amp Kit for sale!

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

  9. #209
    Join Date
    Jul 2009
    Location
    Orlando, FL
    Posts
    357

    Default

    Quote Originally Posted by james View Post
    Are you suggesting that UNIX machines didn't write to teletype printers?
    Not at all! In fact, /dev/tty is a nod to the teletype! Early UNIX U.I. design was a DIRECT result of the fact that there was a good chance you'd be interfacing with your machine over a teletype.

    On the other hand, I'd pay good money to see someone use a modern Windows machine with an ASR-33 for a day.

    Quote Originally Posted by james View Post
    What is the point of storing teletype editing and reporting characters in a disk file?
    Same as any other use case where you want text to be reproduced or rendered as intended.

  10. #210
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    2,065

    Default

    I wrote to Stephan Lavavej at Microsoft. You can Google him if you like.

    His response:
    "Your understanding is correct as far as I know. This sounds like an intentional difference in behavior when GCC is targeting Linux versus when it's targeting Windows."

    You can read into that whatever you like.

Posting Permissions

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