You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -9,21 +8,18 @@ For multiprecision numerical computing using values with 25..2,500 digits. With
9
8
10
9
This package uses the [Arb C Library](http://arblib.org/index.html), and adapts some C library interface work from [Nemo](https://github.com/wbhart/Nemo.jl) (see [_below_](https://github.com/JeffreySarnoff/ArbNumerics.jl/blob/master/README.md#acknowledgements)). Here is a presentation by the designer and architect of the [Arb C library](https://fredrikj.net/math/oxford2019.pdf).
ArbNumerics exports three types: `ArbFloat`, `ArbReal`, `ArbComplex`. `ArbFloat` is an extended precision floating point type. Math using `ArbFloat` is expected to be very near the veridical value, and often is the closest value for the precision in use. `ArbReal` is an interval-valued quantity formed of an `ArbFloat` (the midpoint) and a `radius`. Math functions with `ArbReal` are assured to enclose the veridical value. This assurance extends to multiple function applications. `ArbComplex` is an `ArbReal` pair (real, imaginary). The same enclosure assurance applies.
23
20
24
21
While the bounds of an `ArbReal` or `ArbComplex` are available, the default is to show these values as digit sequences which almost assuredly are accurate, in a round to nearest sense, to the precision displayed. Math with `ArbFloat` does not provide the assurance one gets using `ArbReal`, as an `ArbFloat` is a point value. While some effort has been taken to provide you with more reliable results from math with `ArbFloat` values than would be the case using the underlying library itself, `ArbReal` or `ArbComplex` are suggested for work that is important to you. `ArbFloat` is appropriate when exactness is not required during development, or with applications that are approximating something at increasing precisions.
25
22
26
-
27
23
## Installation
28
24
29
25
```julia
@@ -38,7 +34,7 @@ When updating ArbNumerics, do `pkg> gc` to prevent accruing a great deal of unus
38
34
## StartUp
39
35
40
36
`using ArbNumerics`
41
-
or, if you installed Readables,
37
+
or, if you installed Readables,
42
38
`using ArbNumerics, Readables`
43
39
44
40
## Precision
@@ -49,23 +45,23 @@ Otherwise, some extra bits are used to assist with printing values rounded to th
49
45
50
46
You can set the internal working precision (which is the same as the displayed precision with `setextrabits(0)`) to a given number of bits or a given number of decimal digits:
The type can be any of `ArbFloat`, `ArbReal`, `ArbComplex`. All types share the same precision so interconversion makes sense.
62
58
63
-
64
-
## Using ArbFloat
59
+
## Using ArbFloat
65
60
66
61
Reading the sections that follow gives you a good platform from which to develop.
67
62
68
63
- consider `using ArbNumerics, Readables`
64
+
69
65
```julia
70
66
julia>ArbFloat(pi, digits=30, base=10)
71
67
3.14159265358979323846264338328
@@ -82,7 +78,8 @@ Initially, the default precision is set to 106 bits. All ArbNumeric types use t
82
78
83
79
The precision in use may be set globally, as with BigFloats, or it may be given with the constructor. For most purposes, you should work with a type at one, two, or three precisions. It is helps clarity to convert precisions explicitly, however, it is not necessary.
julia> DIGITS ==length(string(ans)) -1# (-1 for the decimal point)
117
116
true
118
117
```
118
+
119
119
### changing precision
120
120
121
121
```julia
122
-
julia> a =ArbFloat(2, 25)
122
+
julia> a =ArbFloat(2, bits=25)
123
123
2.000000
124
-
julia> a =ArbFloat(a, 50)
125
-
2.00000000000000
126
-
127
-
julia> precision =25
128
-
julia> a =ArbFloat(2, precision)
129
-
2.000000
130
-
julia> precision =50
131
-
julia> a =ArbFloat(a, precision)
124
+
julia> a =ArbFloat(a, bits=50)
132
125
2.00000000000000
133
126
```
127
+
134
128
### interconversion
135
129
136
130
```julia
@@ -153,19 +147,19 @@ julia> Float16(c)
153
147
Float16(1.414)
154
148
```
155
149
156
-
----
150
+
-----
157
151
158
152
Consider using ArbReals instead of ArbFloats if you want your results to be rock solid. That way you can examine the enclosures for your results with `radius(value)` or `bounds(value)`. This is strongly suggested when working with precisions that you are increasing dynamically.
159
153
160
-
----
154
+
-----
161
155
162
156
### Math
163
157
164
158
#### arithmetic functions
165
159
166
160
-`+`,`-`, `*`, `/`
167
161
-`square`, `cube`, `sqrt`, `cbrt`, `hypot`
168
-
-`pow(x,i)`, `root(x,i)`_where i is an integer > 0_
162
+
-`pow(x,i)`, `root(x,i)`_where i is an integer > 0_
- The code is thread-safe, portable, and extensively tested. The library outperforms others.
302
297
303
-
304
298
## Acknowledgements
305
299
306
300
This work develops parts the Arb C library within Julia. It is entirely dependent on Arb by Fredrik Johansson and would not exist without the good work of William Hart, Tommy Hofmann and the Nemo.jl team. The libraries for `Arb` and `Flint`, and build file are theirs, used with permission.
307
301
308
-
----
302
+
-----
309
303
310
304
## Alternatives
311
305
312
306
For a numeric types like `Float64` and `ComplexF64` with about twice their precision, [Quadmath.jl](https://github.com/JuliaMath/Quadmath.jl) exports `Float128` and `ComplexF128`. For almost as much precision with better performance, [DoubleFloats.jl](https://github.com/JuliaMath/DoubleFloats.jl) exports `Double64` and `ComplexDF64`. ValidatedNumerics.jl and other packages available at [JuliaIntervals](https://github.com/JuliaIntervals) provide an alternative approach to developing correctly contained results. Those packages are very good and worthwhile when you do not require multiprecision numerics.
313
307
314
-
----
308
+
-----
309
+
315
310
## notes
316
311
317
312
- To propose internal changes, please use pull requests.
0 commit comments