Author Topic: High-accuracy floating point arithmetic (Win32)  (Read 19304 times)

Gunther

  • Member
  • *****
  • Posts: 4198
  • Forgive your enemies, but never forget their names
High-accuracy floating point arithmetic (Win32)
« on: January 06, 2013, 12:07:25 PM »
In August last year, I've started a thread http://masm32.com/board/index.php?topic=487.0 inside the 16 bit DOS Programming, because the frame program was written with PowerBASIC 3.5, which is a native 16 bit compiler. My original plan was to develop the 64 bit version first; for several reasons, I've started the migration from 16 bit code to 32 bit code first.

At the moment, my test program works and brings the right results. I've tested it under Windows XP Mode (Windows XP, SP3 with Virtual Computer). It runs well in compatibility mode under Windows 7 (64 bit), too.
Code: [Select]
XMM result FPU result Long Accumulator result
========== ========== =======================

Array 1 0.00 136.00 137.00
Array 2 17.00 137.00 137.00
Array 3 120.00 136.00 137.00
Array 4 147.00 139.00 137.00
Array 5 137.00 137.00 137.00
Array 6 -10.00 134.00 137.00

The right result is 137.00 and nothing else!

But I can't test the software under a native 32 bit Windows (XP, Windows 7, whatever Windows). So, I need some help for testing it under such an environment.

To be honest: The software is in the present state far from ideal and under construction. Most of the code (approximately 70%) is simple 16 bit code, running in the Windows FLAT memory model. I've to change that step by step into native 32 bit instructions. This is not so easy, because the parameter passing to some internal helper procedures  (for example: deleting or inverting the long accumulator) is made via registers and not via stack. By changing one procedure, there are side effects at others and that gives sometimes trouble.

Anyway, I hope to finish the migration in that program parts til March this year. Furthermore, I've to write an extensive documentation with background information for the used techniques and algorithms.

Gunther
You have to know the facts before you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: High-accuracy floating point arithmetic (Win32)
« Reply #1 on: January 06, 2013, 12:49:22 PM »
ran it under XP SP3
i got the exact same results as you   :t

Gunther

  • Member
  • *****
  • Posts: 4198
  • Forgive your enemies, but never forget their names
Re: High-accuracy floating point arithmetic (Win32)
« Reply #2 on: January 06, 2013, 10:51:20 PM »
Dave,

thank you very much.

Gunther
You have to know the facts before you can distort them.

FORTRANS

  • Member
  • *****
  • Posts: 1238
Re: High-accuracy floating point arithmetic (Win32)
« Reply #3 on: January 07, 2013, 12:12:41 AM »
Hi,

   Ran it on my P-III and Windows 2000.  The XMM results
were lunched.  The Long Accumulator result was good.  I
am reporting this as most XMM programs don't even run
on a P-III/Win2k.

Weird,

Steve N.

Gunther

  • Member
  • *****
  • Posts: 4198
  • Forgive your enemies, but never forget their names
Re: High-accuracy floating point arithmetic (Win32)
« Reply #4 on: January 07, 2013, 12:17:03 AM »
Steve,

Ran it on my P-III and Windows 2000.  The XMM results
were lunched.  The Long Accumulator result was good.  I
am reporting this as most XMM programs don't even run
on a P-III/Win2k.

Weird,

Steve N.

that's good news. Thank you.

Gunther
You have to know the facts before you can distort them.

Gunther

  • Member
  • *****
  • Posts: 4198
  • Forgive your enemies, but never forget their names
Re: High-accuracy floating point arithmetic (Win32)
« Reply #5 on: January 07, 2013, 04:29:56 AM »
Here is the first update.

Gunther

You have to know the facts before you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: High-accuracy floating point arithmetic (Win32)
« Reply #6 on: January 07, 2013, 04:32:54 AM »
prescott w/htt
Code: [Select]
                 XMM result      FPU result      Long Accumulator result
                 ==========      ==========      =======================

