Convert dec sign, degrees, minutes, seconds into a signed angle in
    degrees.
325111
def dmsToDeg(sign, deg, min, sec):
    """"""
    return sign * (deg + min * degPerDmsMin + sec * degPerDmsSec)
48904
def stringify_seconds(seconds=0):
    
    seconds = int(seconds)
    minutes = seconds / 60
    ti = {'h': 0, 'm': 0, 's': 0}

    if seconds > 0:
        ti['s'] = seconds % 60
        ti['m'] = minutes % 60
        ti['h'] = minutes / 60

    return "%dh %dm %ds" % (ti['h'], ti['m'], ti['s'])
617824
def toString(value, mode):
    
    string = angle.toString(value)
    sign = string[0]
    separator = CHAR[mode][sign]
    string = string.replace(':', separator, 1)
    return string[1:]
557586
function formatTimezoneOffset (minutes) {
  let sign = simpleSign(negateExceptForZero(minutes))
  minutes = Math.abs(minutes)
  let hours = Math.floor(minutes / 60)
  minutes -= hours * 60
  let strHours = String(hours)
  let strMinutes = String(minutes)
  if (strHours.length < 2) strHours = '0' + strHours
  if (strMinutes.length < 2) strMinutes = '0' + strMinutes
  return (sign === -1 ? '-' : '+') + strHours + strMinutes
}
665745
def time2seconds(t):
    """"""
    return t.hour * 3600 + t.minute * 60 + t.second + float(t.microsecond) / 1e6
902611
def dec2hms(x):
    
    if not np.isfinite(x):
        return 'XX:XX:XX.XX'
    # wrap negative RA's
    if x < 0:
        x += 360
    x /= 15.0
    h = int(x)
    x = (x - h) * 60
    m = int(x)
    s = (x - m) * 60
    return '{0:02d}:{1:02d}:{2:05.2f}'.format(h, m, s)
539829
function angle(a, b) {
    var tempA = fromValues(a[0], a[1], a[2])
    var tempB = fromValues(b[0], b[1], b[2])
 
    normalize(tempA, tempA)
    normalize(tempB, tempB)
 
    var cosine = dot(tempA, tempB)

    if(cosine > 1.0){
        return 0
    } else {
        return Math.acos(cosine)
    }     
}
180513
def hstr(self, places=2, warn=True):
        """"""
        if warn and self.preference != 'hours':
            raise WrongUnitError('hstr')
        if self.radians.size == 0:
            return '<Angle []>'
        hours = self._hours
        shape = getattr(hours, 'shape', ())
        if shape and shape != (1,):
            return "{0} values from {1} to {2}".format(
                len(hours),
                _hstr(min(hours), places),
                _hstr(max(hours), places),
                )
        return _hstr(hours, places)
85460
def _hour_angle_to_hours(times, hourangle, longitude, equation_of_time):
    """"""
    naive_times = times.tz_localize(None)  # naive but still localized
    tzs = 1 / NS_PER_HR * (
        naive_times.astype(np.int64) - times.astype(np.int64))
    hours = (hourangle - longitude - equation_of_time / 4.) / 15. + 12. + tzs
    return np.asarray(hours)
13234
def _convert_angle_limit(angle, joint, **kwargs):
    """"""
    angle_pypot = angle

    # No need to take care of orientation
    if joint["orientation"] == "indirect":
        angle_pypot = 1 * angle_pypot

    # angle_pypot = angle_pypot + offset

    return angle_pypot * np.pi / 180
291549
function minutesToOffsetString(minutes) {
  var t = String(Math.abs(minutes / 60)).split('.');
  var H = pad(t[0]);
  var m = t[1] ? parseInt(t[1], 10) * 0.6 : 0;
  var sign = minutes < 0 ? '-' : '+';

  return '' + sign + H + ':' + pad(m);
}
22328
def _cos_to_angle(result, deriv, sign=1):
    """"""
    v = np.arccos(np.clip(result[0], -1, 1))
    if deriv == 0:
        return v*sign,
    if abs(result[0]) >= 1:
        factor1 = 0
    else:
        factor1 = -1.0/np.sqrt(1-result[0]**2)
    d = factor1*result[1]
    if deriv == 1:
        return v*sign, d*sign
    factor2 = result[0]*factor1**3
    dd = factor2*np.outer(result[1], result[1]) + factor1*result[2]
    if deriv == 2:
        return v*sign, d*sign, dd*sign
    raise ValueError("deriv must be 0, 1 or 2.")
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
120355
public  static final double signed(double angle)
    {
        angle = normalizeToFullAngle(angle);
        if (angle > Math.PI)
        {
            return angle - FULL_CIRCLE;
        }
        else
        {
            return angle;
        }
    }
1121339
def _rotate(degrees:uniform):
    ""
    angle = degrees * math.pi / 180
    return [[cos(angle), -sin(angle), 0.],
            [sin(angle),  cos(angle), 0.],
            [0.        ,  0.        , 1.]]
828032
def decimal_to_dms(value, precision):
    '''
    
    '''
    deg = math.floor(value)
    min = math.floor((value - deg) * 60)
    sec = math.floor((value - deg - min / 60) * 3600 * precision)

    return ((deg, 1), (min, 1), (sec, precision))
214783
def _dd_to_dms(num: float, _type: str) -> str:
        
        degrees = int(num)
        minutes = int((num - degrees) * 60)
        seconds = (num - degrees - minutes / 60) * 3600.00
        seconds = round(seconds, 3)
        result = [abs(i) for i in (degrees, minutes, seconds)]

        direction = ''
        if _type == 'lg':
            direction = 'W' if degrees < 0 else 'E'
        elif _type == 'lt':
            direction = 'S' if degrees < 0 else 'N'

        return ('{}º{}\'{:.3f}"' + direction).format(*result)