Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#9079 closed defect (bug) (fixed)

Documentation correction: absint()

Reported by: mdawaffe's profile mdawaffe Owned by: mdawaffe's profile mdawaffe
Milestone: 2.8 Priority: normal
Severity: minor Version: 2.7
Component: General Keywords: documentation, has-patch
Focuses: Cc:

Description

Documentation currently states:
"Converts value to positive integer."

Should state:
"Converts value to nonnegative integer."

Attachments (1)

9079.diff (647 bytes) - added by mdawaffe 16 years ago.

Download all attachments as: .zip

Change History (7)

@mdawaffe
16 years ago

#1 @mdawaffe
16 years ago

  • Owner changed from anonymous to mdawaffe
  • Severity changed from normal to minor
  • Status changed from new to assigned
  • Version set to 2.7

#2 @mdawaffe
16 years ago

  • Keywords has-patch added

#3 @azaozz
16 years ago

Wouldn't it be clearer to use the "math" language there: "Converts value to absolute integer."

Looking at how this is used, perhaps we need something different there. Currently absint(100) returns 100, absint(-100) returns 100 too but is used to filter various db IDs where -100 is an invalid value. Perhaps we need something like:

function absint( $maybeint ) {
  if ( intval( $maybeint ) < 1 )
    return 0;

  return intval( $maybeint );
}

#4 follow-up: @mdawaffe
16 years ago

"nonnegative" is "math" language :)

http://mathworld.wolfram.com/Nonnegative.html

http://en.wikipedia.org/wiki/Negative_and_non-negative_numbers

I have not heard "absolute integer" before.

It probably doesn't matter how the function actually works, as long as it never returns negative numbers.

#5 in reply to: ↑ 4 @azaozz
16 years ago

Replying to mdawaffe:

I have not heard "absolute integer" before.

Agreed, that should have been something like "Converts an integer to it's absolute value." but nonnegative sounds better.

#6 @azaozz
16 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [10540]) Documentation correction: absint(), props mdawaffe, fixes #9079

Note: See TracTickets for help on using tickets.