Skip to content

Commit 2fb33b0

Browse files
committed
Cleanup API docs and CHANGELOG
1 parent 1b97b27 commit 2fb33b0

File tree

19 files changed

+228
-1882
lines changed

19 files changed

+228
-1882
lines changed

quaddtype/docs/api/constants_api.md

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,50 @@ Pre-defined mathematical constants with quad precision accuracy.
77
```{eval-rst}
88
.. data:: numpy_quaddtype.pi
99
10-
The mathematical constant π (pi).
11-
10+
The mathematical constant :math:`pi` (pi).
11+
1212
Value: 3.14159265358979323846264338327950288...
13-
13+
1414
:type: QuadPrecision
1515
1616
.. data:: numpy_quaddtype.e
1717
18-
Euler's number, the base of natural logarithms.
19-
18+
Euler's number :math:`e`, the base of natural logarithms.
19+
2020
Value: 2.71828182845904523536028747135266249...
21-
21+
2222
:type: QuadPrecision
2323
2424
.. data:: numpy_quaddtype.log2e
2525
26-
The base-2 logarithm of e: log₂(e).
27-
26+
The base-2 logarithm of :math:`e`: :math:`\log_{2}{e}`.
27+
2828
Value: 1.44269504088896340735992468100189213...
29-
29+
3030
:type: QuadPrecision
3131
3232
.. data:: numpy_quaddtype.log10e
3333
34-
The base-10 logarithm of e: log₁₀(e).
35-
34+
The base-10 logarithm of :math:`e`: :math:`\log_{10}{e}`.
35+
3636
Value: 0.43429448190325182765112891891660508...
37-
37+
3838
:type: QuadPrecision
3939
4040
.. data:: numpy_quaddtype.ln2
4141
42-
The natural logarithm of 2: ln(2).
43-
42+
The natural logarithm of 2: :math:`\ln(2)`.
43+
4444
Value: 0.69314718055994530941723212145817656...
45-
45+
4646
:type: QuadPrecision
4747
4848
.. data:: numpy_quaddtype.ln10
4949
50-
The natural logarithm of 10: ln(10).
51-
50+
The natural logarithm of 10: :math:`\ln(10)`.
51+
5252
Value: 2.30258509299404568401799145468436420...
53-
53+
5454
:type: QuadPrecision
5555
```
5656

@@ -59,38 +59,44 @@ Pre-defined mathematical constants with quad precision accuracy.
5959
```{eval-rst}
6060
.. data:: numpy_quaddtype.epsilon
6161
62-
Machine epsilon: the smallest positive number such that 1.0 + epsilon 1.0.
63-
64-
Approximately 1.93 × 10⁻³⁴.
65-
62+
Machine epsilon: the smallest positive number such that :math:`1.0 + \epsilon \neq 1.0`.
63+
64+
:math:`2^{-112}` or approximately :math:`1.93 \cdot 10^{-34}`.
65+
6666
:type: QuadPrecision
6767
6868
.. data:: numpy_quaddtype.max_value
6969
7070
The largest representable finite quad-precision value.
71-
72-
Approximately 1.19 × 10⁴⁹³².
73-
71+
72+
:math:`216383 \cdot (2 - 2^{-112})` or approximately :math:`1.19 \cdot 10^{4932}`.
73+
74+
The largest negative representable finite quad-precision value is `-numpy_quaddtype.max_value`.
75+
7476
:type: QuadPrecision
7577
7678
.. data:: numpy_quaddtype.smallest_normal
7779
78-
The smallest positive normalized quad-precision value.
79-
80-
Approximately 3.36 × 10⁻⁴⁹³².
81-
80+
The smallest positive normal (normalized, mantissa has a leading 1 bit) quad-precision value.
81+
82+
:math:`2^{-16382} \cdot (1 - 2^{-112})` or approximately :math:`3.36 \cdot 10^{-4932}`.
83+
8284
:type: QuadPrecision
8385
8486
.. data:: numpy_quaddtype.smallest_subnormal
8587
86-
The smallest positive subnormal (denormalized) quad-precision value.
87-
88+
The smallest positive subnormal (denormalized, mantissa has a leading 0 bit) quad-precision value.
89+
90+
:math:`2^{-16494}` or approximately :math:`6.48 \cdot 10^{-4966}`.
91+
8892
:type: QuadPrecision
8993
9094
.. data:: numpy_quaddtype.resolution
9195
92-
The approximate decimal resolution of quad precision.
93-
96+
The approximate decimal resolution of quad precision, i.e. `10 ** (-precision)`.
97+
98+
:math:`10^{-33}`.
99+
94100
:type: QuadPrecision
95101
```
96102

