Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Step Validator uses the unprecise fmod function and fails for floats that are internally represented differently #2597

Closed
zfbot opened this issue Sep 28, 2012 · 2 comments

Comments

@zfbot
Copy link

zfbot commented Sep 28, 2012

Jira Information

Original Issue:ZF2-572
Issue Type:Bug
Reporter:pdobrigkeit
Created:09/19/12
Assignee:weierophinney
Components:Zend\Validator

Description

Giving the step validator a value that cannot be correclty interpreted gives seemingly wrong results in the fmod function.

For example value 15.5, step 0.1 gives a fmod of 0.099999999999999 and not 0.0.

@zfbot
Copy link
Author

zfbot commented Sep 28, 2012

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF2-572

Known GitHub users mentioned in the original message or comment:
@pdobrigkeit, @weierophinney

@cgmartin
Copy link
Contributor

Looks like this may have been resolved in 34e8ab8 , for I was not able to reproduce against master with the following test:

    public function testZf2572()
    {
        $this->_validator->setStep(0.1);
        $this->assertTrue($this->_validator->isValid(15.5));
    }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants