Closed petemud closed 2 weeks ago
I don't think guarantees like scanned == val are expected when using scanf-like functions for floating-point numbers.
@MikeMirzayanov Is it not expected that scanf
ed number equals to cin
ed number or one converted with from_chars
? You can argue that it's not expected from scanf
, but it's definitely expected from testlib
. See where this issue was relevant in a contest https://codeforces.com/blog/entry/127855#comment-1151560
There is a bug in
mingw-w64
implementation ofsscanf
when reading doubles (seemingw-w64/bugs/989
).sscanf
is used to read doubles here:testlib/0.9.41/testlib.h:3562
. Andtestlib
is run on Codeforces undermingw-w64
.I'm guessing it's gonna take a while for it to get fixed and pushed through deployment pipelines.
Meanwhile you can detect compilation target with something like
#ifdef __MINGW64_VERSION_MAJOR
(see Detect mingw thread) and switch to some alternative that doesn't have bugs underminw-w64
, such asstd::from_chars
After it gets fixed, you can switch back to
sscanf
on#if __MINGW64_VERSION_[MAJOR|MINOR|BUGFIX] >= fixed_version