I think this is a bug in the musl implementation of the standard C library; 8-bit printf implements %lf but wide-char wprintf does not. (This can be seen in vfprintf.c and vfwprintf.c under emscripten/system/lib/libc/musl/src/stdio)
It looks like you can use %F for doubles on both functions, however. -- brion On Wed, Sep 11, 2019 at 2:16 PM Юрий Катков <[email protected]> wrote: > Hello everyone! > > I'm trying to print double with wprintf in stdout and some format > specifiers don't work. > > int main( int argc, char* argv[] ) > { > double val = 0.123; > > wprintf( L"1 %lf\n", val ); // FAIL > wprintf( L"2 %lf\n", static_cast<float>( val ) ); //FAIL > wprintf( L"3 %f\n", val ); // OK > wprintf( L"4 %f\n", static_cast<float>( val ) ); // OK > printf( "5 %lf\n", val ); // OK > printf( "6 %lf\n", static_cast<float>( val ) ); // OK > printf( "7 %f\n", val ); // OK > printf( "8 %f\n", static_cast<float>( val ) ); // OK > > return 0; > } > > And what I see in console: > 3 0.123000 > 4 0.123000 > 5 0.123000 > 6 0.123000 > 7 0.123000 > 8 0.123000 > > Why %ls doesn't work with wprintf ? > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/e4cce172-ac25-45f7-9bd1-879b96208c23%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/e4cce172-ac25-45f7-9bd1-879b96208c23%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAFnWYT%3D8%3DULRNH2FZQVJbB3qdKJU%3DWJDXiDuWz-70HXHX6ArsA%40mail.gmail.com.
