News:

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

Main Menu

Windows 10 and new crt

Started by TouEnMasm, August 19, 2015, 06:09:56 PM

Previous topic - Next topic

TouEnMasm

Hello,
Just for test , I put a sample of printf (inline function put in a lib 64 bits) showing the new
number of digits displayed with float number.
It is the one choose by Microsoft (in asm)
Quote
printf("%.0f\n", pow(2.0, 80))
    Old:  1208925819614629200000000
    New:  1208925819614629174706176

Did it work on other Windows version and what is needed ?
Some tests will answer the question.
Thanks for testing it.
Fa is a musical note to play with CL

rrr314159

I don't have some libraries you're using: vcruntime.lib, ucrt.lib, printf_console.lib, math.lib. But large numbers can be printed using %llx and %llf - as I remember. However they're not working for some reason, just getting 1208925819614629200000000. Perhaps I have to use xmm0 instead of rax. Don't have time to look into it now, but it's discussed in nvk macros thread (second page, with vertograd).

BTW as I remember he said he'd be back in August, wonder where he is
I am NaN ;)

jj2007

It seems CRT has raised the precision to either arbitrary or REAL16 :t
Would be interesting to see some timings then ;-)

include \masm32\MasmBasic\MasmBasic.inc      ; download
  Init
  PrintLine "2^80=", Tb$, "1.208925819614629174706176 × 10^24 (Wolfram Alpha)"
  fld FP10(80.0)
  fld1
  fscale
  Inkey Str$("2^80=\t%Jf (MasmBasic)", ST(0))
  Exit
end start

2^80=   1.208925819614629174706176 × 10^24 (Wolfram Alpha)
2^80=   1.208925819614629175e+24 (MasmBasic)

TouEnMasm

For rrr314159
It's the new CRT coming with Windows 10
If you see "1208925819614629200000000" this mean that you haven't the new CRT.
The interesting part is that it work and give the result of the old CRT.

vcruntime.lib, ucrt.lib come with the new crt
Other's lib (generic names) are libraries made at hand with stdio.h and math.h (inline functions).

for jj2007
For timing,the CRT had been rewrite in .cpp instead of .c.
This seem to give faster execution to Windows 10.
The printf function is said to divide by 7 the execution time.
A source file can be helpfull.
Fa is a musical note to play with CL

jj2007

Quote from: ToutEnMasm on August 20, 2015, 04:36:23 AMthe CRT had been rewrite in .cpp instead of .c.
This seem to give faster execution to Windows 10.
The printf function is said to divide by 7 the execution time.
A source file can be helpfull.

I doubt that they write speed-critical functions in C++. Some time ago I had a "code challenge" (not here) with some C++ fans, and my assembler routine was a factor 10 faster. Under the hood, in the disassembly, the code looked very crappy. It is an urban legend that compilers can beat assembler.

Anyway, if sprintf() is competitive, we have a reason to launch a nice thread in the Laboratory :greensml: