
    <`1                     j    d Z ddlZddlZddlZ ej        e          Zg dZd Zd Z	e	fdZ
e	fdZdS )z#
Various round-to-integer helpers.
    N)noRoundotRound
maybeRound	roundFuncc                     | S N values    9lib/python3.11/site-packages/fontTools/misc/roundTools.pyr   r      s        c                 J    t          t          j        | dz                       S )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     * 	DJus{##$$$r   c                 L     ||           }t          || z
            |k    r|n| S r   )abs)v	toleranceroundroundeds       r   r   r   ,   s/    588w{##y00a7r   c                     | dk     rt          d          | dk    rt          S | dk    r|S t          j        t          | |          S )Nr   z#Rounding tolerance must be positiver   r   r   )
ValueErrorr   	functoolspartialr   r   s     r   r   r   0   sN    1}}>???A~~BZ9EJJJJr   )__doc__r   r   logging	getLogger__name__log__all__r   r   r   r   r	   r   r   <module>r$      s          g!!    % % %. $+ 8 8 8 8  ' 
K 
K 
K 
K 
K 
Kr   