Commit 8d86ce27 authored by Joachim Noreiko's avatar Joachim Noreiko Committed by Damien McKenna
Browse files

Issue #662692 by joachim, hanoii, ShaneOnABike, lunazoid, 5t4rdu5t: strange...

Issue #662692 by joachim, hanoii, ShaneOnABike, lunazoid, 5t4rdu5t: strange decimal precision error on floating numeric fields.
parent 05a734ee
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -132,12 +132,13 @@ class views_handler_field_numeric extends views_handler_field {
      $value = number_format($value, $this->options['precision'], $this->options['decimal'], $this->options['separator']);
    }
    else {
      $remainder = abs($value) - intval(abs($value));
      $point_position = strpos($value, '.');
      $remainder = ($point_position === FALSE) ? '' : substr($value, $point_position + 1);
      $value = $value > 0 ? floor($value) : ceil($value);
      $value = number_format($value, 0, '', $this->options['separator']);
      if ($remainder) {
        // The substr may not be locale safe.
        $value .= $this->options['decimal'] . substr($remainder, 2);
        $value .= $this->options['decimal'] . $remainder;
      }
    }