cengal.math.numbers.versions.v_0.numbers

 1#!/usr/bin/env python
 2# coding=utf-8
 3
 4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>
 5# 
 6# Licensed under the Apache License, Version 2.0 (the "License");
 7# you may not use this file except in compliance with the License.
 8# You may obtain a copy of the License at
 9# 
10#     http://www.apache.org/licenses/LICENSE-2.0
11# 
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18__all__ = ['Number', 'RationalNumber', 'approximately_equal', 'ae']
19
20
21from typing import Union
22
23
24"""
25Module Docstring
26Docstrings: http://www.python.org/dev/peps/pep-0257/
27"""
28
29__author__ = "ButenkoMS <gtalk@butenkoms.space>"
30__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>"
31__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ]
32__license__ = "Apache License, Version 2.0"
33__version__ = "4.4.1"
34__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>"
35__email__ = "gtalk@butenkoms.space"
36# __status__ = "Prototype"
37__status__ = "Development"
38# __status__ = "Production"
39
40
41Number = Union[int, float, complex]
42RationalNumber = Union[int, float]
43
44
45def approximately_equal(first: Number, second: Number, epsilon: Number) -> bool:
46    return abs(first - second) <= epsilon
47
48
49ae = approximately_equal
Number = typing.Union[int, float, complex]
RationalNumber = typing.Union[int, float]
def approximately_equal( first: Union[int, float, complex], second: Union[int, float, complex], epsilon: Union[int, float, complex]) -> bool:
46def approximately_equal(first: Number, second: Number, epsilon: Number) -> bool:
47    return abs(first - second) <= epsilon
def ae( first: Union[int, float, complex], second: Union[int, float, complex], epsilon: Union[int, float, complex]) -> bool:
46def approximately_equal(first: Number, second: Number, epsilon: Number) -> bool:
47    return abs(first - second) <= epsilon