@@ -99,15 +105,15 @@ Pre-defined mathematical constants with quad precision accuracy.
99105
```{eval-rst}
100106
.. data:: numpy_quaddtype.bits
101107
102-
Total number of bits in quad precision representation.
103-
108+
The total number of bits in quad precision representation.
109+
104110
:value: 128
105111
:type: int
106112
107113
.. data:: numpy_quaddtype.precision
108114
109-
Approximate number of significant decimal digits.
110-
115+
The approximate number of significant decimal digits.
116+
111117
:value: 33
112118
:type: int
113119
```
@@ -130,7 +136,7 @@ import numpy as np
130136
from numpy_quaddtype import QuadPrecDType
131137

132138
# e^(ln2) should equal 2
133-
two = np.exp(np.array([ln2]))[0]
139+
two = np.exp(np.array(ln2))
134140
print(f"e^(ln2) = {two}")
135141

136142
# log2(e) * ln(2) should equal 1

quaddtype/docs/api/core.md

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,58 +8,58 @@ The fundamental types provided by NumPy QuadDType.
88
.. class:: numpy_quaddtype.QuadPrecision(value, backend="sleef")
99
1010
A quad-precision (128-bit) floating-point scalar.
11-
11+
1212
QuadPrecision is a NumPy scalar type that provides IEEE 754 binary128
1313
floating-point arithmetic. It can be used standalone or as elements
1414
of NumPy arrays.
15-
16-
:param value: The value to convert to quad precision. Can be:
17-
15+
16+
:param value: The value to convert to quad precision. It can be:
17+
1818
- ``float`` or ``int``: Python numeric types
1919
- ``str``: String representation for maximum precision
2020
- ``bytes``: Raw 16-byte representation
2121
- ``numpy.floating`` or ``numpy.integer``: NumPy numeric types
2222
- ``QuadPrecision``: Another QuadPrecision value
23-
2423
:type value: float, int, str, bytes, numpy scalar, or QuadPrecision
24+
2525
:param backend: Computation backend to use. Either ``"sleef"`` (default)
2626
or ``"longdouble"``.
2727
:type backend: str, optional
28-
28+
2929
**Examples**
30-
30+
3131
Create from different input types::
32-
32+
3333
>>> from numpy_quaddtype import QuadPrecision
3434
>>> QuadPrecision(3.14)
3535
QuadPrecision('3.14000000000000012434...')
3636
>>> QuadPrecision("3.14159265358979323846264338327950288")
3737
QuadPrecision('3.14159265358979323846264338327950288')
3838
>>> QuadPrecision(42)
3939
QuadPrecision('42.0')
40-
40+
4141
Arithmetic operations::
42-
42+
4343
>>> x = QuadPrecision("1.5")
4444
>>> y = QuadPrecision("2.5")
4545
>>> x + y
4646
QuadPrecision('4.0')
4747
>>> x * y
4848
QuadPrecision('3.75')
49-
49+
5050
.. attribute:: dtype
5151
:type: QuadPrecDType
52-
52+
5353
The NumPy dtype for this scalar.
54-
54+
5555
.. attribute:: real
5656
:type: QuadPrecision
57-
58-
The real part (returns self for real numbers).
59-
57+
58+
The real part (always self for QuadPrecision).
59+
6060
.. attribute:: imag
6161
:type: QuadPrecision
62-
62+
6363
The imaginary part (always zero for QuadPrecision).
6464
```
6565

@@ -69,45 +69,45 @@ The fundamental types provided by NumPy QuadDType.
6969
.. class:: numpy_quaddtype.QuadPrecDType(backend="sleef")
7070
7171
NumPy dtype for quad-precision floating-point arrays.
72-
73-
QuadPrecDType is a custom NumPy dtype that enables creation and
72+
73+
QuadPrecDType is a custom NumPy dtype that enables the creation and
7474
manipulation of arrays containing quad-precision values.
75-
75+
7676
:param backend: Computation backend. Either ``"sleef"`` (default) or
7777
``"longdouble"``.
7878
:type backend: str, optional
79-
79+
8080
**Examples**
81-
81+
8282
Create arrays with QuadPrecDType::
83-
83+
8484
>>> import numpy as np
8585
>>> from numpy_quaddtype import QuadPrecDType
8686
>>> arr = np.array([1, 2, 3], dtype=QuadPrecDType())
8787
>>> arr.dtype
8888
QuadPrecDType128
8989
>>> np.zeros(5, dtype=QuadPrecDType())
9090
array([0.0, 0.0, 0.0, 0.0, 0.0], dtype=QuadPrecDType128)
91-
91+
9292
.. attribute:: backend
9393
:type: QuadBackend
94-
95-
The computation backend (SLEEF or LONGDOUBLE).
96-
94+
95+
The computation backend (``QuadBackend.SLEEF`` or ``QuadBackend.LONGDOUBLE``).
96+
9797
.. attribute:: itemsize
9898
:type: int
99-
100-
Size of each element in bytes (always 16).
101-
99+
100+
The size of each element in bytes (always 16).
101+
102102
.. attribute:: alignment
103103
:type: int
104-
105-
Memory alignment in bytes (always 16).
106-
104+
105+
The memory alignment in bytes (always 16).
106+
107107
.. attribute:: name
108108
:type: str
109-
110-
String name of the dtype (``"QuadPrecDType128"``).
109+
110+
The string name of the dtype (``"QuadPrecDType128"``).
111111
```
112112

