On Sun, 10 Jul 2011 12:38:51 -0500, Nate Hayes wrote:
Baker, P1788,
I ran a few tests this morning.
The first test performs 1 billion additions by explicitly:
-- saving the state of the processor rounding mode
-- setting rounding mode to "round up"
-- performing the floating-point addition
-- restoring the processor rounding mode to the saved state
The second test performs 1 billion additions in "round to nearest"
mode by:
-- performing the floating-point addition
-- adjusting the result of the addition by incrementing 1 ULP
Both tests were run on
AMD Athlon 64 FX-60 Dual Core Processor 2.60 GHz
on 64-bit Windows 7, and compiled with Microsoft Visual Studio 2010
Ultimate
optimizing compiler.
Attached is the source code so people could try running on different
platforms, if they wish.
I am sorry for the previous post, I pressed the wrong button and I send
an unfinished message.
I tried the code provided by Nate Hayes. I run it on
Intel i5 2.27GHz
on 64-bit Windows 7
and compiled the code with Microsoft Visual Studio 2008 Professional
optimization was set to Maximum speed.
I got the following result (if any one is interested):
21400, 2.14e-005
21400, 2.14e-005
1000000000 additions:
Changing rounding mode: 6 seconds
Nextup method: 12 seconds
Press any key to continue . . .
Best regards,
Iwona Skalna