Artifacts Associated With Ticket b7834045b9126bb6
Ticket change [f0d8e57306] (rid 239790) by oehhar on 2025-05-05 14:23:26:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
I tried today to compile the branch core-8-6-branch with MS-VC6++ in 32 bit mode. I got the following error messages: <verbatim> generic\tclStrToD.c(1669) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64 generic\tclStrToD.c(1683) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64 generic\tclStrToD.c(1697) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64 </verbatim> The compiler can not do: <verbatim> Tcl_WideUInt significand; (double)significand </verbatim> Checkout: <verbatim> checkout: ad842e3313634f598b29ac58494b5b7bd1c85c67 2025-04-16 17:34:13 UTC parent: 87abac372cb137f79032e7bd022a48e6f7bbf31e 2025-04-15 12:00:56 UTC tags: core-8-6-branch </verbatim> I am only reporting. It is ok to not support this compiler. But in the past, we did. Thanks for all, Harald
- foundin initialized to: "core-8-6-branch"
- is_private initialized to: "0"
- login: "oehhar"
- priority initialized to: "5 Medium"
- private_contact initialized to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "oehhar"
- subsystem initialized to: "48. Number Handling"
- title initialized to: "MS-VC 6 compile error"
- type initialized to: "Bug"
Ticket change [02d62c0ffa] (rid 239791) by oehhar on 2025-05-05 14:24:30:
- login: "oehhar"
- mimetype: "text/plain"
- title changed to:
MS-VC 6 on core-8-6-branch: compile error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
Ticket change [1ddd5dd92f] (rid 239832) by oehhar on 2025-05-05 16:07:19:
- icomment:
Jan, thanks for the fix. I tested on MS-VC 6 32 bit: <verbatim> ==== scan-15.1 scan %g overflow for small numbers and big mantissa bug 42d14c495a FAILED ==== Contents of test case: set result [list] # xfail: n<num> = not expected at all, x<num> expected when unfixed foreach {exp numdig ret xfail} { -321 190 1.111647703142804724397279783953498087821e-321 n0 -321 191 1.111647703142804724397279783953498087821e-321 x1 -321 300 1.111647703142804724397279783953498087821e-321 x2 -321 1600 1.111647703142804724397279783953498087821e-321 x3 -400 110 0 n4 -400 111 0 n5 -400 300 0 n6 -221 290 1.111111111111110993454921768172890541494e-221 n7 -221 291 1.111111111111110993454921768172890541494e-221 x8 -221 400 1.111111111111110993454921768172890541494e-221 x9 -221 1600 1.111111111111110993454921768172890541494e-221 x10 -121 390 1.111111111111111182884141698869046969295e-121 n11 -121 391 1.111111111111111182884141698869046969295e-121 x12 -121 500 1.111111111111111182884141698869046969295e-121 x13 -121 1600 1.111111111111111182884141698869046969295e-121 x14 308 202 1.111111111111111167662077577927612945036e+308 n15 308 203 1.111111111111111167662077577927612945036e+308 n16 308 300 1.111111111111111167662077577927612945036e+308 n17 308 1600 1.111111111111111167662077577927612945036e+308 x18 400 110 inf n19 400 111 inf n20 400 300 inf n21 221 291 1.111111111111111207481621395250718679869e+221 n22 221 292 1.111111111111111207481621395250718679869e+221 n23 221 400 1.111111111111111207481621395250718679869e+221 n24 221 1600 1.111111111111111207481621395250718679869e+221 x25 121 391 1.11111111111111112711771954138363761759e+121 n26 121 392 1.11111111111111112711771954138363761759e+121 n27 121 500 1.11111111111111112711771954138363761759e+121 n28 121 1600 1.11111111111111112711771954138363761759e+121 x29 } { set s 1.[string repeat 1 $numdig]e$exp set d "no_scan" scan $s %g d set r [format %.40g $d] if {$r ne $ret} { lappend result $xfail=[format %.40g $d] } } set result ---- Result was: n0=1.1116477031428047e-321 x1=1.1116477031428047e-321 x2=1.1116477031428047e-321 x3=1.1116477031428047e-321 n7=1.111111111111111e-221 x8=1.111111111111111e-221 x9=1.111111111111111e-221 x10=1.111111111111111e-221 n11=1.1111111111111112e-121 x12=1.1111111111111112e-121 x13=1.1111111111111112e-121 x14=1.1111111111111112e-121 n15=1.1111111111111112e+308 n16=1.1111111111111112e+308 n17=1.1111111111111112e+308 x18=1.1111111111111112e+308 n19=1.#INF n20=1.#INF n21=1.#INF n22=1.1111111111111112e+221 n23=1.1111111111111112e+221 n24=1.1111111111111112e+221 x25=1.1111111111111112e+221 n26=1.1111111111111111e+121 n27=1.1111111111111111e+121 n28=1.1111111111111111e+121 x29=1.1111111111111111e+121 ---- Result should have been (exact matching): ==== scan-15.1 FAILED </verbatim> It does not fail with MS-VS 2022 on 64 bit. There, all is still ok. We may accept this failure as platform specific. Nevertheless, to cast this for all compilers on core-8-6-branch scares me a bit... Thanks for all, Harald - login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Ticket change [3c0ece4766] (rid 240010) by dkf on 2025-05-13 09:06:46:
- icomment:
Also failing in CI on Windows (this is from the `core-9-0-branch` tip) with gcc. ``` ---- Result was: n0=1.1116477031428047e-321 x1=1.1116477031428047e-321 x2=1.1116477031428047e-321 x3=1.1116477031428047e-321 n7=1.111111111111111e-221 x8=1.111111111111111e-221 x9=1.111111111111111e-221 x10=1.111111111111111e-221 n11=1.1111111111111112e-121 x12=1.1111111111111112e-121 x13=1.1111111111111112e-121 x14=1.1111111111111112e-121 n15=1.1111111111111112e+308 n16=1.1111111111111112e+308 n17=1.1111111111111112e+308 x18=1.1111111111111112e+308 n19=1.#INF n20=1.#INF n21=1.#INF n22=1.1111111111111112e+221 n23=1.1111111111111112e+221 n24=1.1111111111111112e+221 x25=1.1111111111111112e+221 n26=1.1111111111111111e+121 n27=1.1111111111111111e+121 n28=1.1111111111111111e+121 x29=1.1111111111111111e+121 ---- Result should have been (exact matching): ``` It looks suspiciously like this might be a bug with the particular libc, which opts to truncate the number of digits in this case.
- login: "dkf"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [6c3357adbc] (rid 240018) by jan.nijtmans on 2025-05-13 10:38:42:
- icomment: "Let's see how [4b45f1c70f86a511|this] works better"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [887c4595bc] (rid 240021) by chw on 2025-05-13 14:23:30:
- icomment:
My admittedly limited understanding of Tcl's format command is that it does not depend on the C library w.r.t. sprintf(…%g…). This was the reason I've chosen %.40g in my proposed test. So there must some other thing be fishy in the code.
- login: "chw"
- mimetype: "text/plain"
- icomment:
Ticket change [0f51ae3259] (rid 240022) by chw on 2025-05-13 14:32:22:
- icomment:
Turns out I was wrong, there's a magic sprintf(bytes, spec, d) which does the heavy lifting using the C library. Makes me wonder how much effort we've spent on scanning compared to this solution.
- login: "chw"
- mimetype: "text/plain"
- icomment:
Ticket change [9856d4705a] (rid 240055) by jan.nijtmans on 2025-05-14 09:21:04:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2460809.88963003"
- closer changed to: "jan.nijtmans"
- icomment:
I 'fixed' the last 3 lines in the testcase which was still failing: Not all C runtimes spit out "inf" for Inf. Closing
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [d208780e78] (rid 240068) by oehhar on 2025-05-14 11:29:11:
- closedate changed to: "2460809.97860225"
- closer changed to: "oehhar"
- icomment:
Great, thank you. Out of curiosity, what do others return? "-Inf" ? Would it be reasonable to compare with [expr {isinf($f)}] or tcl::mathfunc::isinf $f ? Thanks for all, Harald - login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
Ticket change [21ca13c662] (rid 240069) by jan.nijtmans on 2025-05-14 12:04:06:
- closedate changed to: "2460810.00285414"
- closer changed to: "jan.nijtmans"
- icomment:
> Out of curiosity, what do others return? "-Inf" ? GCC included with Mingw-W64 (the version used in Github CI) returns "1.#INF". >Would it be reasonable to compare with [expr {isinf($f)}] or tcl::mathfunc::isinf $f ? That wouldn't work. "expr" doesn't know what to do with "1.#INF" ;-) I suspect this is a temporary problem. If modern C runtimes just return "inf", everything is OK. Not worth to spend more time on it. - login: "jan.nijtmans"
- mimetype: "text/plain"