Issues

ZF-5879: 0.000000234 << not a float!?

Issue Type: Bug Created: 2009-02-24T11:49:54.000+0000 Last Updated: 2009-02-26T04:38:41.000+0000 Status: Resolved Fix version(s): - 1.7.6 (02/Mar/09)

Reporter: Dolf Schimmel (Freeaqingme) (freak) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Locale

Related issues: Attachments:

Description

<pre class="highlight"><?php
require_once 'Zend/Validate.php';
$float = 0.000000234;

var_dump(Zend_Validate::is($float,'Float'));

// false


<pre class="highlight"><?php
require_once 'Zend/Validate.php';
$float = 1.0000000234;

var_dump(Zend_Validate::is($float,'Float'));

// true


<pre class="highlight"><?php
require_once 'Zend/Validate.php';
$float = 0.000050004;

var_dump(Zend_Validate::is($float,'Float'));

//false


<pre class="highlight"><?php
require_once 'Zend/Validate.php';
$float = 0.005000004;

var_dump(Zend_Validate::is($float,'Float'));

//true

In other words: 100% valid floats are not considered a float.

Comments

Posted by Alexander Veremyev (alexander) on 2009-02-26T04:36:47.000+0000

The problem is caused by float numbers recognition within Zend_Locale_Format. E notation is not processed.

0.000050004 and 0.000000234 are transformed into '5.0004E-5' and '2.34E-7' then they passed into Zend_Locale_Format::isFloat()

Posted by Alexander Veremyev (alexander) on 2009-02-26T04:38:41.000+0000

Fixed with r14170

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts