Author Topic: Validity of floating point numbers without FPU code  (Read 9429 times)

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Validity of floating point numbers without FPU code
« on: January 04, 2015, 05:49:30 AM »
We have a thread about this topic here. The kernel-mode driver is finished and works good. I've attached a small test program (sources are included) for some assembly language procedures, which are realized inside the driver software. The archive is cfn.zip and here is the output of the program:
Code: [Select]
The C macro isfinite() returns whether X is a finite value.
A finite value is any floating point value that  is neither
infinite nor NaN (Not a Number).
The type of X shall  be float, double or  long double. A non
zero value (true) if X is finite; and zero (false) otherwise.
Here are some examples:

isfinite(0.0)        = 1
isfinite(1.0/0.0)    = 0
isfinite(-2.0/0.0)   = 0
isfinite(sqrt(-4.0)) = 0

Please, press enter to continue...
The different checks may take a while.

Checking the REAL4 number 3.141593:
It's a finite floating point value.

C-version Assembly Language
--------- -----------------
Time 4.76 s 1.95 s

Please, press enter to continue...

Checking the REAL8 number 3.141592653589793:
It's a finite floating point value.

C-version Assembly Language
--------- -----------------
Time 4.76 s 2.23 s

Please, press enter to continue...

Checking the REAL10 number 3.1415926535897932385:
It's a finite floating point value.

C-version Assembly Language
--------- -----------------
Time 5.65 s 1.98 s

Please, press enter to end the application ...
The results are not so bad. It's tested with an Intel machine. Some timings on other computers would be fine.

Gunther
« Last Edit: January 05, 2015, 03:14:39 AM by Gunther »
Get your facts first, and then you can distort them.

jj2007

  • Member
  • *****
  • Posts: 10676
  • Assembler is fun ;-)
    • MasmBasic
Re: Validity of floating point numbers without FPU code
« Reply #1 on: January 04, 2015, 06:28:13 AM »
Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
Code: [Select]
Checking the REAL4 number 3.141593:
It's a finite floating point value.

         C-version       Assembly Language
         ---------       -----------------
Time     6.46 s          2.74 s

Please, press enter to continue...

Checking the REAL8 number 3.141592653589793:
It's a finite floating point value.

         C-version       Assembly Language
         ---------       -----------------
Time     6.68 s          3.09 s

Please, press enter to continue...

Checking the REAL10 number 3.1415926535897932385:
It's a finite floating point value.

         C-version       Assembly Language
         ---------       -----------------
Time     7.99 s          3.03 s

sinsi

  • Guest
Re: Validity of floating point numbers without FPU code
« Reply #2 on: January 04, 2015, 10:24:30 AM »
AMD A10-7850K APU @3.70 GHz
Code: [Select]
Checking the REAL4 number 3.141593:
It's a finite floating point value.
         C-version       Assembly Language
Time     5.16 s          2.03 s

Checking the REAL8 number 3.141592653589793:
It's a finite floating point value.
         C-version       Assembly Language
Time     5.67 s          2.34 s

Checking the REAL10 number 3.1415926535897932385:
It's a finite floating point value.
         C-version       Assembly Language
Time     10.96 s         2.58 s

habran

  • Member
  • *****
  • Posts: 1225
    • uasm
