Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2016-10-10
04:57 • Ticket [7114ac6141] Tcl_GetInt and Tcl_GetDouble: imperfect documentation st... artifact: d6fe90c388 user: zoltan3
2016-10-09
15:25 • Ticket [7114ac6141]: 4 changes artifact: 39ab4f8764 user: dkf
15:24 • Closed ticket [7114ac6141]. artifact: d50dcf8c1e user: dkf
15:22
[7114ac6141] Improve testing and docs of Tcl_GetInt and Tcl_GetDouble. No behaviour change. check-in: 925103116e user: dkf tags: trunk
15:21
[7114ac6141] Improve testing and docs of Tcl_GetInt and Tcl_GetDouble. No behaviour change. check-in: aa50b70914 user: dkf tags: core-8-6-branch
2016-08-25
10:12 • New ticket [7114ac6141] Tcllib: Tcl_GetInt and Tcl_GetDouble: imperfect docu... artifact: 4f2de39107 user: zoltan3

Tcl_GetInt and Tcl_GetDouble: imperfect documentation

Closed / Fixed7114ac6141b45ffa2b7b1dae14e224764de051d6Created 10 years agoUpdated 10 years ago
Descriptionplain2016-08-25 10:12:14
Tcl_GetInt:
- accepts white spaces behind as well.
- "If the first two characters..." of the part with "digits".
- new 8.5+ formats are not documented.

Tcl_GetDouble:
- decimal point can't be omitted in all of the cases. (e.g. "09")


-------------
Current docu:

Tcl_GetInt expects src to consist of a collection of integer digits, optionally signed and optionally preceded by white space. If the first two characters of src after the optional white space and sign are “0x” then src is expected to be in hexadecimal form; otherwise, if the first such character is “0” then src is expected to be in octal form; otherwise, src is expected to be in decimal form.

Tcl_GetDouble expects src to consist of a floating-point number, which is: white space; a sign; a sequence of digits; a decimal point; a sequence of digits; the letter “e”; a signed decimal exponent; and more white space. Any of the fields may be omitted, except that the digits either before or after the decimal point must be present and if the “e” is present then it must be followed by the exponent number.
Referenced by2
  • 925103116e[7114ac6141] Improve testing and docs of Tcl_GetInt and Tcl_GetDouble. No behaviour change. check-in2016-10-09 15:22:20
  • aa50b70914[7114ac6141] Improve testing and docs of Tcl_GetInt and Tcl_GetDouble. No behaviour change. check-in2016-10-09 15:21:26
dkfwiki2016-10-09 15:24:21

Those should have been documented when we changed the number parsing in 8.6. Docs fixed now and the test cases improved so that we're more sensitive to things in this area.

dkf Ticket [7114ac6141]: 4 changes [History diff]2016-10-09 15:25:14
zoltan3plain2016-10-10 04:57:50
Thank you.

The following parts are relevant e.g. in 8.4 and 8.5 as well:

Tcl_GetInt:
- accepts white spaces behind as well.
- "If the first two characters..." of the part with "digits".
Log in (anonymous is fine) to add a comment.