Error warning: Divide by zero on "0"
- Status
- Closed
- Subject
- Error warning: Divide by zero on "0"
- Version
- 21.x
- Category
- Usability
- Feature
- Trackers
- Resolution status
- Works For Me
- Submitted by
- Mike Finko
- Keep informed
- Jonny Bradley, Victor Emanouilov
- Lastmod by
- Mike Finko
- Rating
- Related-to
- Description
This error message is from Tracker Mathematical Calculations.
This warning keeps popping up - can the warning be eliminated? Or, if I am incorrect and my mathematical calculation should instead be corrected, please advise.
Copy to clipboard(round(div(div(date (sub futureDate (date)))60)60)1)
See more notes I added in the 'Forums' here - https://tiki.org/forumthread75298--Divide-by-Zero-warningThis is important because Tiki 21x is the latest LTS.
Adding Jonny and Victor as it seems you both tried to correct the issue.
thanks,
Mike- Workaround
See the 'Related' item for Bernard Sfez's post - Jonny's recommended workaround also worked in this situation:
"The workaround I did was to add an 'if' around it (which I think is good practice anyway), e.g."
Copy to clipboard(if childrenBirthDate (round (div (sub (date) childrenBirthDate) 31536000 ) 1))
In my situation this is what the mathematical formula looks like:Copy to clipboard(if futureDate (round(div(div(date (sub futureDate (date)))60)60)1))
So with this formula, no more 'Divide by '0'' error messages.Though I have no idea how it works or why, it seems as though this is not a TIki problem but an issue of how my mathematical formula was incorrectly put together.
- Importance
- 7
- Easy to solve?
- 5
- Priority
- 35
- Demonstrate Bug on Tiki 19+
-
This bug has been demonstrated on show2.tiki.org
Please demonstrate your bug on show2.tiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show2.tiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Demonstrate Bug (older Tiki versions)
-
This bug has been demonstrated on show.tikiwiki.org
Please demonstrate your bug on show.tikiwiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show.tikiwiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Ticket ID
- 7590
- Created
- Monday 02 November, 2020 12:52:45 UTC
by Mike Finko - LastModif
- Monday 02 November, 2020 19:54:27 UTC