-
SeitmanAsked on February 15, 2025 at 10:35 PM
I am performing some simple math in the conditional logic section to fill in the value of a number. I want a whole number, so I am using the "ceil" (ceiling) function to raise it to the next higher number. Unfortunately, I'm getting a result that is a negative number, when it ought to be positive.
I've extracted the pertinent info from my original form and placed it here: Form - Jotform Form Builder, which is my test/scrap form. The output of the form looks as follows (without my markups, of course)
-
Gian_D JotForm SupportReplied on February 16, 2025 at 8:34 AM
Hi David,
I cloned your form and tested it to see if I could replicate the issue, and I ran into the same issue. You can use the Abs function on your conditional logic formula to make it a positive value. Check out the screencast below:
-
SeitmanReplied on February 16, 2025 at 2:21 PM
I'm glad you could duplicate the error and that it was not caused by my own computer.
I can obtain the correct answer (as you mentioned) for now. However, if the calculation process comes up with incorrect answers, that means that every time I change one of the "fixed" numbers, I'll have to manually calculate what the magic number ought to be and then make a correction.
This is not how a reliable math procedure should work.
Don't you think this needs to be escalated immediately? How many other folks have used this calculation option and have obtained incorrect answers and never realized it? (rhetorical question).
I appreciate all the work which you folks have put into Jotform and I truly admire the result. However, as a person who has been programming for over 55 years, and who has needed to update multiple programs because of bugs I've later encountered, I feel an obligation to bring this bug to your attention, with the hopes that you will get your programmers to research and fix it. Thx.
-
Allan Brian JotForm SupportReplied on February 16, 2025 at 3:48 PM
Hi David,
Can you explain a bit more of the result you want to appear so we can have better idea what exactly needs to show up on your form? For complex math calculation, your can refer to our guide here.
Keep us updated and let us know if you need any more help.
-
SeitmanReplied on February 16, 2025 at 6:25 PM
Sure. I want the result to be correct! At present, the calculation before the ceil function is the negative of the true answer. Then the ceil function acts properly on the number passed to it. That is why a -35.3333 becomes -35. The ceil function should be returning the ceil (35.3333) which is 36.
I have not tried using other numbers to see if a result that should be a negative number comes up as positive number. But I view that as the job of the folks who will be trying to determine why the value returned is incorrect.
Unless you can tell me that I've made a mistake (and I don't think I have, especially because I placed parentheses everywhere so there would be no doubt as to the order of operation), then there is a bug in the calculation routine.
I solved the equation in the bottom half of the paragraph text, so that you would see that the result is incorrect.
-
Adrian Besilla JotForm SupportReplied on February 16, 2025 at 7:41 PM
Hi David,
I'll need a bit of time to look into this. I'll get back to you as soon as I can.
Thanks for your patience, we appreciate it.
-
Adrian Besilla JotForm SupportReplied on February 16, 2025 at 7:55 PM
Hi David,
If the calculation still didn't work after the solution provided by my colleague, can you take a screenshot of what’s happening and send it to us? This will help us understand more the issue with your calcution and we'll include it in our documention for possible escalation. We’ve got a guide here that’ll show you how to do that. Additionally, if we can make other testing with what you want to achieve with your form, that can help us figure out more the issue.
Once we hear back from you, we'll be able to move forward with a solution.
-
SeitmanReplied on February 16, 2025 at 9:31 PM
Using the ABS function to convert an incorrect negative number to a positive number is a workaround (not a solution) and might not work in the future when the values of the pseudo-constants (first number, first cost, rest cost, and max cost) change. For the case I presented, I can also put a minus sign in front of the calculation to force the correct number to be displayed. That is my temporary workaround.
What these numbers represent and how they might be changing in the future is immaterial. The calculated amount ("magic number") should always be correct.
I am re-uploading the images.
This is my marked up output. My mark ups are in red. See last image for the output of the form.
This is the logic condition showing how I calculated the field value for "magic number"
This is how the form looks. I've shown below the calculated value of "magic number" what the calculation should have been by going through the steps to solve the mathematical equation (which is what the logic condition does).
I do not understand why you do not seem to understand that the form is calculating incorrectly. There isn't anything else I can add that would help here. Since you were able to duplicate the problem with a clone of this form, you have all the information you need to see the miscalculation.
Thank you.
-
Israel JotForm SupportReplied on February 17, 2025 at 12:35 AM
Hi David,
I created a ticket and escalated this to our Developers. As soon as we have an update, we’ll let you know.
We really appreciate your patience and understanding while we’re looking into this.
-
Florence JotForm SupportReplied on February 17, 2025 at 5:11 AM
Hi David,
I cloned your form and tested it to see if I could replicate the issue, and I ran into the same issue. When I looked at your form, I saw that the Update/Calculate Field condition wasn't configured correctly. I've noticed that the formula is missing two parentheses, which are necessary for it to calculate correctly. Take a look at the screenshot below to see these parentheses:
Adding these parentheses' in the formula should resolve the issue. Check out my result below:
You may want to clone this form. This guide will show you How to Clone an Existing Form from a URL.
Keep us updated and let us know if you need any more help.
-
SeitmanReplied on February 17, 2025 at 1:17 PM
Thank you, Florence. The extra set of parentheses does indeed solve the problem.
I should point out that I still cannot fathom how (even if the operations were not performed in the order they were supposed to) a negative number was computed. The order-of-operations has been a computer standard since at least 1970 and has always been endorsed by major programming languages (Fortran, Basic, C, etc., as well as major computer manufacturers, such as IBM.
Since it appears that Jotforms requires an extra set of parentheses, I suggest either noting that in your User Guide or having the Developers look into removing this unusual requirement.
Thanks again.
-
Adrian Besilla JotForm SupportReplied on February 17, 2025 at 1:27 PM
MAR. Thank you reply.
Your Answer
Something Went Wrong
An error occurred while generating the AI response. Please try again!