# Path: systemVariables.py
# def     fuzzyInteger(B):
#     """
#     B but, if B is within comparison toleranace of an integer, the integer
#     """
#     if isinstance(B, int):
#         return B
# 
#     if B > 0:
#         I = int(B+0.5)
#     elif B < 0:
#         I = int(B-0.5)
#     else:
#         I = 0
# 
#     if fuzzyEquals(I, B):
#         return I
# 
#     return B
# 
# Path: aplError.py
# def     assertError(message):
#     """
#     raise an exception so aborting the current operation
#     """
#     raise aplException(message)


import operator
import math
import random
import mpmath
from systemVariables import fuzzyInteger
from aplError import assertError
def     roll(B):
    """
    ? B
    """
    try:
        return random.randint(1, B)
    except ValueError:
        assertError("DOMAIN ERROR")

# ------------------------------

def     pi(B):
    """
    ○ B
    """
    return math.pi * B

# ------------------------------

def     logicalNegation(B):
    """
    ~ B
    """
    B = fuzzyInteger(B)

    if B == 1:
        return 0
    if B == 0:
        return 1


# Path: systemVariables.py
# def     fuzzyInteger(B):
#     """
#     B but, if B is within comparison toleranace of an integer, the integer
#     """
#     if isinstance(B, int):
#         return B
# 
#     if B > 0:
#         I = int(B+0.5)
#     elif B < 0:
#         I = int(B-0.5)
#     else:
#         I = 0
# 
#     if fuzzyEquals(I, B):
#         return I
# 
#     return B
# 
# Path: aplError.py
# def     assertError(message):
#     """
#     raise an exception so aborting the current operation
#     """
#     raise aplException(message)


# Path: monadicFunctions.py
import operator
import math
import random
import mpmath
from systemVariables import fuzzyInteger
from aplError import assertError

def     roll(B):
    """
    ? B
    """
    try:
        return random.randint(1, B)
    except ValueError:
        assertError("DOMAIN ERROR")

# ------------------------------

def     pi(B):
    """
    ○ B
    """
    return math.pi * B

# ------------------------------

def     logicalNegation(B):
    """
    ~ B
    """
    B = fuzzyInteger(B)

    if B == 1:
        return 0
    if B == 0:
        return 1


    assertError("DOMAIN ERROR")