113113
## QuadBackend
@@ -116,22 +116,22 @@ The fundamental types provided by NumPy QuadDType.
116116
.. class:: numpy_quaddtype.QuadBackend
117117
118118
Enumeration of available computation backends.
119-
119+
120120
.. attribute:: SLEEF
121121
:value: 0
122-
122+
123123
SLEEF library backend (default). Provides true IEEE 754 binary128
124124
quad precision with SIMD optimization.
125-
125+
126126
.. attribute:: LONGDOUBLE
127127
:value: 1
128-
129-
Platform's native long double backend. Precision varies by platform.
130-
128+
129+
The platform's native long double backend. The precision varies by platform.
130+
131131
**Example**
132-
132+
133133
::
134-
134+
135135
>>> from numpy_quaddtype import QuadPrecDType, QuadBackend
136136
>>> dtype = QuadPrecDType()
137137
>>> dtype.backend == QuadBackend.SLEEF
@@ -146,9 +146,9 @@ The fundamental types provided by NumPy QuadDType.
146146
.. function:: numpy_quaddtype.SleefQuadPrecision(value)
147147
148148
Create a QuadPrecision scalar using the SLEEF backend.
149-
149+
150150
Equivalent to ``QuadPrecision(value, backend="sleef")``.
151-
151+
152152
:param value: Value to convert to quad precision.
153153
:return: Quad precision scalar using SLEEF backend.
154154
:rtype: QuadPrecision
@@ -160,9 +160,9 @@ The fundamental types provided by NumPy QuadDType.
160160
.. function:: numpy_quaddtype.LongDoubleQuadPrecision(value)
161161
162162
Create a QuadPrecision scalar using the longdouble backend.
163-
163+
164164
Equivalent to ``QuadPrecision(value, backend="longdouble")``.
165-
165+
166166
:param value: Value to convert to quad precision.
167167
:return: Quad precision scalar using longdouble backend.
168168
:rtype: QuadPrecision
@@ -174,9 +174,9 @@ The fundamental types provided by NumPy QuadDType.
174174
.. function:: numpy_quaddtype.SleefQuadPrecDType()
175175
176176
Create a QuadPrecDType using the SLEEF backend.
177-
177+
178178
Equivalent to ``QuadPrecDType(backend="sleef")``.
179-
179+
180180
:return: Dtype for SLEEF-backed quad precision arrays.
181181
:rtype: QuadPrecDType
182182
```
@@ -187,9 +187,9 @@ The fundamental types provided by NumPy QuadDType.
187187
.. function:: numpy_quaddtype.LongDoubleQuadPrecDType()
188188
189189
Create a QuadPrecDType using the longdouble backend.
190-
190+
191191
Equivalent to ``QuadPrecDType(backend="longdouble")``.
192-
192+
193193
:return: Dtype for longdouble-backed quad precision arrays.
194194
:rtype: QuadPrecDType
195195
```

0 commit comments

Comments
 (0)