summaryrefslogtreecommitdiffstats
path: root/src/axis
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2009-03-25 10:56:00 +0000
committerKore Nordmann <github@kore-nordmann.de>2009-03-25 10:56:00 +0000
commit04b1e75ef1940831624f318a8a614f81366840ae (patch)
tree4d117b88cac8b96feb7285f682361250bb6f3599 /src/axis
parent315ef1f26d86d573a2443d6c23dbbdf6e699ebbb (diff)
downloadzetacomponents-graph-04b1e75ef1940831624f318a8a614f81366840ae.zip
zetacomponents-graph-04b1e75ef1940831624f318a8a614f81366840ae.tar.gz
- Fixed #14651: Handle floor() floating point inaccuracies in numneric axis
step evaluation
Diffstat (limited to 'src/axis')
-rw-r--r--src/axis/numeric.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/axis/numeric.php b/src/axis/numeric.php
index 43a4fe8..19ecf96 100644
--- a/src/axis/numeric.php
+++ b/src/axis/numeric.php
@@ -383,7 +383,10 @@ class ezcGraphChartElementNumericAxis extends ezcGraphChartElementAxis
// Check that the major step size matches up with the min and max
// values on the axis.
- if ( ( ( $quotient = ( $this->properties['max'] - $this->properties['min'] ) / $this->properties['majorStep'] ) - floor( $quotient ) ) > .00001 )
+ $quotient = ( $this->properties['max'] - $this->properties['min'] ) / $this->properties['majorStep'];
+ $quotient = abs( $quotient - floor( $quotient ) );
+ if ( ( $quotient >= .00001 ) &&
+ ( abs( $quotient - 1 ) >= .00001 ) )
{
throw new ezcGraphInvalidStepSizeException( "The difference between minimum and maximum value is not a multiplier of the major step size." );
}
OpenPOWER on IntegriCloud