ó
    oñ:ie  ã                   ó†   • S r SSKrSSKrSSKr\R                  " \5      r/ SQrS rS r	\	4S jr
\	4S jrS\S	\S
\4S jrg)z#
Various round-to-integer helpers.
é    N)ÚnoRoundÚotRoundÚ
maybeRoundÚ	roundFuncÚnearestMultipleShortestReprc                 ó   • U $ ©N© ©Úvalues    Ú\/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/fontTools/misc/roundTools.pyr   r      s   € Ø€Ló    c                 óF   • [        [        R                  " U S-   5      5      $ )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   r   r      s   € ô* Œt�zŠz˜% #™+Ó&Ó'Ð'r   c                 ó<   • U" U 5      n[        X0-
  5      U::  a  U$ U $ r	   )Úabs)ÚvÚ	toleranceÚroundÚroundeds       r   r   r   0   s$   € Ù�A‹h€GÜ˜'™+Ó&¨)Ó3ˆ7Ð:¸Ð:r   c                 ó~   • U S:  a  [        S5      eU S:X  a  [        $ U S:¼  a  U$ [        R                  " [        XS9$ )Nr   z#Rounding tolerance must be positiver   ©r   r   )Ú
ValueErrorr   Ú	functoolsÚpartialr   r   s     r   r   r   5   sA   € Ø�1ƒ}ÜÐ>Ó?Ð?à�Aƒ~Üˆà�CÓØˆä×ÒœZ°9ÑJÐJr   r   ÚfactorÚreturnc                 óž  • U (       d  g[        X-  5      U-  n SU-  nX-
  nX-   n[        U5      [        U5      :w  a  [        [        [	        U 5      5      5      $ SnXS-  nXT-  n[        U5      [        U5      :X  a  X4:w  d   e[        [        U5      5       H  nX6   XF   :w  d  M    O   UR                  S5      nUW:  d   eSXg-
  -  nXP-  $ )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   ÚstrÚfloatr   ÚlenÚrangeÚfind)r   r   ÚepsÚloÚhiÚfmtÚiÚperiods           r   r   r   B   sÒ   € ö. Øä�E‘NÓ# fÑ,€EØ
�‰,€CØ	‰€BØ	‰€Bä
ˆ2ƒw”#�b“'ÓÜ”5œ˜u›Ó&Ó'Ð'à
€CØ	‰€BØ	‰€BÜˆr‹7”c˜"“gÓ "£(Ð*Ð*Ü”3�r“7Ž^ˆØ‰5�B‘E�>Ùñ ð �W‰W�S‹\€FØ�A‹:Ðˆ:Ø
�a‘jÑ
!€CØ‰;Ðr   )Ú__doc__r   r   ÚloggingÚ	getLoggerÚ__name__ÚlogÚ__all__r   r   r   r   r$   r#   r   r
   r   r   Ú<module>r4      se   ðñó Û Û à×Ò˜Ó!€ò€òò(ð0 $+ô ;ð
  'ô 
Kð, uð ,°eð ,Àõ ,r   