calco is a high-performance, cross-platform math library written in C and exposed as a Python extension.
It provides fast, accurate, and comprehensive implementations of advanced mathematical operations beyond what's available in Python's MATH
modules.
calco is designed to be the fastest library for complex or moderately complex individual mathematical operations in Python, offering speeds over 30% faster than the built-in math
module. Additionally, it supports ready-to-use functions not available in math
.
Install from PyPI:
pip install calco
You can also manually download the appropriate version for your system from the links below in the Downloads section.
import calco
# Basic math
print(calco.add(3.0, 4.5)) # 7.5
print(calco.divide(10.0, 3.0)) # 3.333...
# Trigonometry
print(calco.sine(1.57)) # โ sin(90ยฐ)
print(calco.arctangent2(2.0, 3.0)) # atan2(y, x)
# Logarithmic
print(calco.log_base10(1000)) # 3.0
# Special
print(calco.gamma_function(0.5)) # โ sqrt(pi)
print(calco.fused_multiply_add(2, 3, 4)) # (2*3)+4 = 10
Category | Functions |
---|---|
Arithmetic | add, subtract, multiply, divide, power, square_root, cube_root, absolute_value, float_modulo, positive_difference, copy_sign_double, fused_multiply_add |
Rounding | floor_val, ceil_val, round_val, nearbyint_val, truncate_val |
Trigonometric | sine, cosine, tangent, arcsine, arccosine, arctangent, arctangent2 |
Hyperbolic | hyperbolic_sine, hyperbolic_cosine, hyperbolic_tangent, inverse_hyperbolic_sine, inverse_hyperbolic_cosine, inverse_hyperbolic_tangent |
Logarithmic | natural_log, log_base10, log_base2, log_custom_base |
Exponential | exponential, exponential_base2, exponential_minus_1 |
Special | gamma_function, log_gamma_function, error_function, complementary_error_function, next_after_double |
Constants | get_pi, get_e |
Converters | degrees_to_radians, radians_to_degrees |
Checks | is_nan, is_infinity |
OS | Architectures |
---|---|
Windows | x86 / x64 |
Linux | x86_64, ARM (via wheel) |
macOS | Intel / Apple Silicon |
Select the appropriate wheel file for your Python version and system architecture.
MIT License โ free for personal, academic, and commercial use.