math — 0.3.0

org.pycforge.math · Author: PyCForge

License: GPL-3.0-only · Created: 2026-10-28

Runtime conversion · Direct declared calls

Function index

acos · acosh · asin · asinh · atan · atan2 · atanh · cbrt · ceil · copysign · cos · cosh · erf · erfc · exp · exp2 · expm1 · fabs · floor · fmod · isclose · isfinite · isinf · isnan · log · log10 · log1p · log2 · pow · remainder · sin · sinh · sqrt · tan · tanh · trunc

Overview

Thirty-six scalar math functions and five binary64 constants, converted through public Crucible contracts.

Using this import

Select Runtime. Declare *import math as m at the top of the module, then use direct calls such as m.sin(0.0) or constants such as m.pi. Trigonometric input angles are radians. Use m.log(8, 2) for base-two logarithms and m.isclose(a=1.0, b=1.0000000001, rel_tol=1e-9) for tolerance comparisons. See each signature below.

Author's limitations

This package covers only the listed exports and call shapes. log takes one or two positional arguments. isclose accepts named a/b and keyword-only rel_tol/abs_tol; other exports remain positional-only. Unpacking, first-class function values, arrays and NumPy are unsupported. floor, ceil and trunc return bounded int64, unlike Python's arbitrary-precision integer results. Native libm results depend on the compiler and platform; cross-platform bit identity and NaN payload identity are not promised. Runtime remains a preview target.

Release notes

0.3.0 adds optional-base log and isclose through scalar profile 0.3 parameter and reusable kernel contracts. Existing positional calls remain supported.

Examples are author-supplied fixture snapshots. The SDK reports verification for its recorded environment; PyCForge registration does not rerun them.

Conversion contract

Use *import math in the module preamble. Each signature states accepted positions, names and defaults. A slash marks positional-only parameters; a star marks keyword-only parameters. Argument expansion, function values and Typed conversion are unsupported.

Inputs: bool, signed int64 or float64. Native numeric operands use binary64 C double. Wrong runtime value types raise TypeError; runtime exceptions remain catchable. C11 math.h, default rounding, no fast-math; POSIX linking uses -lm. No arrays or arbitrary-precision results.

math.acos(value, /) -> float64

Inverse cosine; input from -1 through 1

Argument labels indicate positions; they are not accepted keyword names.

Input domain: First operand outside [-1, 1] raises ValueError; NaN passes.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Inverse cosine; input from -1 through 1. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Cosine value in the closed interval [-1, 1].

Returns: Principal inverse cosine in radians.

View example: native-acos

math.acosh(value, /) -> float64

Inverse hyperbolic cosine; input at least 1

Argument labels indicate positions; they are not accepted keyword names.

Input domain: First operand below 1 raises ValueError; NaN passes.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Inverse hyperbolic cosine; input at least 1. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Hyperbolic cosine value at least one.

Returns: Nonnegative inverse hyperbolic cosine.

View example: native-acosh

math.asin(value, /) -> float64

Inverse sine; input from -1 through 1

Argument labels indicate positions; they are not accepted keyword names.

Input domain: First operand outside [-1, 1] raises ValueError; NaN passes.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Inverse sine; input from -1 through 1. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Sine value in the closed interval [-1, 1].

Returns: Principal inverse sine in radians.

View example: native-asin

math.asinh(value, /) -> float64

Inverse hyperbolic sine

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Inverse hyperbolic sine. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Hyperbolic sine value.

Returns: Inverse hyperbolic sine.

View example: native-asinh

math.atan(value, /) -> float64

Inverse tangent

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Inverse tangent. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Tangent value.

Returns: Principal inverse tangent in radians.

View example: native-atan

math.atan2(arg1, arg2, /) -> float64

Angle of the vector (second input, first input)

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Angle of the vector (second input, first input). The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Vertical coordinate y.

Argument 2: Horizontal coordinate x.

Returns: Angle in radians with the quadrant determined by both coordinates.

View example: native-atan2

math.atanh(value, /) -> float64

Inverse hyperbolic tangent; input strictly between -1 and 1

Argument labels indicate positions; they are not accepted keyword names.

Input domain: First operand outside (-1, 1) raises ValueError; NaN passes.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Inverse hyperbolic tangent; input strictly between -1 and 1. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Hyperbolic tangent value strictly between -1 and 1.

Returns: Inverse hyperbolic tangent.

View example: native-atanh

math.cbrt(value, /) -> float64

Real cube root

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Real cube root. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Number whose real cube root is requested.

Returns: Real cube root, with negative roots for negative inputs.

View example: native-cbrt

math.ceil(value, /) -> int64

Smallest integer no less than input; result must fit int64

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Result must fit signed int64; nonfinite or out-of-range results raise an exception.

Existing bool/int64 operands retain their exact integer value.

Smallest integer no less than input; result must fit int64. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Number to round upward.

Returns: Smallest integer no less than the input, within signed int64.

View example: native-ceil

math.copysign(arg1, arg2, /) -> float64

Magnitude of the first input with the sign of the second

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: direct native result after the declared input guards.

Magnitude of the first input with the sign of the second. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Number supplying the magnitude.

Argument 2: Number supplying the sign, including the sign of zero.

Returns: Magnitude of the first argument with the sign of the second.

View example: native-copysign

math.cos(value, /) -> float64

Cosine in radians

Argument labels indicate positions; they are not accepted keyword names.

Input domain: Either infinity in the first operand raises ValueError; NaN passes.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Cosine in radians. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Angle in radians.

Returns: Cosine of the angle.

View example: native-cos

math.cosh(value, /) -> float64

Hyperbolic cosine with overflow checking

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Hyperbolic cosine with overflow checking. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Hyperbolic angle.

Returns: Hyperbolic cosine.

View example: native-cosh

math.erf(value, /) -> float64

Error function

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Error function. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Real argument to the error function.

Returns: Value of the native error function.

View example: native-erf

math.erfc(value, /) -> float64

Complementary error function

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Complementary error function. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Real argument to the complementary error function.

Returns: Complementary error-function value, computed directly by the native operation.

View example: native-erfc

math.exp(value, /) -> float64

Exponential with overflow checking

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Exponential with overflow checking. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Exponent for base e.

Returns: e raised to the supplied exponent.

View example: native-exp

math.exp2(value, /) -> float64

Base-two exponential with overflow checking

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Base-two exponential with overflow checking. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Exponent for base two.

Returns: Two raised to the supplied exponent.

View example: native-exp2

math.expm1(value, /) -> float64

Exponential minus one, accurate near zero

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Exponential minus one, accurate near zero. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Exponent for base e.

Returns: exp(x) minus one, using the native operation intended for accuracy near zero.

View example: native-expm1

math.fabs(value, /) -> float64

Floating-point absolute value

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: direct native result after the declared input guards.

Floating-point absolute value. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Number whose magnitude is requested.

Returns: Absolute value as float64.

View example: native-fabs

math.floor(value, /) -> int64

Largest integer no greater than input; result must fit int64

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Result must fit signed int64; nonfinite or out-of-range results raise an exception.

Existing bool/int64 operands retain their exact integer value.

Largest integer no greater than input; result must fit int64. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Number to round downward.

Returns: Largest integer no greater than the input, within signed int64.

View example: native-floor

math.fmod(arg1, arg2, /) -> float64

Floating remainder with the sign of the first input

Argument labels indicate positions; they are not accepted keyword names.

Input domain: Exactly two operands. Unless either is NaN, reject an infinite first operand or zero second operand.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Floating remainder with the sign of the first input. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Dividend.

Argument 2: Divisor.

Returns: Floating remainder with the dividend's sign, following the native fmod operation.

View example: native-fmod

math.isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0) -> bool

Symmetric relative or absolute closeness with optional keyword-only tolerances

a: positional-or-keyword; required

b: positional-or-keyword; required

rel_tol: keyword-only; default 1e-09

abs_tol: keyword-only; default 0.0

Four slots: left, right, relative tolerance, absolute tolerance. Convert all to binary64; negative tolerances raise ValueError before equality. Equal values, including matching infinities, return True. Other infinite operands return False. Otherwise compare abs(right-left) to abs(relative*right), abs(relative*left), or absolute. NaN operands are never close; NaN tolerances participate in ordinary comparisons. Tolerances greater than or equal to 1 and positive infinity are accepted, matching CPython 3.12 behavior.

Symmetric relative or absolute closeness with optional keyword-only tolerances. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: First value a, positional or named.

Argument 2: Second value b, positional or named.

Argument 3: Keyword-only relative tolerance; defaults to 1e-9. Negative values raise ValueError.

Argument 4: Keyword-only absolute tolerance; defaults to 0.0. Negative values raise ValueError.

Returns: True for equal values or a difference within either symmetric relative bound or the absolute bound. NaN operands are never close; infinities are close only to themselves.

View example: native-isclose

math.isfinite(value, /) -> bool

Test whether an input is finite

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: direct native result after the declared input guards.

Test whether an input is finite. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Number to classify.

Returns: True for finite numbers; False for infinities and NaN.

View example: native-isfinite

math.isinf(value, /) -> bool

Test whether an input is an infinity

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: direct native result after the declared input guards.

Test whether an input is an infinity. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Number to classify.

Returns: True for either positive or negative infinity.

View example: native-isinf

math.isnan(value, /) -> bool

Test whether an input is NaN

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: direct native result after the declared input guards.

Test whether an input is NaN. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Number to classify.

Returns: True for NaN.

View example: native-isnan

math.log(x, base=<omitted>, /) -> float64

Natural logarithm or logarithm to an optional positional base

x: positional-only; required

base: positional-only; default omitted

Two slots: value and optional base with omitted default. Check and log the first value before checking the base. Nonpositive values raise ValueError; explicit None raises TypeError. Omission returns log(value); otherwise return log(value)/log(base). Base 1 raises ZeroDivisionError, including a NaN numerator. NaN and infinities propagate through the quotient; signed zero and underflow follow binary64. No arbitrary-precision integer logarithms.

Natural logarithm or logarithm to an optional positional base. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Strictly positive value; NaN propagates.

Argument 2: Optional positional base. Omit for the natural logarithm; nonpositive bases raise ValueError, base 1 raises ZeroDivisionError, and explicit None raises TypeError.

Returns: Natural logarithm when base is omitted, otherwise log(value)/log(base).

View example: native-log

math.log10(value, /) -> float64

Base-ten logarithm; positive input

Argument labels indicate positions; they are not accepted keyword names.

Input domain: First operand at or below zero raises ValueError; NaN passes.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Base-ten logarithm; positive input. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Strictly positive number.

Returns: Base-ten logarithm.

View example: native-log10

math.log1p(value, /) -> float64

Natural logarithm of one plus input; input greater than -1

Argument labels indicate positions; they are not accepted keyword names.

Input domain: First operand at or below -1 raises ValueError; NaN passes.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Natural logarithm of one plus input; input greater than -1. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Number strictly greater than -1.

Returns: Natural logarithm of one plus the supplied number.

View example: native-log1p

math.log2(value, /) -> float64

Base-two logarithm; positive input

Argument labels indicate positions; they are not accepted keyword names.

Input domain: First operand at or below zero raises ValueError; NaN passes.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Base-two logarithm; positive input. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Strictly positive number.

Returns: Base-two logarithm.

View example: native-log2

math.pow(arg1, arg2, /) -> float64

Floating-point power with domain and overflow checking

Argument labels indicate positions; they are not accepted keyword names.

Input domain: Exactly two operands. For finite operands, reject zero to a negative power and a negative base to a nonintegral power. Nonfinite cases follow the native operation.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Floating-point power with domain and overflow checking. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Base.

Argument 2: Exponent.

Returns: Floating-point power subject to the real-power domain guard.

View example: native-pow

math.remainder(arg1, arg2, /) -> float64

IEEE remainder using the nearest even quotient

Argument labels indicate positions; they are not accepted keyword names.

Input domain: Exactly two operands. Unless either is NaN, reject an infinite first operand or zero second operand.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

IEEE remainder using the nearest even quotient. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Dividend.

Argument 2: Divisor.

Returns: IEEE remainder computed using the nearest integer quotient, with ties to even.

View example: native-remainder

math.sin(value, /) -> float64

Sine in radians

Argument labels indicate positions; they are not accepted keyword names.

Input domain: Either infinity in the first operand raises ValueError; NaN passes.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Sine in radians. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Angle in radians.

Returns: Sine of the angle.

View example: native-sin

math.sinh(value, /) -> float64

Hyperbolic sine with overflow checking

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Hyperbolic sine with overflow checking. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Hyperbolic angle.

Returns: Hyperbolic sine.

View example: native-sinh

math.sqrt(value, /) -> float64

Square root; negative inputs raise ValueError

Argument labels indicate positions; they are not accepted keyword names.

Input domain: First operand below zero raises ValueError; negative zero and NaN pass.

Native error policy: direct native result after the declared input guards.

Square root; negative inputs raise ValueError. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Nonnegative number; negative zero is accepted.

Returns: Square root as float64.

View example: native-sqrt

math.tan(value, /) -> float64

Tangent in radians

Argument labels indicate positions; they are not accepted keyword names.

Input domain: Either infinity in the first operand raises ValueError; NaN passes.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Tangent in radians. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Angle in radians.

Returns: Tangent of the angle.

View example: native-tan

math.tanh(value, /) -> float64

Hyperbolic tangent

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Hyperbolic tangent. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Hyperbolic angle.

Returns: Hyperbolic tangent.

View example: native-tanh

math.trunc(value, /) -> int64

Integer part toward zero; result must fit int64

Argument labels indicate positions; they are not accepted keyword names.

Input domain: No additional input-domain restriction after numeric type checks.

Native error policy: checked domain/range errors; overflow raises OverflowError and underflow is permitted.

Result must fit signed int64; nonfinite or out-of-range results raise an exception.

Existing bool/int64 operands retain their exact integer value.

Integer part toward zero; result must fit int64. The example exercises representative values and exception cases; the generated contract below states the supported domain and result limits.

Argument 1: Number to truncate toward zero.

Returns: Integer part toward zero, within signed int64.

View example: native-trunc

Verified fixture examples

Example: native-acos

