Float displaying with a bunch of random numbers after decimal.
Answered
We do weekly releases of an in house software. So I have a custom field in a project that is a float that is used for the build number. I am using a on schedule workflow to find last weeks ticket and generate a new ticket and automatically go to the next build number. I am using the following code to get the value for the previous build number and get the next build number.
var Previous_Build = ctx.issue.fields.Build_Number;
var Next_Build = Previous_Build + 0.001;
console.log("Build: " + Next_Build);
So the previous build is 1.175 and gets +0.001. It should just be 1.176 but my console shows up as 1.176999855041504.
I believe this may be a bug. Is there a workaround or a way to remove the trailing numbers without rounding or a way to round down?
Please sign in to leave a comment.
discussing in a support request
The random numbers after the float are still an issue but the workaround was to just round the numbers.
This rounds up the last digit and leaves 3 decimal places.
This is the same thing but rounds down.
Thanks