33 public function validate( $name, $value, array $settings, array $options ) {
35 if ( !preg_match(
'/^[+-]?(?:\d*\.)?\d+(?:[eE][+-]?\d+)?$/D', $value ) ) {
36 $this->
failure(
'badfloat', $name, $value, $settings, $options );
40 if ( !is_finite( $ret ) ) {
41 $this->
failure(
'badfloat-notfinite', $name, $value, $settings, $options );
44 return $this->
checkRange( $ret, $name, $value, $settings, $options );
47 public function stringifyValue( $name, $value, array $settings, array $options ) {
49 $digits = defined(
'PHP_FLOAT_DIG' ) ? PHP_FLOAT_DIG : 15;
50 return sprintf(
"%.{$digits}g", $value );
53 public function getHelpInfo( $name, array $settings, array $options ) {
54 $info = parent::getHelpInfo( $name, $settings, $options );