*import math as m
def checked(x):
    try:
        value = m.acos(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

1.5707963267948966
1.0
0.0
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
3.141592653589793
1.0
0.0
1.0
ValueError
ValueError
2.0943951023931957
1.0
1.0471975511965979
1.0
ValueError
3.141592638688632
1.0
1.4901161193847656e-08
1.0
ValueError
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-acosh

*import math as m
def checked(x):
    try:
        value = m.acosh(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

ValueError
0.0
1.0
ValueError
ValueError
ValueError
0.0
1.0
ValueError
1.3169578969248166
1.0
ValueError
ValueError
ValueError
ValueError
ValueError
2.1073424255447017e-08
1.0
ValueError
ValueError
ValueError
ValueError
ValueError
7.600902209541989
1.0
ValueError
691.4686750787736
1.0
44.3614195558365
1.0
ValueError
inf
1.0
ValueError
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-asin

*import math as m
def checked(x):
    try:
        value = m.asin(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
1.5707963267948966
1.0
-0.0
-1.0
0.0
1.0
-1.5707963267948966
-1.0
1.5707963267948966
1.0
ValueError
ValueError
-0.5235987755982989
-1.0
0.5235987755982989
1.0
ValueError
-1.5707963118937354
-1.0
1.5707963118937354
1.0
ValueError
-5e-324
-1.0
5e-324
1.0
-1e-300
-1.0
1e-300
1.0
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-asinh

*import math as m
def checked(x):
    try:
        value = m.asinh(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
0.881373587019543
1.0
-0.0
-1.0
0.0
1.0
-0.881373587019543
-1.0
0.881373587019543
1.0
-1.4436354751788103
-1.0
1.4436354751788103
1.0
-0.48121182505960347
-1.0
0.48121182505960347
1.0
-0.8813735870195432
-1.0
-0.8813735870195429
-1.0
0.8813735870195429
1.0
0.8813735870195432
1.0
-5e-324
-1.0
5e-324
1.0
-1e-300
-1.0
1e-300
1.0
-7.600902709541988
-1.0
7.600902709541988
1.0
-691.4686750787736
-1.0
691.4686750787736
1.0
44.3614195558365
1.0
-44.3614195558365
-1.0
inf
1.0
-inf
-1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-atan

*import math as m
def checked(x):
    try:
        value = m.atan(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
0.7853981633974483
1.0
-0.0
-1.0
0.0
1.0
-0.7853981633974483
-1.0
0.7853981633974483
1.0
-1.1071487177940904
-1.0
1.1071487177940904
1.0
-0.4636476090008061
-1.0
0.4636476090008061
1.0
-0.7853981633974484
-1.0
-0.7853981633974483
-1.0
0.7853981633974483
1.0
0.7853981633974484
1.0
-5e-324
-1.0
5e-324
1.0
-1e-300
-1.0
1e-300
1.0
-1.5697963271282298
-1.0
1.5697963271282298
1.0
-1.5707963267948966
-1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
-1.5707963267948966
-1.0
1.5707963267948966
1.0
-1.5707963267948966
-1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-atan2

*import math as m
def checked(x, y):
    try:
        value = m.atan2(x, y)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
        for y in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
            checked(x, y)
    checked("bad", 1)
    checked(1, "bad")
    checked(None, 1)
    checked(1, None)
    return 0

Expected standard output:

0.0
1.0
0.0
1.0
3.141592653589793
1.0
3.141592653589793
1.0
3.141592653589793
1.0
3.141592653589793
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
3.141592653589793
1.0
0.0
1.0
3.141592653589793
1.0
0.0
1.0
0.0
1.0
3.141592653589793
1.0
nan
1.5707963267948966
1.0
0.7853981633974483
1.0
3.0309354324158977
1.0
2.677945044588987
1.0
2.356194490192345
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.1071487177940904
1.0
0.7853981633974483
1.0
0.4636476090008061
1.0
0.3217505543966422
1.0
3.141592653589793
1.0
1e-300
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
0.0
1.0
3.141592653589793
1.0
nan
-1.5707963267948966
-1.0
-1.460139105621001
-1.0
-2.356194490192345
-1.0
-1.7894652726688385
-1.0
-1.6814535479687922
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5152978215491797
-1.0
-1.460139105621001
-1.0
-1.3521273809209546
-1.0
-1.2490457723982544
-1.0
-3.141592653589793
-1.0
-9e-300
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-0.0
-1.0
-3.141592653589793
-1.0
nan
-1.5707963267948966
-1.0
-1.1071487177940904
-1.0
-2.922923707715851
-1.0
-2.356194490192345
-1.0
-2.0344439357957027
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.3258176636680326
-1.0
-1.1071487177940904
-1.0
-0.7853981633974483
-1.0
-0.5880026035475675
-1.0
-3.141592653589793
-1.0
-2e-300
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-0.0
-1.0
-3.141592653589793
-1.0
nan
-1.5707963267948966
-1.0
-0.7853981633974483
-1.0
-3.0309354324158977
-1.0
-2.677945044588987
-1.0
-2.356194490192345
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.1071487177940904
-1.0
-0.7853981633974483
-1.0
-0.4636476090008061
-1.0
-0.3217505543966422
-1.0
-3.141592653589793
-1.0
-1e-300
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-0.0
-1.0
-3.141592653589793
-1.0
nan
-0.0
-1.0
-0.0
-1.0
-3.141592653589793
-1.0
-3.141592653589793
-1.0
-3.141592653589793
-1.0
-3.141592653589793
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-3.141592653589793
-1.0
-0.0
-1.0
-3.141592653589793
-1.0
-0.0
-1.0
-0.0
-1.0
-3.141592653589793
-1.0
nan
0.0
1.0
0.0
1.0
3.141592653589793
1.0
3.141592653589793
1.0
3.141592653589793
1.0
3.141592653589793
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
3.141592653589793
1.0
0.0
1.0
3.141592653589793
1.0
0.0
1.0
0.0
1.0
3.141592653589793
1.0
nan
1.5707963267948966
1.0
0.4636476090008061
1.0
3.0860941483440762
1.0
2.896613990462929
1.0
2.677945044588987
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
0.7853981633974483
1.0
0.4636476090008061
1.0
0.24497866312686414
1.0
0.16514867741462683
1.0
3.141592653589793
1.0
5e-301
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
0.0
1.0
3.141592653589793
1.0
nan
1.5707963267948966
1.0
0.7853981633974483
1.0
3.0309354324158977
1.0
2.677945044588987
1.0
2.356194490192345
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.1071487177940904
1.0
0.7853981633974483
1.0
0.4636476090008061
1.0
0.3217505543966422
1.0
3.141592653589793
1.0
1e-300
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
0.0
1.0
3.141592653589793
1.0
nan
1.5707963267948966
1.0
1.1071487177940904
1.0
2.922923707715851
1.0
2.356194490192345
1.0
2.0344439357957027
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.3258176636680326
1.0
1.1071487177940904
1.0
0.7853981633974483
1.0
0.5880026035475675
1.0
3.141592653589793
1.0
2e-300
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
0.0
1.0
3.141592653589793
1.0
nan
1.5707963267948966
1.0
1.2490457723982544
1.0
2.819842099193151
1.0
2.158798930342464
1.0
1.892546881191539
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.4056476493802699
1.0
1.2490457723982544
1.0
0.982793723247329
1.0
0.7853981633974483
1.0
3.141592653589793
1.0
2.9999999999999996e-300
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
0.0
1.0
3.141592653589793
1.0
nan
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-2.356194490192345
-1.0
-0.7853981633974483
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-0.0
-1.0
-3.141592653589793
-1.0
nan
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
2.356194490192345
1.0
0.7853981633974483
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
0.0
1.0
3.141592653589793
1.0
nan
-1.5707963267948966
-1.0
-5e-324
-1.0
-3.141592653589793
-1.0
-3.141592653589793
-1.0
-3.141592653589793
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1e-323
-1.0
-5e-324
-1.0
-0.0
-1.0
-0.0
-1.0
-3.141592653589793
-1.0
-0.0
-1.0
-2.356194490192345
-1.0
-0.7853981633974483
-1.0
-0.0
-1.0
-3.141592653589793
-1.0
nan
1.5707963267948966
1.0
5e-324
1.0
3.141592653589793
1.0
3.141592653589793
1.0
3.141592653589793
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1e-323
1.0
5e-324
1.0
0.0
1.0
0.0
1.0
3.141592653589793
1.0
0.0
1.0
2.356194490192345
1.0
0.7853981633974483
1.0
0.0
1.0
3.141592653589793
1.0
nan
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
1.5707963267948966
1.0
0.7853981633974483
1.0
2.356194490192345
1.0
nan
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-1.5707963267948966
-1.0
-0.7853981633974483
-1.0
-2.356194490192345
-1.0
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-atanh

*import math as m
def checked(x):
    try:
        value = m.atanh(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
ValueError
-0.0
-1.0
0.0
1.0
ValueError
ValueError
ValueError
ValueError
-0.5493061443340548
-1.0
0.5493061443340548
1.0
ValueError
-18.714973875118524
-1.0
18.714973875118524
1.0
ValueError
-5e-324
-1.0
5e-324
1.0
-1e-300
-1.0
1e-300
1.0
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-cbrt

*import math as m
def checked(x):
    try:
        value = m.cbrt(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
1.0
1.0
-0.0
-1.0
0.0
1.0
-1.0
-1.0
1.0
1.0
-1.2599210498948734
-1.0
1.2599210498948734
1.0
-0.7937005259840998
-1.0
0.7937005259840998
1.0
-1.0
-1.0
-1.0
-1.0
1.0
1.0
1.0
1.0
-1.7031839360032601e-108
-1.0
1.7031839360032601e-108
1.0
-1e-100
-1.0
1e-100
1.0
-10.0
-1.0
10.0
1.0
-1e+100
-1.0
1e+100
1.0
2097152.0
1.0
-2097152.0
-1.0
inf
1.0
-inf
-1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-ceil

*import math as m
def checked(x):
    try:
        value = m.ceil(x)
        print(value)
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1.5, 1.5, -0.1, 0.1, -5e-324, 5e-324, 9007199254740993, -9007199254740993, 9223372036854775807, -9223372036854775808, 9223372036854774784.0, -9223372036854775808.0, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0
1
0
0
-1
2
0
1
0
1
9007199254740993
-9007199254740993
9223372036854775807
-9223372036854775808
9223372036854774784
-9223372036854775808
OverflowError
OverflowError
ValueError
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-copysign

*import math as m
def checked(x, y):
    try:
        value = m.copysign(x, y)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
        for y in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
            checked(x, y)
    checked("bad", 1)
    checked(1, "bad")
    checked(None, 1)
    checked(1, None)
    return 0

Expected standard output:

0.0
1.0
0.0
1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
-0.0
-1.0
0.0
1.0
-0.0
-1.0
0.0
1.0
0.0
1.0
-0.0
-1.0
0.0
1.0
1.0
1.0
1.0
1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
9.0
1.0
9.0
1.0
-9.0
-1.0
-9.0
-1.0
-9.0
-1.0
-9.0
-1.0
9.0
1.0
9.0
1.0
9.0
1.0
9.0
1.0
9.0
1.0
-9.0
-1.0
9.0
1.0
-9.0
-1.0
9.0
1.0
9.0
1.0
-9.0
-1.0
9.0
1.0
2.0
1.0
2.0
1.0
-2.0
-1.0
-2.0
-1.0
-2.0
-1.0
-2.0
-1.0
2.0
1.0
2.0
1.0
2.0
1.0
2.0
1.0
2.0
1.0
-2.0
-1.0
2.0
1.0
-2.0
-1.0
2.0
1.0
2.0
1.0
-2.0
-1.0
2.0
1.0
1.0
1.0
1.0
1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
0.0
1.0
0.0
1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
-0.0
-1.0
0.0
1.0
-0.0
-1.0
0.0
1.0
0.0
1.0
-0.0
-1.0
0.0
1.0
0.0
1.0
0.0
1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
-0.0
-1.0
0.0
1.0
-0.0
-1.0
0.0
1.0
0.0
1.0
-0.0
-1.0
0.0
1.0
0.5
1.0
0.5
1.0
-0.5
-1.0
-0.5
-1.0
-0.5
-1.0
-0.5
-1.0
0.5
1.0
0.5
1.0
0.5
1.0
0.5
1.0
0.5
1.0
-0.5
-1.0
0.5
1.0
-0.5
-1.0
0.5
1.0
0.5
1.0
-0.5
-1.0
0.5
1.0
1.0
1.0
1.0
1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
2.0
1.0
2.0
1.0
-2.0
-1.0
-2.0
-1.0
-2.0
-1.0
-2.0
-1.0
2.0
1.0
2.0
1.0
2.0
1.0
2.0
1.0
2.0
1.0
-2.0
-1.0
2.0
1.0
-2.0
-1.0
2.0
1.0
2.0
1.0
-2.0
-1.0
2.0
1.0
3.0
1.0
3.0
1.0
-3.0
-1.0
-3.0
-1.0
-3.0
-1.0
-3.0
-1.0
3.0
1.0
3.0
1.0
3.0
1.0
3.0
1.0
3.0
1.0
-3.0
-1.0
3.0
1.0
-3.0
-1.0
3.0
1.0
3.0
1.0
-3.0
-1.0
3.0
1.0
1e+300
1.0
1e+300
1.0
-1e+300
-1.0
-1e+300
-1.0
-1e+300
-1.0
-1e+300
-1.0
1e+300
1.0
1e+300
1.0
1e+300
1.0
1e+300
1.0
1e+300
1.0
-1e+300
-1.0
1e+300
1.0
-1e+300
-1.0
1e+300
1.0
1e+300
1.0
-1e+300
-1.0
1e+300
1.0
1e+300
1.0
1e+300
1.0
-1e+300
-1.0
-1e+300
-1.0
-1e+300
-1.0
-1e+300
-1.0
1e+300
1.0
1e+300
1.0
1e+300
1.0
1e+300
1.0
1e+300
1.0
-1e+300
-1.0
1e+300
1.0
-1e+300
-1.0
1e+300
1.0
1e+300
1.0
-1e+300
-1.0
1e+300
1.0
5e-324
1.0
5e-324
1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
-5e-324
-1.0
5e-324
1.0
-5e-324
-1.0
5e-324
1.0
5e-324
1.0
-5e-324
-1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
-5e-324
-1.0
5e-324
1.0
-5e-324
-1.0
5e-324
1.0
5e-324
1.0
-5e-324
-1.0
5e-324
1.0
inf
1.0
inf
1.0
-inf
-1.0
-inf
-1.0
-inf
-1.0
-inf
-1.0
inf
1.0
inf
1.0
inf
1.0
inf
1.0
inf
1.0
-inf
-1.0
inf
1.0
-inf
-1.0
inf
1.0
inf
1.0
-inf
-1.0
inf
1.0
inf
1.0
inf
1.0
-inf
-1.0
-inf
-1.0
-inf
-1.0
-inf
-1.0
inf
1.0
inf
1.0
inf
1.0
inf
1.0
inf
1.0
-inf
-1.0
inf
1.0
-inf
-1.0
inf
1.0
inf
1.0
-inf
-1.0
inf
1.0
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-cos

*import math as m
def checked(x):
    try:
        value = m.cos(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

1.0
1.0
0.5403023058681398
1.0
1.0
1.0
1.0
1.0
0.5403023058681398
1.0
0.5403023058681398
1.0
-0.4161468365471424
-1.0
-0.4161468365471424
-1.0
0.8775825618903728
1.0
0.8775825618903728
1.0
0.5403023058681395
1.0
0.5403023058681398
1.0
0.5403023058681398
1.0
0.5403023058681395
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
0.5623790762907029
1.0
0.5623790762907029
1.0
-0.5753861119575491
-1.0
-0.5753861119575491
-1.0
0.011800076512800236
1.0
0.011800076512800236
1.0
ValueError
ValueError
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-cosh

*import math as m
def checked(x):
    try:
        value = m.cosh(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

1.0
1.0
1.5430806348152437
1.0
1.0
1.0
1.0
1.0
1.5430806348152437
1.0
1.5430806348152437
1.0
3.7621956910836314
1.0
3.7621956910836314
1.0
1.1276259652063807
1.0
1.1276259652063807
1.0
1.5430806348152442
1.0
1.5430806348152437
1.0
1.5430806348152437
1.0
1.5430806348152442
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
OverflowError
OverflowError
OverflowError
OverflowError
OverflowError
OverflowError
inf
1.0
inf
1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-erf

*import math as m
def checked(x):
    try:
        value = m.erf(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
0.8427007929497149
1.0
-0.0
-1.0
0.0
1.0
-0.8427007929497149
-1.0
0.8427007929497149
1.0
-0.9953222650189527
-1.0
0.9953222650189527
1.0
-0.5204998778130465
-1.0
0.5204998778130465
1.0
-0.842700792949715
-1.0
-0.8427007929497148
-1.0
0.8427007929497148
1.0
0.842700792949715
1.0
-5e-324
-1.0
5e-324
1.0
-1.1283791670955126e-300
-1.0
1.1283791670955126e-300
1.0
-1.0
-1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
-1.0
-1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-erfc

*import math as m
def checked(x):
    try:
        value = m.erfc(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

1.0
1.0
0.15729920705028513
1.0
1.0
1.0
1.0
1.0
1.842700792949715
1.0
0.15729920705028513
1.0
1.9953222650189528
1.0
0.004677734981047265
1.0
1.5204998778130465
1.0
0.4795001221869535
1.0
1.842700792949715
1.0
1.8427007929497148
1.0
0.1572992070502852
1.0
0.15729920705028505
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
2.0
1.0
0.0
1.0
2.0
1.0
0.0
1.0
0.0
1.0
2.0
1.0
0.0
1.0
2.0
1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-exp

*import math as m
def checked(x):
    try:
        value = m.exp(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

1.0
1.0
2.718281828459045
1.0
1.0
1.0
1.0
1.0
0.36787944117144233
1.0
2.718281828459045
1.0
0.1353352832366127
1.0
7.38905609893065
1.0
0.6065306597126334
1.0
1.6487212707001282
1.0
0.3678794411714422
1.0
0.3678794411714424
1.0
2.718281828459045
1.0
2.718281828459046
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
0.0
1.0
OverflowError
0.0
1.0
OverflowError
OverflowError
0.0
1.0
inf
1.0
0.0
1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-exp2

*import math as m
def checked(x):
    try:
        value = m.exp2(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

1.0
1.0
2.0
1.0
1.0
1.0
1.0
1.0
0.5
1.0
2.0
1.0
0.25
1.0
4.0
1.0
0.7071067811865476
1.0
1.4142135623730951
1.0
0.49999999999999994
1.0
0.5
1.0
1.9999999999999998
1.0
2.0000000000000004
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
9.332636185032189e-302
1.0
1.0715086071862673e+301
1.0
0.0
1.0
OverflowError
OverflowError
0.0
1.0
inf
1.0
0.0
1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-expm1

*import math as m
def checked(x):
    try:
        value = m.expm1(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
1.718281828459045
1.0
-0.0
-1.0
0.0
1.0
-0.6321205588285577
-1.0
1.718281828459045
1.0
-0.8646647167633873
-1.0
6.38905609893065
1.0
-0.3934693402873666
-1.0
0.6487212707001282
1.0
-0.6321205588285578
-1.0
-0.6321205588285577
-1.0
1.7182818284590449
1.0
1.718281828459046
1.0
-5e-324
-1.0
5e-324
1.0
-1e-300
-1.0
1e-300
1.0
-1.0
-1.0
OverflowError
-1.0
-1.0
OverflowError
OverflowError
-1.0
-1.0
inf
1.0
-1.0
-1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-fabs

*import math as m
def checked(x):
    try:
        value = m.fabs(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
1.0
1.0
0.0
1.0
0.0
1.0
1.0
1.0
1.0
1.0
2.0
1.0
2.0
1.0
0.5
1.0
0.5
1.0
1.0000000000000002
1.0
0.9999999999999999
1.0
0.9999999999999999
1.0
1.0000000000000002
1.0
5e-324
1.0
5e-324
1.0
1e-300
1.0
1e-300
1.0
1000.0
1.0
1000.0
1.0
1e+300
1.0
1e+300
1.0
9.223372036854776e+18
1.0
9.223372036854776e+18
1.0
inf
1.0
inf
1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-floor

*import math as m
def checked(x):
    try:
        value = m.floor(x)
        print(value)
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1.5, 1.5, -0.1, 0.1, -5e-324, 5e-324, 9007199254740993, -9007199254740993, 9223372036854775807, -9223372036854775808, 9223372036854774784.0, -9223372036854775808.0, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0
1
0
0
-2
1
-1
0
-1
0
9007199254740993
-9007199254740993
9223372036854775807
-9223372036854775808
9223372036854774784
-9223372036854775808
OverflowError
OverflowError
ValueError
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-fmod

*import math as m
def checked(x, y):
    try:
        value = m.fmod(x, y)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
        for y in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
            checked(x, y)
    checked("bad", 1)
    checked(1, "bad")
    checked(None, 1)
    checked(1, None)
    return 0

Expected standard output:

ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
nan
ValueError
0.0
1.0
1.0
1.0
1.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
0.0
1.0
0.0
1.0
1.0
1.0
1.0
1.0
nan
ValueError
-0.0
-1.0
-0.0
-1.0
-1.0
-1.0
-0.0
-1.0
ValueError
ValueError
-0.0
-1.0
-0.0
-1.0
-1.0
-1.0
-0.0
-1.0
-9.0
-1.0
-9.0
-1.0
-0.0
-1.0
-0.0
-1.0
-9.0
-1.0
-9.0
-1.0
nan
ValueError
-0.0
-1.0
-2.0
-1.0
-0.0
-1.0
-0.0
-1.0
ValueError
ValueError
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-2.0
-1.0
-2.0
-1.0
-2.0
-1.0
-0.0
-1.0
-0.0
-1.0
-2.0
-1.0
-2.0
-1.0
nan
ValueError
-0.0
-1.0
-1.0
-1.0
-1.0
-1.0
-0.0
-1.0
ValueError
ValueError
-0.0
-1.0
-0.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-0.0
-1.0
-0.0
-1.0
-1.0
-1.0
-1.0
-1.0
nan
ValueError
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
ValueError
ValueError
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
nan
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
nan
ValueError
0.5
1.0
0.5
1.0
0.5
1.0
0.5
1.0
ValueError
ValueError
0.0
1.0
0.5
1.0
0.5
1.0
0.5
1.0
0.5
1.0
0.5
1.0
0.0
1.0
0.0
1.0
0.5
1.0
0.5
1.0
nan
ValueError
0.0
1.0
1.0
1.0
1.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
0.0
1.0
0.0
1.0
1.0
1.0
1.0
1.0
nan
ValueError
0.0
1.0
2.0
1.0
0.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
2.0
1.0
2.0
1.0
2.0
1.0
0.0
1.0
0.0
1.0
2.0
1.0
2.0
1.0
nan
ValueError
0.0
1.0
3.0
1.0
1.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
1.0
1.0
0.0
1.0
3.0
1.0
3.0
1.0
0.0
1.0
0.0
1.0
3.0
1.0
3.0
1.0
nan
ValueError
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
ValueError
ValueError
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-1e+300
-1.0
-1e+300
-1.0
nan
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
1e+300
1.0
1e+300
1.0
nan
ValueError
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
ValueError
ValueError
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-0.0
-1.0
-0.0
-1.0
-5e-324
-1.0
-5e-324
-1.0
nan
ValueError
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
ValueError
ValueError
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
0.0
1.0
0.0
1.0
5e-324
1.0
5e-324
1.0
nan
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
nan
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-isclose

*import math as m
def checked(x, y):
    try:
        value = m.isclose(x, y)
        print(value)
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
        for y in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
            checked(x, y)
    checked("bad", 1)
    checked(1, "bad")
    checked(None, 1)
    checked(1, None)
    return 0

Expected standard output:

True
False
False
False
False
True
True
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
True
True
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
True
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-isfinite

*import math as m
def checked(x):
    try:
        value = m.isfinite(x)
        print(value)
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
False
False
False
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-isinf

*import math as m
def checked(x):
    try:
        value = m.isinf(x)
        print(value)
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
True
False
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-isnan

*import math as m
def checked(x):
    try:
        value = m.isnan(x)
        print(value)
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-log

*import math as m
def checked(x, y):
    try:
        value = m.log(x, y)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
        for y in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
            checked(x, y)
    checked("bad", 1)
    checked(1, "bad")
    checked(None, 1)
    checked(1, None)
    print(m.log(1), m.log(m.e), m.log(m.inf))
    return 0

Expected standard output:

ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ZeroDivisionError
ValueError
ValueError
ValueError
ValueError
ValueError
-0.0
-1.0
ZeroDivisionError
0.0
1.0
0.0
1.0
ValueError
0.0
1.0
ValueError
-0.0
-1.0
0.0
1.0
ValueError
nan
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ZeroDivisionError
ValueError
ValueError
ValueError
ValueError
ValueError
1.0
1.0
ZeroDivisionError
-1.0
-1.0
-0.6309297535714574
-1.0
ValueError
-0.0010034333188799374
-1.0
ValueError
0.000931098696461825
1.0
-0.0
-1.0
ValueError
nan
ValueError
ZeroDivisionError
ValueError
ValueError
ValueError
ValueError
ValueError
-0.0
-1.0
ZeroDivisionError
0.0
1.0
0.0
1.0
ValueError
0.0
1.0
ValueError
-0.0
-1.0
0.0
1.0
ValueError
nan
ValueError
ZeroDivisionError
ValueError
ValueError
ValueError
ValueError
ValueError
-1.0
-1.0
ZeroDivisionError
1.0
1.0
0.6309297535714574
1.0
ValueError
0.0010034333188799374
1.0
ValueError
-0.000931098696461825
-1.0
0.0
1.0
ValueError
nan
ValueError
ZeroDivisionError
ValueError
ValueError
ValueError
ValueError
ValueError
-1.5849625007211563
-1.0
ZeroDivisionError
1.5849625007211563
1.0
1.0
1.0
ValueError
0.001590404182398875
1.0
ValueError
-0.001475756518362343
-1.0
0.0
1.0
ValueError
nan
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ZeroDivisionError
ValueError
ValueError
ValueError
ValueError
ValueError
-996.5784284662087
-1.0
ZeroDivisionError
996.5784284662087
1.0
628.7709822868153
1.0
ValueError
1.0
1.0
ValueError
-0.927912875666861
-1.0
0.0
1.0
ValueError
nan
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ZeroDivisionError
ValueError
ValueError
ValueError
ValueError
ValueError
1074.0
1.0
ZeroDivisionError
-1074.0
-1.0
-677.6185553357452
-1.0
ValueError
-1.0776873844770527
-1.0
ValueError
1.0
1.0
-0.0
-1.0
ValueError
nan
ValueError
ZeroDivisionError
ValueError
ValueError
ValueError
ValueError
ValueError
-inf
-1.0
ZeroDivisionError
inf
1.0
inf
1.0
ValueError
inf
1.0
ValueError
-inf
-1.0
nan
ValueError
nan
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ZeroDivisionError
ValueError
ValueError
ValueError
ValueError
ValueError
nan
ZeroDivisionError
nan
nan
ValueError
nan
ValueError
nan
nan
ValueError
nan
TypeError
TypeError
TypeError
TypeError
0.0 1.0 inf

Expected exit code: 0

Example: native-log10

*import math as m
def checked(x):
    try:
        value = m.log10(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

ValueError
0.0
1.0
ValueError
ValueError
ValueError
0.0
1.0
ValueError
0.3010299956639812
1.0
ValueError
-0.3010299956639812
-1.0
ValueError
ValueError
-4.8216373327664354e-17
-1.0
9.64327466553287e-17
1.0
ValueError
-323.3062153431158
-1.0
ValueError
-300.0
-1.0
ValueError
3.0
1.0
ValueError
300.0
1.0
18.964889726830815
1.0
ValueError
inf
1.0
ValueError
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-log1p

*import math as m
def checked(x):
    try:
        value = m.log1p(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
0.6931471805599453
1.0
-0.0
-1.0
0.0
1.0
ValueError
0.6931471805599453
1.0
ValueError
1.0986122886681096
1.0
-0.6931471805599453
-1.0
0.4054651081081644
1.0
ValueError
-36.7368005696771
-1.0
0.6931471805599453
1.0
0.6931471805599454
1.0
-5e-324
-1.0
5e-324
1.0
-1e-300
-1.0
1e-300
1.0
ValueError
6.90875477931522
1.0
ValueError
690.7755278982137
1.0
43.66827237527655
1.0
ValueError
inf
1.0
ValueError
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-log2

*import math as m
def checked(x):
    try:
        value = m.log2(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

ValueError
0.0
1.0
ValueError
ValueError
ValueError
0.0
1.0
ValueError
1.0
1.0
ValueError
-1.0
-1.0
ValueError
ValueError
-1.6017132519074588e-16
-1.0
3.203426503814917e-16
1.0
ValueError
-1074.0
-1.0
ValueError
-996.5784284662087
-1.0
ValueError
9.965784284662087
1.0
ValueError
996.5784284662087
1.0
63.0
1.0
ValueError
inf
1.0
ValueError
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-pow

*import math as m
def checked(x, y):
    try:
        value = m.pow(x, y)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
        for y in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
            checked(x, y)
    checked("bad", 1)
    checked(1, "bad")
    checked(None, 1)
    checked(1, None)
    return 0

Expected standard output:

1.0
1.0
0.0
1.0
ValueError
ValueError
ValueError
1.0
1.0
1.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
ValueError
0.0
1.0
ValueError
0.0
1.0
0.0
1.0
inf
1.0
nan
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
-9.0
-1.0
-2.581174791713197e-09
-1.0
0.012345679012345678
1.0
-0.1111111111111111
-1.0
1.0
1.0
1.0
1.0
ValueError
-9.0
-1.0
81.0
1.0
-729.0
-1.0
0.0
1.0
OverflowError
ValueError
ValueError
inf
1.0
0.0
1.0
nan
1.0
1.0
-2.0
-1.0
-0.001953125
-1.0
0.25
1.0
-0.5
-1.0
1.0
1.0
1.0
1.0
ValueError
-2.0
-1.0
4.0
1.0
-8.0
-1.0
0.0
1.0
OverflowError
ValueError
ValueError
inf
1.0
0.0
1.0
nan
1.0
1.0
-1.0
-1.0
-1.0
-1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
1.0
1.0
ValueError
-1.0
-1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
1.0
1.0
ValueError
ValueError
1.0
1.0
1.0
1.0
nan
1.0
1.0
-0.0
-1.0
ValueError
ValueError
ValueError
1.0
1.0
1.0
1.0
0.0
1.0
-0.0
-1.0
0.0
1.0
-0.0
-1.0
ValueError
0.0
1.0
ValueError
0.0
1.0
0.0
1.0
inf
1.0
nan
1.0
1.0
0.0
1.0
ValueError
ValueError
ValueError
1.0
1.0
1.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
ValueError
0.0
1.0
ValueError
0.0
1.0
0.0
1.0
inf
1.0
nan
1.0
1.0
0.5
1.0
512.0
1.0
4.0
1.0
2.0
1.0
1.0
1.0
1.0
1.0
0.7071067811865476
1.0
0.5
1.0
0.25
1.0
0.125
1.0
OverflowError
0.0
1.0
1.0
1.0
1.0
1.0
0.0
1.0
inf
1.0
nan
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
2.0
1.0
0.001953125
1.0
0.25
1.0
0.5
1.0
1.0
1.0
1.0
1.0
1.4142135623730951
1.0
2.0
1.0
4.0
1.0
8.0
1.0
0.0
1.0
OverflowError
1.0
1.0
1.0
1.0
inf
1.0
0.0
1.0
nan
1.0
1.0
3.0
1.0
5.080526342529086e-05
1.0
0.1111111111111111
1.0
0.3333333333333333
1.0
1.0
1.0
1.0
1.0
1.7320508075688772
1.0
3.0
1.0
9.0
1.0
27.0
1.0
0.0
1.0
OverflowError
1.0
1.0
1.0
1.0
inf
1.0
0.0
1.0
nan
1.0
1.0
-1e+300
-1.0
-0.0
-1.0
0.0
1.0
-1e-300
-1.0
1.0
1.0
1.0
1.0
ValueError
-1e+300
-1.0
OverflowError
OverflowError
0.0
1.0
OverflowError
ValueError
ValueError
inf
1.0
0.0
1.0
nan
1.0
1.0
1e+300
1.0
0.0
1.0
0.0
1.0
1e-300
1.0
1.0
1.0
1.0
1.0
1e+150
1.0
1e+300
1.0
OverflowError
OverflowError
0.0
1.0
OverflowError
1.0
1.0
1.0
1.0
inf
1.0
0.0
1.0
nan
1.0
1.0
-5e-324
-1.0
OverflowError
OverflowError
OverflowError
1.0
1.0
1.0
1.0
ValueError
-5e-324
-1.0
0.0
1.0
-0.0
-1.0
OverflowError
0.0
1.0
ValueError
ValueError
0.0
1.0
inf
1.0
nan
1.0
1.0
5e-324
1.0
OverflowError
OverflowError
OverflowError
1.0
1.0
1.0
1.0
2.2227587494850775e-162
1.0
5e-324
1.0
0.0
1.0
0.0
1.0
OverflowError
0.0
1.0
1.0
1.0
1.0
1.0
0.0
1.0
inf
1.0
nan
1.0
1.0
inf
1.0
0.0
1.0
0.0
1.0
0.0
1.0
1.0
1.0
1.0
1.0
inf
1.0
inf
1.0
inf
1.0
inf
1.0
0.0
1.0
inf
1.0
0.0
1.0
inf
1.0
inf
1.0
0.0
1.0
nan
1.0
1.0
-inf
-1.0
-0.0
-1.0
0.0
1.0
-0.0
-1.0
1.0
1.0
1.0
1.0
inf
1.0
-inf
-1.0
inf
1.0
-inf
-1.0
0.0
1.0
inf
1.0
0.0
1.0
inf
1.0
inf
1.0
0.0
1.0
nan
1.0
1.0
nan
nan
nan
nan
1.0
1.0
1.0
1.0
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-remainder

*import math as m
def checked(x, y):
    try:
        value = m.remainder(x, y)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
        for y in [False, True, -9, -2, -1, -0.0, 0.0, 0.5, 1.0, 2.0, 3.0, -1e300, 1e300, -5e-324, 5e-324, m.inf, -m.inf, m.nan]:
            checked(x, y)
    checked("bad", 1)
    checked(1, "bad")
    checked(None, 1)
    checked(1, None)
    return 0

Expected standard output:

ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
nan
ValueError
0.0
1.0
1.0
1.0
1.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
0.0
1.0
0.0
1.0
1.0
1.0
1.0
1.0
nan
ValueError
-0.0
-1.0
-0.0
-1.0
-1.0
-1.0
-0.0
-1.0
ValueError
ValueError
-0.0
-1.0
-0.0
-1.0
-1.0
-1.0
-0.0
-1.0
-9.0
-1.0
-9.0
-1.0
-0.0
-1.0
-0.0
-1.0
-9.0
-1.0
-9.0
-1.0
nan
ValueError
-0.0
-1.0
-2.0
-1.0
-0.0
-1.0
-0.0
-1.0
ValueError
ValueError
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
1.0
1.0
-2.0
-1.0
-2.0
-1.0
-0.0
-1.0
-0.0
-1.0
-2.0
-1.0
-2.0
-1.0
nan
ValueError
-0.0
-1.0
-1.0
-1.0
-1.0
-1.0
-0.0
-1.0
ValueError
ValueError
-0.0
-1.0
-0.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-1.0
-0.0
-1.0
-0.0
-1.0
-1.0
-1.0
-1.0
-1.0
nan
ValueError
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
ValueError
ValueError
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
nan
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
nan
ValueError
0.5
1.0
0.5
1.0
0.5
1.0
0.5
1.0
ValueError
ValueError
0.0
1.0
0.5
1.0
0.5
1.0
0.5
1.0
0.5
1.0
0.5
1.0
0.0
1.0
0.0
1.0
0.5
1.0
0.5
1.0
nan
ValueError
0.0
1.0
1.0
1.0
1.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
0.0
1.0
0.0
1.0
1.0
1.0
1.0
1.0
nan
ValueError
0.0
1.0
2.0
1.0
0.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
-1.0
-1.0
2.0
1.0
2.0
1.0
0.0
1.0
0.0
1.0
2.0
1.0
2.0
1.0
nan
ValueError
0.0
1.0
3.0
1.0
-1.0
-1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
-1.0
-1.0
0.0
1.0
3.0
1.0
3.0
1.0
0.0
1.0
0.0
1.0
3.0
1.0
3.0
1.0
nan
ValueError
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
ValueError
ValueError
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-0.0
-1.0
-1e+300
-1.0
-1e+300
-1.0
nan
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
ValueError
ValueError
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
0.0
1.0
1e+300
1.0
1e+300
1.0
nan
ValueError
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
ValueError
ValueError
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-5e-324
-1.0
-0.0
-1.0
-0.0
-1.0
-5e-324
-1.0
-5e-324
-1.0
nan
ValueError
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
ValueError
ValueError
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
5e-324
1.0
0.0
1.0
0.0
1.0
5e-324
1.0
5e-324
1.0
nan
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
nan
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
ValueError
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-sin

*import math as m
def checked(x):
    try:
        value = m.sin(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
0.8414709848078965
1.0
-0.0
-1.0
0.0
1.0
-0.8414709848078965
-1.0
0.8414709848078965
1.0
-0.9092974268256817
-1.0
0.9092974268256817
1.0
-0.479425538604203
-1.0
0.479425538604203
1.0
-0.8414709848078966
-1.0
-0.8414709848078964
-1.0
0.8414709848078964
1.0
0.8414709848078966
1.0
-5e-324
-1.0
5e-324
1.0
-1e-300
-1.0
1e-300
1.0
-0.8268795405320025
-1.0
0.8268795405320025
1.0
0.8178819121159085
1.0
-0.8178819121159085
-1.0
0.9999303766734422
1.0
-0.9999303766734422
-1.0
ValueError
ValueError
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-sinh

*import math as m
def checked(x):
    try:
        value = m.sinh(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
1.1752011936438014
1.0
-0.0
-1.0
0.0
1.0
-1.1752011936438014
-1.0
1.1752011936438014
1.0
-3.626860407847019
-1.0
3.626860407847019
1.0
-0.5210953054937474
-1.0
0.5210953054937474
1.0
-1.1752011936438018
-1.0
-1.1752011936438014
-1.0
1.1752011936438014
1.0
1.1752011936438018
1.0
-5e-324
-1.0
5e-324
1.0
-1e-300
-1.0
1e-300
1.0
OverflowError
OverflowError
OverflowError
OverflowError
OverflowError
OverflowError
inf
1.0
-inf
-1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-sqrt

*import math as m
def checked(x):
    try:
        value = m.sqrt(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
1.0
1.0
-0.0
-1.0
0.0
1.0
ValueError
1.0
1.0
ValueError
1.4142135623730951
1.0
ValueError
0.7071067811865476
1.0
ValueError
ValueError
0.9999999999999999
1.0
1.0
1.0
ValueError
2.2227587494850775e-162
1.0
ValueError
1e-150
1.0
ValueError
31.622776601683793
1.0
ValueError
1e+150
1.0
3037000499.97605
1.0
ValueError
inf
1.0
ValueError
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-tan

*import math as m
def checked(x):
    try:
        value = m.tan(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
1.5574077246549023
1.0
-0.0
-1.0
0.0
1.0
-1.5574077246549023
-1.0
1.5574077246549023
1.0
2.185039863261519
1.0
-2.185039863261519
-1.0
-0.5463024898437905
-1.0
0.5463024898437905
1.0
-1.557407724654903
-1.0
-1.5574077246549018
-1.0
1.5574077246549018
1.0
1.557407724654903
1.0
-5e-324
-1.0
5e-324
1.0
-1e-300
-1.0
1e-300
1.0
-1.4703241557027185
-1.0
1.4703241557027185
1.0
-1.4214488238747245
-1.0
1.4214488238747245
1.0
84.73931296875567
1.0
-84.73931296875567
-1.0
ValueError
ValueError
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-tanh

*import math as m
def checked(x):
    try:
        value = m.tanh(x)
        print(value)
        if not m.isnan(value):
            print(m.copysign(1, value))
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1, 1, -2, 2, -0.5, 0.5, -1.0000000000000002, -0.9999999999999999, 0.9999999999999999, 1.0000000000000002, -5e-324, 5e-324, -1e-300, 1e-300, -1000.0, 1000.0, -1e300, 1e300, 9223372036854775807, -9223372036854775808, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0.0
1.0
0.7615941559557649
1.0
-0.0
-1.0
0.0
1.0
-0.7615941559557649
-1.0
0.7615941559557649
1.0
-0.9640275800758169
-1.0
0.9640275800758169
1.0
-0.46211715726000974
-1.0
0.46211715726000974
1.0
-0.761594155955765
-1.0
-0.7615941559557649
-1.0
0.7615941559557649
1.0
0.761594155955765
1.0
-5e-324
-1.0
5e-324
1.0
-1e-300
-1.0
1e-300
1.0
-1.0
-1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
1.0
1.0
-1.0
-1.0
1.0
1.0
-1.0
-1.0
nan
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Example: native-trunc

*import math as m
def checked(x):
    try:
        value = m.trunc(x)
        print(value)
    except ValueError:
        print("ValueError")
    except OverflowError:
        print("OverflowError")
    except TypeError:
        print("TypeError")
    except ZeroDivisionError:
        print("ZeroDivisionError")
def main():
    for x in [False, True, -0.0, 0.0, -1.5, 1.5, -0.1, 0.1, -5e-324, 5e-324, 9007199254740993, -9007199254740993, 9223372036854775807, -9223372036854775808, 9223372036854774784.0, -9223372036854775808.0, m.inf, -m.inf, m.nan, "bad", None, [], {}]:
        checked(x)
    return 0

Expected standard output:

0
1
0
0
-1
1
0
0
0
0
9007199254740993
-9007199254740993
9223372036854775807
-9223372036854775808
9223372036854774784
-9223372036854775808
OverflowError
OverflowError
ValueError
TypeError
TypeError
TypeError
TypeError

Expected exit code: 0

Constants

e = 0x1.5bf0a8b145769p+1

Binary64 approximation of the base of natural logarithms.

inf = inf

Positive infinity; negate it to express negative infinity.

nan = nan

A quiet NaN value; classify it using isnan, not equality.

pi = 0x1.921fb54442d18p+1

Binary64 approximation of the circle constant pi.

tau = 0x1.921fb54442d18p+2

Binary64 approximation of two times pi.