title: qsort compare function behaviour
body: <p>everyone. I am trying to change my compare function and almost everything is okay but if i write sth like 0 -5.5 in my infile as an output i recive (after qsort) that -5.5 is greater than 0, and that's not true. Could you check my code and tell me what should i chage?</p>
  
  <pre><code>    int compare(const void *str1, const void *str2)
      {
      char *number1, *number2;
      int len1=0, len2=0, dot1=0, dot2=0, value=0;
      int minus1=0, minus2=0;
  
      number1 = *(char**)str1;
      number2 = *(char**)str2;
  
      while(*number1=='0') number1++;
      while(*number2=='0') number2++;
  
      while(*number1 || *number2){
          if(value==0) {value= *number1-*number2;}
  
          if(*number1){
              if(*number1=='-') number1++;
              if(*number1=='-') minus1=1;
              if(*number1!='.'){
                  number1++;
                  if(dot1==1) len1++;}
  
                  if(*number1=='.'){
                      number1++;
                      dot1=0;}
          }
  
          if(*number2){
              if(*number2=='-') number2++;
              if(*number2=='-') minus2=1;
              if(*number2!='.'){
                  number2++;
                  if(dot2==1) len2++;}
  
                  if(*number2=='.'){
                      number2++;
                      dot2=0;}
          }
      }
  
      if(minus1&gt;0 &amp;&amp; minus2==0){return -1;}
      if(minus1==0 &amp;&amp; minus2&gt;0){return 1;}
      if(minus1&gt;0 &amp;&amp; minus2&gt;0){
          if(len1&gt;len2) return -1;
          if(len2&gt;len1) return 1;
          return (-value);}
          if(len1&gt;len2) return 1;
          if(len2&gt;len1) return -1;
          return value;
  }
  </code></pre>