Convert to millies

@param int $d
@return float|int
762170
public function toMillis($d)
    {
        $v = $this->getValue();
        if ($v < self::MILLISECONDS) {
            return $d/($this->c2/$this->{'c'.$v});
        } else {
            return $this->x($d, $this->{'c'.$v}/$this->c2, PHP_INT_MAX/($this->{'c'.$v}/$this->c2));
        }
    }
449308
public function translate($dx, $dy)
    {
        return $this->setWidth($dx + $this->getWidth())
                        ->setHeight($dy + $this->getHeight());
    }
694373
public function _driveIndex($d)
    {
        $d = (string) $d{0};
        if ((ord($d) >= ord('a')) && (ord($d) <= ord('z'))) {
            return ord($d) - ord('a');
        }
        if ((ord($d) >= ord('A')) && (ord($d) <= ord('Z'))) {
            return ord($d) - ord('A');
        }

        return -1;
    }
961203
public function getLdapValue()
    {
        if ($this->never) {
            $value = self::NEVER;
        } else {
            $total = 0;
            foreach (self::UNIT as $unit => $conversion) {
                $total += $this->$unit * $conversion;
            }
            $value = number_format($total, 0, '.', '');
        }

        return $value;
    }
333752
private String convertDecimal(double d, String format)
    {
        String ret = "";

        if(format.length() > 0)
        {
            DecimalFormat f = new DecimalFormat(format);
            ret = f.format(d);
        }
        else
        {
            ret = Double.toString(d);
        }

        return ret;
    }
1107615
public function computeVarintSize($value)
    {
        if (($value & (0xffffffff <<  7)) === 0) {
            return 1;
        }

        if (($value & (0xffffffff << 14)) === 0) {
            return 2;
        }

        if (($value & (0xffffffff << 21)) === 0) {
            return 3;
        }

        if (($value & (0xffffffff << 28)) === 0) {
            return 4;
        }

        if (($value & (0xffffffff << 35)) === 0) {
            return 5;
        }

        if (($value & (0xffffffff << 42)) === 0) {
            return 6;
        }

        if (($value & (0xffffffff << 49)) === 0) {
            return 7;
        }

        if (($value & (0xffffffff << 56)) === 0) {
            return 8;
        }

        if (($value & (0xffffffff << 63)) === 0) {
            return 9;
        }

        return 10;
    }
314783
public static String convert( long x, int n, String d ) {
        if (x == 0) {
            return "0";
        }

        String r = "";
        int m = 1 << n;
        m--;
        while( x != 0 ) {
            r = d.charAt((int) (x & m)) + r;
            x = x >>> n;
        }
        return r;
    }
1152188
def dms2dd(d,m,s):
    
    if d < 0:
        sign = -1
    else:
        sign = 1
    dd = sign * (int(abs(d)) + float(m) / 60 + float(s) / 3600)
    return dd
970840
def to_d(l):
    
    _d = {}
    for x in l:
        for k, v in x.items():
            _d[k] = v
    return _d
368003
static public function centsToDollars($cents)
    {
        if (!is_numeric($cents)) {
            throw new \RuntimeException(
                sprintf('Cannot parse a non-numerical value "%s".', $cents)
            );
        }

        return number_format((float) $cents / 100, 2);
    }
1088625
def number_to_dp(number: Optional[float],
                 dp: int,
                 default: Optional[str] = "",
                 en_dash_for_minus: bool = True) -> str:
    
    if number is None:
        return default
    if number == float("inf"):
        return u"∞"
    if number == float("-inf"):
        s = u"-∞"
    else:
        s = u"{:.{precision}f}".format(number, precision=dp)
    if en_dash_for_minus:
        s = s.replace("-", u"–")  # hyphen becomes en dash for minus sign
    return s
729324
protected function drawIndex(array $d)
     {
         $x = $this->mt->generate();
         $p = 0.0;
         foreach ($d as $i=>$v) {
             $p+=$v;
             if ($p > $x)
                return $i;
         }
     }
854346
private function x($d, $m, $over)
    {
        if ($d > $over) {
            return PHP_INT_MAX;
        }
        if ($d < -$over) {
            return -PHP_INT_MAX -1;
        }
        return $d * $m;
    }
50589
private int integerDigits(double d) {
    double value = Math.abs(d);
    if(value < 10) {
      return 1;
    }
    return (int) FastMath.log10(value) + 1;
  }
494724
public static function convertNumToDigitalUnit($iNum) {
		foreach (['', 'K', 'M', 'G', 'T', 'P', 'G', 'E', 'Z'] as $sUnit) {
			if ((int)round($iNum) < 1000) {
				break;
			}
			$iNum = $iNum / 1024;
		}
		return ($iNum < 10 ? sprintf('%.01f', $iNum) : (int)round($iNum))
			. ($sUnit ? ' ' . $sUnit : '');
	}
575389
def dd2dms(dd):
    
    m, s = divmod(dd * 3600, 60)
    d, m = divmod(m, 60)
    return int(d), int(m), s
829318
public function length2() : float {
        $value = 0;
        $count = count($this->elements);
        for ($i=0;$i<$count;$i++) {
            $value += ($this[$i] * $this[$i]);
        }
        return $value;
    }