Skip to main content
Help us improve Python packaging – donate today!

Various number types for Python

Project Description

Various number types for Python

Usage

Typed complex

Use a complex number with different types for its real and imaginary parts:

>>> from number_types.typed_complex import *
>>> z = DecimalComplex('0.2', '0.1')
>>> z + DecimalComplex('0.1', '0.2')
DecimalComplex(Decimal('0.3'), Decimal('0.3'))
>>> z = complex(0.2, 0.1)
>>> z + complex(0.1, 0.2)
(0.30000000000000004+0.30000000000000004j)

Coordinates

A class representing a (2D) coordinate.

>>> from number_types import Coordinate
>>> Coordinate(0, 1) + Coordinate(1, 0)
>>> Coordinate(1, 1)
>>> Coordinate(-1, 0).to_polar()
Coordinate(1.0, 3.141592653589793, False)
>>> Coordinate(-1, 0).to_polar().equals(Coordinate(-1, 0))
True
>>> Coordinate(3, 4).to_polar()
Coordinate(5.0, 0.9272952180016122, False)
>>> abs(Coordinate(3, 4))
5.0
>>> Coordinate(3, 4).conjugate
Coordinate(3, -4)

Installing

From PyPI

$ pip install number_types

From source

$ git clone 'https://github.com/MitalAshok/number_types.git'
$ python ./number_types/setup.py install

Release history Release notifications

This version
History Node

0.0.5

History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

History Node

0.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
number_types-0.0.5.tar.gz (4.7 kB) Copy SHA256 hash SHA256 Source None Jun 29, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page