+
    f7ie  c                   s~    R t ^ RIt^ RIt^ RIt]P                  ! ]4      t. ROtR tR t	]	3R lt
]	3R ltR R ltR# )	z#
Various round-to-integer helpers.
Nc                 s    V # N value   &@/usr/lib64/python3.14/site-packages/fontTools/misc/roundTools.pynoRoundr      s    L    c                sN    \        \        P                  ! V R,           4      4      # )a  Round float value to nearest integer towards ``+Infinity``.

The OpenType spec (in the section on `"normalization" of OpenType Font Variations <https://docs.microsoft.com/en-us/typography/opentype/spec/otvaroverview#coordinate-scales-and-normalization>`_)
defines the required method for converting floating point values to
fixed-point. In particular it specifies the following rounding strategy:

        for fractional values of 0.5 and higher, take the next higher integer;
        for other fractional values, truncate.

This function rounds the floating-point value according to this strategy
in preparation for conversion to fixed-point.

Args:
        value (float): The input floating-point value.

Returns
        float: The rounded value.
      ?)intmathZfloorr   r   r   otRoundr      s    * tzz%#+&''r   c                 sF    V! V 4      p\        W0,
          4      V8:  d   V# T # r    )Zabs)Zv	toleranceroundZroundeds   &&& r   
maybeRoundr   0   s$    AhG'+&)37::r   c                 s    V ^ 8  d   \        R4      hV ^ 8X  d   \        # V R8  d   V# \        P                  ! \        WR7      # )i    z#Rounding tolerance must be positiver   r   r   )Z
ValueErrorr   	functoolsZpartialr   r   s   &&r   	roundFuncr   5   sA    1}>??A~CZ9JJr   c                s<    V ^8  d   QhR\         R\         R\        /# )i   r   factorZreturn)floatstr)Zformats   "r   __annotate__r   B   s!     , ,u ,e , ,r   c                s   V '       g   R# \        W,          4      V,          p RV,          pW,
          pW,           p\        V4      \        V4      8w  d   \        \        \	        V 4      4      4      # RpWS,          pWT,          p\        V4      \        V4      8X  d   W48w  g   Q h\        \        V4      4       F  pW6,          WF,          8w  g   K   M	  VP                  R4      pVX8  g   Q hRWg,
          ,          pWP,          # )a  Round to nearest multiple of factor and return shortest decimal representation.

This chooses the float that is closer to a multiple of the given factor while
having the shortest decimal representation (the least number of fractional decimal
digits).

For example, given the following:

>>> nearestMultipleShortestRepr(-0.61883544921875, 1.0/(1<<14))
'-0.61884'

Useful when you need to serialize or print a fixed-point number (or multiples
thereof, such as F2Dot14 fractions of 180 degrees in COLRv1 PaintRotate) in
a human-readable form.

Args:
    value (value): The value to be rounded and serialized.
    factor (float): The value which the result is a close multiple of.

Returns:
    str: A compact string representation of the value.
z0.0r   z%.8fZ.z%%.%df)r   r	   r   r   r   ZlenZrangeZfind)r   r   ZepsZloZhiZfmtZiZperiods   &&      r   nearestMultipleShortestReprr   B   s    . EN#f,E
,C	B	B
2w#b'5u&''
C	B	Br7c"g"(**3r7^5BE>  WWS\FA::
aj
!C;r   )r   r   r   r   r   )Z__doc__r
   r   ZloggingZ	getLoggerZ__name__ZlogZ__all__r   r   r   r   r   r   r   r   <module>r      sP      !(0 $+ ;
  ' 
K,r   