Opened 10 years ago
Closed 10 years ago
#3042 closed Bug (Fixed)
Number(): Remarks needs rework
Reported by: | c.haslam | Owned by: | Jpm |
---|---|---|---|
Milestone: | 3.3.13.21 | Component: | Documentation |
Version: | 3.3.13.20 | Severity: | None |
Keywords: | Cc: |
Description
Remarks says: A string beginning with digits has non-numeric characters stripped. I read this to mean that Number('12cat34') returns 1234, but it actually returns 12.
Remarks says Default behavior results in auto-sized integer. But Number() returns floating-point for e.g. Number('12.34').
So I suggest that Remarks be replaced by:
If the expression is a number, a number is returned.
If the expression is a string, Number() scans the string, rightward, starting from the left end, for characters that can constitute a number, starting from the left end. It stops scanning at the first character that cannot be part of a number.
In its scanning, Number() accepts a leading + (or -) sign, but not commas. If the first character cannot be part of number, Number() returns zero.
By default, for expressions that can be evaluated to an integer, Number() returns a type based on the size of the number: a 32-bit integer if the number will fit in a 32-bit integer, else a 64-bit integer.
Attachments (0)
Change History (1)
comment:1 Changed 10 years ago by Jpm
- Milestone set to 3.3.13.21
- Owner set to Jpm
- Resolution set to Fixed
- Status changed from new to closed
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Fixed by revision [11314] in version: 3.3.13.21