Array 1          0.00            136.00          137.00
Array 2          17.00           137.00          137.00
Array 3          120.00          136.00          137.00
Array 4          147.00          139.00          137.00
Array 5          137.00          137.00          137.00
Array 6          -10.00          134.00          137.00

Gunther

  • Member
  • *****
  • Posts: 4198
  • Forgive your enemies, but never forget their names
Re: High-accuracy floating point arithmetic (Win32)
« Reply #7 on: January 07, 2013, 04:34:43 AM »
Thank you for the fast reply, Dave. I assume it is Win XP with SP3.

Gunther
You have to know the facts before you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: High-accuracy floating point arithmetic (Win32)
« Reply #8 on: January 07, 2013, 04:41:37 AM »
yup   :t

i don't think the OS makes a difference, though

Gunther

  • Member
  • *****
  • Posts: 4198
  • Forgive your enemies, but never forget their names
Re: High-accuracy floating point arithmetic (Win32)
« Reply #9 on: January 07, 2013, 05:52:00 AM »
Dave,

yup   :t

i don't think the OS makes a difference, though

that's the question. Does Win98 support SSE, SSE2? Probably not.

Gunther
You have to know the facts before you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: High-accuracy floating point arithmetic (Win32)
« Reply #10 on: January 07, 2013, 06:41:36 AM »
i don't think win98 "knows" about SSE
back then, they had the FPU and MMX and that was about it
but - i don't think it cares, either - it isn't going to generate exceptions like NT-based OS's   :biggrin:

i think Steve and Michael have win98 machines up and running - probably Sinsi, as well
i have one, but i'd have to knock 6 inches of dust off to run it - lol
mine has a pentium III MMX

i gave up trying to support anything older than win 2000
there are just too many features that the earlier OS's didn't have
and too few people still using them

you can figure that most users that have a CPU that supports SSE, also have win 2000 or newer

Gunther

  • Member
  • *****
  • Posts: 4198
  • Forgive your enemies, but never forget their names
Re: High-accuracy floating point arithmetic (Win32)
« Reply #11 on: January 07, 2013, 08:12:08 AM »
Dave,

i gave up trying to support anything older than win 2000
there are just too many features that the earlier OS's didn't have
and too few people still using them

you can figure that most users that have a CPU that supports SSE, also have win 2000 or newer

that's probably right Dave.

Gunther
You have to know the facts before you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: High-accuracy floating point arithmetic (Win32)
« Reply #12 on: January 07, 2013, 10:33:24 AM »
i looked it up
SSE came out in 1999
win 2000 came out in december of the same year

they may have planned to call it windows 1999, because it came out on time   :lol:

Gunther

  • Member
  • *****
  • Posts: 4198
  • Forgive your enemies, but never forget their names
Re: High-accuracy floating point arithmetic (Win32)
« Reply #13 on: January 08, 2013, 05:30:04 AM »
Hi Dave,

i looked it up
SSE came out in 1999
win 2000 came out in december of the same year

they may have planned to call it windows 1999, because it came out on time   :lol:

thank you that you've figured out the thing. I think that the application should support Win XP and above; that's good enough.

Gunther
You have to know the facts before you can distort them.

Donkey

  • Member
  • **
  • Posts: 202
  • ASS-embler
    • Donkey's Stable
Re: High-accuracy floating point arithmetic (Win32)
« Reply #14 on: January 08, 2013, 05:48:06 AM »
i gave up trying to support anything older than win 2000
there are just too many features that the earlier OS's didn't have
and too few people still using them

I don't even bother with anything before XP, and even that is mostly because I have to change the target OS otherwise and its easier to just make stuff XP compatible than to get all of the header messages telling me I've used unsupported API's. But more and more I'm getting "xxx (Not Available)" when I try to assemble a program with XP as the target OS so I may end up changing the default to Vista soon. Really have to thank Yuri for convincing me to include API filtering in the header files.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable