+
    ie                     ~    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                     V # N values   &y/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/fontTools/misc/roundTools.pynoRoundr      s    L    c                N    \        \        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mathfloorr   s   &r   otRoundr      s    * tzz%#+&''r	   c                 F    V! V 4      p\        W0,
          4      V8:  d   V# T # r   )abs)v	toleranceroundroundeds   &&& r   
maybeRoundr   0   s$    AhG'+&)37::r	   c                     V ^ 8  d   \        R4      hV ^ 8X  d   \        # V R8  d   V# \        P                  ! \        WR7      # )    z#Rounding tolerance must be positiver   r   r   )
ValueErrorr   	functoolspartialr   r   s   &&r   	roundFuncr   5   sA    1}>??A~CZ9JJr	   c                <    V ^8  d   QhR\         R\         R\        /# )   r   factorreturn)floatstr)formats   "r   __annotate__r%   B   s!     , ,u ,e , ,r	   c                   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%.8f.z%%.%df)r   r   r#   r"   r   lenrangefind)r   r    epslohifmtiperiods   &&      r   nearestMultipleShortestReprr1   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   r1   )__doc__r   r   logging	getLogger__name__log__all__r   r   r   r   r1   r   r	   r   <module>r8      sP      !(0 $+ ;
  ' 
K,r	   