package/python-mpmath: new package

mpmath is a free (BSD licensed) Python library for real and
complex floating-point arithmetic with arbitrary precision.

https://mpmath.org/

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Julien Olivain
2024-04-27 17:30:44 +02:00
committed by Thomas Petazzoni
parent a1c4d6c884
commit b9c09bd3c4
7 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
#! /usr/bin/env python3
# Test inspired from example published on the project page:
# https://mpmath.org/
from mpmath import mp
mp.dps = 50
result = mp.quad(lambda x: mp.exp(-x**2), [-mp.inf, mp.inf]) ** 2
# Pi digits can be cross-checked here:
# https://www.angio.net/pi/digits.html
expected_result = "3.1415926535897932384626433832795028841971693993751"
assert str(result) == expected_result