Modify

Opened 11 years ago

Closed 11 years ago

#3042 closed Bug (Fixed)

Number(): Remarks needs rework

Reported by: c.haslam Owned by: J-Paul Mesnage
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 by J-Paul Mesnage, 11 years ago

Milestone: 3.3.13.21
Owner: set to J-Paul Mesnage
Resolution: Fixed
Status: newclosed

Fixed by revision [11314] in version: 3.3.13.21

Modify Ticket

Action
as closed The owner will remain J-Paul Mesnage.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.