Loading...
 
Skip to main content

TrackerList compute 'sum' returns "7.105427357601E-015"

Status
Open
Subject
TrackerList compute 'sum' returns "7.105427357601E-015"
Version
12.x
Category
  • Usability
  • Feature request
Feature
Trackers
Resolution status
New
Submitted by
Mike Finko
Lastmod by
Xavier de Pedro
Rating
(0)
Description

When using TrackerList compute function (sum of a column), sometimes it returns the number: 7.105427357601E-015

Image

This is reported on several php forums and is not a bug but: "its the acceptable precision of floating point numbers" or also described as "Subtracting 2 floats returns incorrect results".

Seems that a workaround patch may be necessary as one post suggests:
"so I guess you need to hack it: if ($resultB < 0.000) $resultB = 0;"

Here are links:
http://forums.oscommerce.com/topic/199647-php-math-bug-big-problem/

https://bugs.php.net/bug.php?id=41213&edit=1

http://grokbase.com/t/php/php-bugs/074v5dv79q/41213-new-subtracting-2-floats-returns-incorrect-results

br,
Mike

Workaround

Use mathematical calculation field instead
https://doc.tiki.org/Mathematical+Calculation+Tracker+Field

with the advanced syntax:
https://doc.tiki.org/Advanced+Rating

Or the new features added in TableSorter in Tiki15 for sums and averages of data in the table, etc.: param "tstotals".


The compute field is deprecated (risky, security-wise) and will not be extended anymore, I'm afraid.

Importance
5
Priority
25
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
5968
Created
Wednesday 01 June, 2016 14:46:00 UTC
by Mike Finko
LastModif
Thursday 02 June, 2016 07:43:27 UTC


Show PHP error messages