Finding How Many Numbers are in a Double using Swift -
I have placed an application that fixes the solution of three variable systems to use the rule of the crawler. It works great, but in some cases there are huge numbers in the answer to the answers given. There should be a simple way of detecting a double length, then restricting it, I can not seem to find it.
var x: double = dx / d var y: double = dy / d var z: double = dz / d return (x, y, z)
The code given above indicates the end of the function which calculates the digit, which is not really necessary.
In short, there is an easy way to determine length (quantity of numbers),
If you just need to show the number of fixed digits to present, you can use a format string.
string (format: "% 3.1f", 1.111) // 1.1
3 specifies how many letters are in the number, whereas 1 is specified It does how many points will be after the decimal point.
Comments
Post a Comment