Re: Validity of floating point numbers without FPU code
« Reply #3 on: January 04, 2015, 10:56:53 AM »
Hi Gunther :biggrin:
Windows 8.1 is trowing an error in third asm function   ( value in [ecx] is wrong ) :(
Cod-Father

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: Validity of floating point numbers without FPU code
« Reply #4 on: January 04, 2015, 11:33:34 AM »
Thank you, Jochen and Sinsi.

Windows 8.1 is trowing an error in third asm function   ( value in [ecx] is wrong ) :(

I've to test that. Thank you for the error report.

Gunther
Get your facts first, and then you can distort them.

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: Validity of floating point numbers without FPU code
« Reply #5 on: January 04, 2015, 12:34:08 PM »
Hi Habran,

you're right: the EXE crashes under Win 8.1-64 on my i3 laptop. It's a mess with those REAL10 values. So I've commented out this part of the application. The archive for Windows 8.1 user is cfnWin8.zip. That should work without crash. I must search the reason for that behavior and my driver is not ready yet.  :( But I learned a new hard lesson: If a program runs fine under Windows 7, don't assume that it'll run also under Windows 8. Test that in any case.

Gunther
Get your facts first, and then you can distort them.

habran

  • Member
  • *****
  • Posts: 1225
    • uasm
Re: Validity of floating point numbers without FPU code
« Reply #6 on: January 04, 2015, 03:55:57 PM »
Windows 8.1 x64 Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz

Code: [Select]
The C macro isfinite() returns whether X is a finite value.
A finite value is any floating point value that  is neither
infinite nor NaN (Not a Number).
The type of X shall  be float, double or  long double. A non
zero value (true) if X is finite; and zero (false) otherwise.
Here are some examples:

isfinite(0.0)        = 1
isfinite(1.0/0.0)    = 0
isfinite(-2.0/0.0)   = 0
isfinite(sqrt(-4.0)) = 0

Please, press enter to continue...
The different checks may take a while.

Checking the REAL4 number 3.141593:
It's a finite floating point value.

         C-version       Assembly Language
         ---------       -----------------
Time     4.13 s          2.55 s

Please, press enter to continue...

Checking the REAL8 number 3.141592653589793:
It's a finite floating point value.

         C-version       Assembly Language
         ---------       -----------------
Time     5.65 s          2.55 s

Please, press enter to continue...
But I learned a new hard lesson: If a program runs fine under Windows 7, don't assume that it'll run also under Windows 8. Test that in any case.
That is not acceptable from Microsoft, that new system, which is just first generation after, is not able to run programs from former one.
Windows 8 SUCKS
« Last Edit: January 04, 2015, 07:40:03 PM by habran »
Cod-Father

Siekmanski

  • Member
  • *****
  • Posts: 2380
Re: Validity of floating point numbers without FPU code
« Reply #7 on: January 04, 2015, 06:47:03 PM »
Windows 8.1 x64 i7-4930K @ 3.40GHz

Code: [Select]
The C macro isfinite() returns whether X is a finite value.
A finite value is any floating point value that  is neither
infinite nor NaN (Not a Number).
The type of X shall  be float, double or  long double. A non
zero value (true) if X is finite; and zero (false) otherwise.
Here are some examples:

isfinite(0.0)        = 1
isfinite(1.0/0.0)    = 0
isfinite(-2.0/0.0)   = 0
isfinite(sqrt(-4.0)) = 0

Please, press enter to continue...
The different checks may take a while.

Checking the REAL4 number 3.141593:
It's a finite floating point value.

         C-version       Assembly Language
         ---------       -----------------
Time     5.42 s          2.53 s

Please, press enter to continue...

Checking the REAL8 number 3.141592653589793:
It's a finite floating point value.

         C-version       Assembly Language
         ---------       -----------------
Time     5.72 s          2.23 s

Please, press enter to continue...
Creative coders use backward thinking techniques as a strategy.

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: Validity of floating point numbers without FPU code
« Reply #8 on: January 05, 2015, 03:31:03 AM »
Habran,

That is not acceptable from Microsoft, that new system, which is just first generation after, is not able to run programs from former one.
Windows 8 SUCKS

the mistake was on my side. Windows 8 may suck or not, but it has nothing to do with the crash. The updated archive is cfnWin-64.zip under the first post. It runs fine under Win 7-64 and above (well, I hope so, it's to test). I've learned another hard lesson: Do not code important things late after midnight.

Marinus,

thank you for testing. Good machine!

Gunther
Get your facts first, and then you can distort them.

habran

  • Member
  • *****
  • Posts: 1225
    • uasm
Re: Validity of floating point numbers without FPU code
« Reply #9 on: January 05, 2015, 06:37:19 AM »
Quote
thank you for testing. Good machine!
$3500AU(!@#$%^&*)  :icon_redface:
I just wish it was Windows 7
I have a copy of "Windows 7 Home" and I hardly resisted not to install it
Cod-Father

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: Validity of floating point numbers without FPU code
« Reply #10 on: January 05, 2015, 09:27:04 AM »
Hi Habran,

Quote
thank you for testing. Good machine!
$3500AU(!@#$%^&*)  :icon_redface:
I just wish it was Windows 7
I have a copy of "Windows 7 Home" and I hardly resisted not to install it

Wow. That's a lot of money. Installing Win 7 could be a bit critical. Are the drivers for your hardware available? I did such a "downgrade" some years ago with my old AMD laptop. It was Vista pre-installed and I liked XP. So the driver question was very tricky. I found most drivers on a French site, but not all. The WLAN card didn't work under XP.

On the other hand, you can't use AVX 2 under Win 7. I think your CPU supports that instruction set, the OS not.

Gunther
Get your facts first, and then you can distort them.

habran

  • Member
  • *****
  • Posts: 1225
    • uasm
Re: Validity of floating point numbers without FPU code
« Reply #11 on: January 05, 2015, 09:54:43 AM »
I am not going to downgrade it because I invested to much money to have AVX2
What do you think about Windows 10 RC?
Should I install it on my machine?
I would also like to build AVX-512 in JWasm, so I will probably need Windows 10 for that
Cod-Father

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: Validity of floating point numbers without FPU code
« Reply #12 on: January 06, 2015, 12:04:52 AM »
Hi Habran,

What do you think about Windows 10 RC?
Should I install it on my machine?

I've no experiences with that, but sinsi has an installation running, I think.

I would also like to build AVX-512 in JWasm, so I will probably need Windows 10 for that

AVX512 is the future, no doubt about that. I think Intel provides a software emulator for the instruction set. The hardware seems to be not finished.

Gunther
Get your facts first, and then you can distort them.

habran

  • Member
  • *****
  • Posts: 1225
    • uasm
Re: Validity of floating point numbers without FPU code
« Reply #13 on: January 06, 2015, 06:17:04 AM »
I believe that sinsi will see this post and answer :biggrin:
Cod-Father

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: Validity of floating point numbers without FPU code
« Reply #14 on: January 06, 2015, 11:48:14 AM »
Hi Habran,

I believe that sinsi will see this post and answer :biggrin:

Probably. By the way, did you test the new version? It should run without crash on any 64-bit Windows since version 7. Thank you.

Gunther
Get your facts first, and then you can distort them.