count what colum a number is in.

 

doing some testing on a program, I know what answer I'm suppose to get, but instead I'm getting these answers:

suppose to be: 5      really is 58.227

suppose to be: 2      really is 28.227

suppose to be: 0.3   really is 3.8227

suppose to be: 50    really is 582.227

so to fix what I'm getting into what it's suppose to be I need to do

"Answer / 10 - (0.8227 *or/ by X)

where X is the highest number column not occupied by a 0.

is there a function or something that will tell me what the highest number column is that's not occupied by a 0, or does anyone know a mathematical trick to figure that out?

(I don't want to use if statements because theoretically the output can be infinitely large or small, and yes I have figured out a slow way to do it with a while statement, but if possible I rather not do it that way)

 
nickblack:


where X is the highest number column not occupied by a 0.

is there a function or something that will tell me what the highest number column is that's not occupied by a 0, or does anyone know a mathematical trick to figure that out?

(I don't want to use if statements because theoretically the output can be infinitely large or small, and yes I have figured out a slow way to do it with a while statement, but if possible I rather not do it that way)

You don't say where these numbers are held,  it makes a difference . . .  if they are in an Array you can use  ArrayMaximum()  
 
RaptorUK:
You don't say where these numbers are held,  it makes a difference . . .  if they are in an Array you can use  ArrayMaximum()  


No array, I'm not looking for the biggest number in a list. I'm looking for something that does something like this:

// Find what number column (10x 100x 1000x ect) the number in "number" belongs to. 

x =1;
b =0;

while (b != 1)
{
variable = number/x;

   if (variable <10 && variable >= 1)
   {
      Alert("The Highest number is in the ",x," times column");
      b=1;
   }

variable = number*x;

   if (variable <10 && variable >= 1)
   {
      
      x=1/x;
      Alert("The Highest number is in the ",x," decimal column");
      b=1;
   }
x = x*10;

}


Which is what I'm using right now, but I was just wondering if there is a more space saving way to do it (like MathColumn( variable ) ) or something.

 
nickblack:

No array, I'm not looking for the biggest number in a list. I'm looking for something that does something like this:


Which is what I'm using right now, but I was just wondering if there is a more space saving way to do it (like MathColumn( variable ) ) or something.

Ah I see,  you want to know what power of 10 the number s less than.  A simple while loop is all you need.
Reason: