Post Ahe4nJsikcTm830oAS by vftdan@mastodon.ml
 (DIR) More posts by vftdan@mastodon.ml
 (DIR) Post #Ahe4nDeJvFOYneEDtA by vftdan@mastodon.ml
       2022-04-25T19:38:33Z
       
       0 likes, 0 repeats
       
       #c++ #cpp #emscripten #programmingI have this c++ code:```...stringstream stream("23.4f");float f;char c;stream >> f;stream.get(c);cout << "Float = " << f << endl << "Character = " << c << endl;...```In ideone.com it works as expected (f = 23.4, c = 'f'). But when I have a code, that should be essentially equivalent, and I compile it with em++ (emscripten), I get f = 0 & failed stream. What could be causing this problem?
       
 (DIR) Post #Ahe4nFtzXx7RmpZlaq by vftdan@mastodon.ml
       2022-04-25T20:41:47Z
       
       0 likes, 0 repeats
       
       It happens here: https://github.com/Vftdan/webNBT/blob/6474bdfe1ffa6b34feb06d078a56b3241ad01d1c/nbt-utils/nbt_utils.cpp#L418
       
 (DIR) Post #Ahe4nGDUNSiOlIhKz2 by vftdan@mastodon.ml
       2022-04-25T19:45:40Z
       
       0 likes, 0 repeats
       
       cc @heavywizardy@ms.neko.bar @heavywizardy@fw.neko.bar
       
 (DIR) Post #Ahe4nI5PQTRMYovufQ by vftdan@mastodon.ml
       2022-04-27T08:36:01Z
       
       0 likes, 0 repeats
       
       I have described reproduction stepshttps://github.com/Vftdan/webNBT/issues/1#issuecomment-1110712892
       
 (DIR) Post #Ahe4nJsikcTm830oAS by vftdan@mastodon.ml
       2022-04-29T15:39:16Z
       
       0 likes, 0 repeats
       
       #cppAnother question:How do I print float number into stream, so that: * all non-zero digits must be printed (except those, that do not change in-memory representation of that number) * at least 1 digit before & after decimal point (even zero) must be printed * scientific notation is never used * all zeros not required by the second condition must not be printedExamples:```0.01.01.130000.1231000000000.0```
       
 (DIR) Post #Ahe4nKQki5hXpavzDE by vftdan@mastodon.ml
       2022-04-27T11:55:59Z
       
       0 likes, 0 repeats
       
       Does that mean that hexadecimal digits [a-f] must not be accumulated in the middle of decimal 32 bit floating-point number?