mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-09-24 10:48:17 +00:00
Properly use integers in exponentiation
Right now they're always float. Bug: T191688 Depends-On: I398c9a972b7e9fcb27d055d23939be2b8bb68244 Change-Id: I0bb1ed0109af66997e238b532d342d82d4c4ae19
This commit is contained in:
parent
2dda2e381c
commit
3e9a2dfd33
|
@ -136,7 +136,12 @@ class AFPData {
|
|||
* @return AFPData
|
||||
*/
|
||||
public static function pow( $base, $exponent ) {
|
||||
return new AFPData( self::DFLOAT, pow( $base->toFloat(), $exponent->toFloat() ) );
|
||||
$res = pow( $base->toNumber(), $exponent->toNumber() );
|
||||
if ( $res === (int)$res ) {
|
||||
return new AFPData( self::DINT, $res );
|
||||
} else {
|
||||
return new AFPData( self::DFLOAT, $res );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue