[wp-trac] [WordPress Trac] #28559: Unit tests: ABSINT() returns bad result for large or long numbers

WordPress Trac noreply at wordpress.org
Sun Oct 4 20:48:56 UTC 2015


#28559: Unit tests: ABSINT() returns bad result for large or long numbers
-------------------------+----------------------
 Reporter:  pbearne      |       Owner:
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  General      |     Version:  2.5
 Severity:  normal       |  Resolution:  wontfix
 Keywords:               |     Focuses:
-------------------------+----------------------
Changes (by aaroncampbell):

 * keywords:  has-patch =>
 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  Awaiting Review =>


Comment:

 Using `gmp_intval` doesn't actually fix this (I don't think we'd want to
 try to use it even if it did, but it doesn't):

 {{{
 #!php
 var_dump( (int) 4.999999999999999 ); // 4
 var_dump( (int) 4.9999999999999999 ); // 5
 var_dump( gmp_intval( 4.999999999999999 ) ); // 4
 var_dump( gmp_intval( 4.9999999999999999 ) ); // 5
 }}}

 Having said that, it also seems to me like unit tests for `abs()` or
 casting to an int belong in PHP's unit tests not ours.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28559#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list