Beispiel #1
0
        public Scaled scale(double value, bool mustRescale)
        {
            Scaled scaled;

            if (mustRescale)
            {
                scaled = rescale(value);
            }
            else if (magfact >= 0)
            {
                // already scaled, need not rescale
                scaled = new Scaled(value / magfact, unit);
            }
            else
            {
                // scaling not requested, but never scaled before - must rescale anyway
                scaled = rescale(value);
                // if zero, scale again on the next try
                if (scaled.value == 0.0 || Double.IsNaN(scaled.value))
                {
                    magfact = -1.0;
                }
            }
            return(scaled);
        }
Beispiel #2
0
 public Scaled scale(double value, bool mustRescale)
 {
     Scaled scaled;
     if (mustRescale)
     {
         scaled = rescale(value);
     }
     else if (magfact >= 0)
     {
         // already scaled, need not rescale
         scaled = new Scaled(value / magfact, unit);
     }
     else
     {
         // scaling not requested, but never scaled before - must rescale anyway
         scaled = rescale(value);
         // if zero, scale again on the next try
         if (scaled.value == 0.0 || Double.IsNaN(scaled.value))
         {
             magfact = -1.0;
         }
     }
     return scaled;
 }