News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Validity of floating point numbers without FPU code

Started by Gunther, January 04, 2015, 05:49:30 AM

Previous topic - Next topic

Gunther

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:

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
You have to know the facts before you can distort them.

jj2007

Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
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

AMD A10-7850K APU @3.70 GHz

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

Hi Gunther :biggrin:
Windows 8.1 is trowing an error in third asm function   ( value in [ecx] is wrong ) :(
Cod-Father

Gunther

Thank you, Jochen and Sinsi.

Quote from: habran on January 04, 2015, 10:56:53 AM
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
You have to know the facts before you can distort them.

Gunther

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
You have to know the facts before you can distort them.

habran

#6
Windows 8.1 x64 Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz

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...

Quote from: Gunther on January 04, 2015, 12:34:08 PM
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
Cod-Father

Siekmanski

Windows 8.1 x64 i7-4930K @ 3.40GHz

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

Habran,

Quote from: habran on January 04, 2015, 03:55:57 PM
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
You have to know the facts before you can distort them.

habran

Quotethank 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

Hi Habran,

Quote from: habran on January 05, 2015, 06:37:19 AM
Quotethank 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
You have to know the facts before you can distort them.

habran

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

Hi Habran,

Quote from: habran on January 05, 2015, 09:54:43 AM
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.

Quote from: habran on January 05, 2015, 09:54:43 AM
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
You have to know the facts before you can distort them.

habran

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

Gunther

Hi Habran,

Quote from: habran on January 06, 2015, 06:17:04 AM
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
You have to know the facts before you can distort them.