Do you mean independent for the purposes of editing, or just specifically
for the equality operators?
copy and deepcopy both work for editing purposes:
~~~
julia a=with_bigfloat_precision(()-BigFloat(0.1),64)
1.0001e-01 with 64 bits of precision
julia z=copy(a)
1.0001e-01 with 64 bits of precision
julia z += 2
2.100013552527156068805425093160010874271392822265625e+00
with 256 bits of precision
julia a
1.0001e-01 with 64 bits of precision
julia z
2.100013552527156068805425093160010874271392822265625e+00
with 256 bits of precision
julia z=deepcopy(a)
1.0001e-01 with 64 bits of precision
julia z += 2
2.100013552527156068805425093160010874271392822265625e+00
with 256 bits of precision
julia a
1.0001e-01 with 64 bits of precision
~~~
I believe that BigFloats, like other numeric values types, are immutable.
This means that you can't tell the difference between instances of the same
value using `==` or even `===`. Every time there is a change a or z, it
acts as if it is just changing the binding to point to a new BigFloat [vs.
modifying the current value]. (I am not sure of the specific implementation
details of BigFloat at this time.)
On Sat, Sep 13, 2014 at 6:56 PM, Rick Graham rickhg1...@gmail.com wrote:
Might be a silly question, but how do you copy a BigFloat so that it is
independent of the original?
julia a=with_bigfloat_precision(()-BigFloat(0.1),64)
1.0001e-01 with 64 bits of precision
julia z=copy(a)
1.0001e-01 with 64 bits of precision
julia a.d==z.d
true
julia z=deepcopy(a)
1.0001e-01 with 64 bits of precision
julia a.d==z.d
true