# \#bigfloat

**URL:** https://discourse.julialang.org/tag/bigfloat/558.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [How to Efficiently Work with Floats Across a Wide Range of Precision?](https://discourse.julialang.org/t/how-to-efficiently-work-with-floats-across-a-wide-range-of-precision/123833)

<div class="topic-metadata">

**Author:** [@Hugin-Hilbert](https://discourse.julialang.org/u/Hugin-Hilbert)\
**Replies:** 4\
**Last updated:** [December 16, 2024, 10:11am UTC](https://discourse.julialang.org/t/how-to-efficiently-work-with-floats-across-a-wide-range-of-precision/123833 "2024-12-16T10:11:20Z")

</div>

I’m currently developing a divide and conquer algorithm in Julia that requires multiple precision arithmetic at different levels of the computation: Leaf Nodes: Operations are performed with approximately 256-bit preci…

---

## [Unexpected result from setprecision](https://discourse.julialang.org/t/unexpected-result-from-setprecision/89336)

<div class="topic-metadata">

**Author:** [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Replies:** 3\
**Last updated:** [October 18, 2024, 1:55am UTC](https://discourse.julialang.org/t/unexpected-result-from-setprecision/89336 "2024-10-18T01:55:09Z")

</div>

I expected the following to return 512, rather than 256. Could someone please explain why this is happening? julia\> setprecision(512) do thisbig = big"1.0" @show precision(thisbig) end prec…

---

## [Issue with DynamicPolynomials and BigFloat coefficients?](https://discourse.julialang.org/t/issue-with-dynamicpolynomials-and-bigfloat-coefficients/120814)

<div class="topic-metadata">

**Author:** [@chkat](https://discourse.julialang.org/u/chkat)\
**Replies:** 2\
**Last updated:** [October 3, 2024, 10:05am UTC](https://discourse.julialang.org/t/issue-with-dynamicpolynomials-and-bigfloat-coefficients/120814 "2024-10-03T10:05:56Z")

</div>

I am experiencing an issue with the latest version of DynamicPolynomials (0.6) when I evaluate a polynomial with BigFloat coefficients at another BigFloat. I isolated a simple example that shows that I get different resu…

---

## [Handling large values correctly](https://discourse.julialang.org/t/handling-large-values-correctly/117537)

<div class="topic-metadata">

**Author:** [@vh94](https://discourse.julialang.org/u/vh94)\
**Replies:** 4\
**Last updated:** [July 27, 2024, 9:27pm UTC](https://discourse.julialang.org/t/handling-large-values-correctly/117537 "2024-07-27T21:27:35Z")

</div>

I repeatedly run into issues handling large values (values beyond 1e+15), and couldn’t find a clear answer on how to address those. Consider following comparison: (1.0e+16 + 1 + 1 + 1) \> 1.0e+16 will wrongfully return…

---

## [Issue with BigFloat rounding](https://discourse.julialang.org/t/issue-with-bigfloat-rounding/116831)

<div class="topic-metadata">

**Author:** [@chkat](https://discourse.julialang.org/u/chkat)\
**Replies:** 14\
**Last updated:** [July 10, 2024, 3:09pm UTC](https://discourse.julialang.org/t/issue-with-bigfloat-rounding/116831 "2024-07-10T15:09:01Z")

</div>

I want to set the BigFloat(7.0687866210937500e-1) by using a precision of 15 bits and two different rounding modes (up and down). So I do: setprecision(15) setrounding(BigFloat, RoundDown) # or RoundUp BigFloat(7.0687…

---

## [BigFloat type](https://discourse.julialang.org/t/bigfloat-type/114782)

<div class="topic-metadata">

**Author:** [@Denis\_Dardenne](https://discourse.julialang.org/u/Denis_Dardenne)\
**Replies:** 3\
**Last updated:** [June 20, 2024, 1:09pm UTC](https://discourse.julialang.org/t/bigfloat-type/114782 "2024-06-20T13:09:11Z")

</div>

Hello, I have a variable of this type: and I would like tto ransform the format Float64 to BigFloat. How do that ? The following command doesn’t work : BigFloat.(MyVar) convert(BigFloat,MyVar) May be defining t…

---

## [Is there a library for a generic convolution function?](https://discourse.julialang.org/t/is-there-a-library-for-a-generic-convolution-function/110329)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 1\
**Last updated:** [February 17, 2024, 2:13am UTC](https://discourse.julialang.org/t/is-there-a-library-for-a-generic-convolution-function/110329 "2024-02-17T02:13:23Z")

</div>

I need to do a convolution of BigInts and DSP says that BigFloat isn’t supported when I try.

---

## [And Julia keeps amazing me: high precision computation](https://discourse.julialang.org/t/and-julia-keeps-amazing-me-high-precision-computation/107740)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 17\
**Last updated:** [December 19, 2023, 1:12am UTC](https://discourse.julialang.org/t/and-julia-keeps-amazing-me-high-precision-computation/107740 "2023-12-19T01:12:06Z")

</div>

Hi! This application is probably very common for some people, but it is the very first time I really needed high precision computation (BigInt and BigFloat). I am implementing an algorithm for designing frozen orbits i…

---

## [How to use BigFloats with ccall?](https://discourse.julialang.org/t/how-to-use-bigfloats-with-ccall/104895)

<div class="topic-metadata">

**Author:** [@Alseidon](https://discourse.julialang.org/u/Alseidon)\
**Replies:** 5\
**Last updated:** [October 12, 2023, 7:35pm UTC](https://discourse.julialang.org/t/how-to-use-bigfloats-with-ccall/104895 "2023-10-12T19:35:05Z")

</div>

I want to call a C library that uses MPFR in my Julia code. The issue is, I can’t make it work: if I manipulate a BigFloat declared in Julia within the C code, it becomes NaN. Here is an example: #include \<gmp.h\> #inclu…

---

## [Printing exact decimal representations](https://discourse.julialang.org/t/printing-exact-decimal-representations/103365)

<div class="topic-metadata">

**Author:** [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)\
**Replies:** 2\
**Last updated:** [August 30, 2023, 12:06pm UTC](https://discourse.julialang.org/t/printing-exact-decimal-representations/103365 "2023-08-30T12:06:36Z")

</div>

I don’t think there is, but it would be great if there was one.

---

## [Best way to get a vector of BigFloat values drawn from a uniform distribution](https://discourse.julialang.org/t/best-way-to-get-a-vector-of-bigfloat-values-drawn-from-a-uniform-distribution/97256)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 4\
**Last updated:** [April 9, 2023, 10:36am UTC](https://discourse.julialang.org/t/best-way-to-get-a-vector-of-bigfloat-values-drawn-from-a-uniform-distribution/97256 "2023-04-09T10:36:53Z")

</div>

Is there some better and simple way to implement this for BigFloat: function rand\_uniform(lo::F, hi::F, n::Signed) where {F \<: AbstractFloat} ret = Vector{F}(undef, n) dist = Distributions.Uniform(lo, hi) for i ∈ …

---

## [BigFloat type promotion != precision promotion](https://discourse.julialang.org/t/bigfloat-type-promotion-precision-promotion/91945)

<div class="topic-metadata">

**Author:** [@gvdeynde](https://discourse.julialang.org/u/gvdeynde)\
**Replies:** 16\
**Last updated:** [January 12, 2023, 6:11pm UTC](https://discourse.julialang.org/t/bigfloat-type-promotion-precision-promotion/91945 "2023-01-12T18:11:06Z")

</div>

Hi all I’m a bit confused on the rules of precision “promotion” using BigFloats. As far as I can see, there are none. See example below. From this, I can conclude that Type promotion is made (the result of an operatio…

---

## [Rounding BigFloat to 3 significant digits](https://discourse.julialang.org/t/rounding-bigfloat-to-3-significant-digits/91295)

<div class="topic-metadata">

**Author:** [@maxchendt](https://discourse.julialang.org/u/maxchendt)\
**Replies:** 9\
**Last updated:** [December 6, 2022, 7:22pm UTC](https://discourse.julialang.org/t/rounding-bigfloat-to-3-significant-digits/91295 "2022-12-06T19:22:49Z")

</div>

display(BigFloat(2)^-76) display(round(BigFloat(2)^-76, sigdigits=3)) display(round(convert(Float64, BigFloat(2)^-76), sigdigits=3)) shows that 1.32348898008484427979425390731194056570529937744140625e-23 1.319999999999…

---

## [Storing high precision constants to use with fixed precision libraries (DoubleFloats.jl, Quadmath.jl, DecFP.jl, etc.)](https://discourse.julialang.org/t/storing-high-precision-constants-to-use-with-fixed-precision-libraries-doublefloats-jl-quadmath-jl-decfp-jl-etc/90967)

<div class="topic-metadata">

**Author:** [@heltonmc](https://discourse.julialang.org/u/heltonmc)\
**Replies:** 3\
**Last updated:** [November 28, 2022, 9:55pm UTC](https://discourse.julialang.org/t/storing-high-precision-constants-to-use-with-fixed-precision-libraries-doublefloats-jl-quadmath-jl-decfp-jl-etc/90967 "2022-11-28T21:55:41Z")

</div>

I am hoping to design algorithms that can be used efficiently with other fixed higher precision libraries such as DoubleFloats.jl, Quadmath.jl, DecFP.jl, MultiFloats.jl, etc… This usually involves polynomial approximatio…

---

## [Function calculating in BigFloat/Float64](https://discourse.julialang.org/t/function-calculating-in-bigfloat-float64/90454)

<div class="topic-metadata">

**Author:** [@gvdeynde](https://discourse.julialang.org/u/gvdeynde)\
**Replies:** 4\
**Last updated:** [November 18, 2022, 9:11pm UTC](https://discourse.julialang.org/t/function-calculating-in-bigfloat-float64/90454 "2022-11-18T21:11:26Z")

</div>

Hi all What would be the Julian approach to writing a function that, depending on an Integer parameter (the precision) would calculate using either Float64 or BigFloat and return the result in Float64 or BigFloat accord…

---

## [Differentiable optimization / BigFloat - does DiffOpt.jl work with SDPAFamily.jl?](https://discourse.julialang.org/t/differentiable-optimization-bigfloat-does-diffopt-jl-work-with-sdpafamily-jl/89771)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 1\
**Last updated:** [November 4, 2022, 7:29pm UTC](https://discourse.julialang.org/t/differentiable-optimization-bigfloat-does-diffopt-jl-work-with-sdpafamily-jl/89771 "2022-11-04T19:29:22Z")

</div>

I’m interested in solving semidefinite optimization problems and compute the derivatives of the solutions w.r.t. input parameters. BigFloat may be needed for some of the more demanding problems. Does the differentiable o…

---

## [Semidefinite programming with BigFloat](https://discourse.julialang.org/t/semidefinite-programming-with-bigfloat/88513)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 1\
**Last updated:** [October 10, 2022, 11:09pm UTC](https://discourse.julialang.org/t/semidefinite-programming-with-bigfloat/88513 "2022-10-10T23:09:52Z")

</div>

I’m looking at the package SDPAFamily.jl which provides access to arbitrary-precision semidefinite programming solvers. The README says that the JuMP interface does not support BigFloat. Is it still possible to somehow u…

---

## [BigFloat converted to string returns different number?](https://discourse.julialang.org/t/bigfloat-converted-to-string-returns-different-number/86473)

<div class="topic-metadata">

**Author:** [@HelloThere](https://discourse.julialang.org/u/HelloThere)\
**Replies:** 8\
**Last updated:** [August 28, 2022, 11:20pm UTC](https://discourse.julialang.org/t/bigfloat-converted-to-string-returns-different-number/86473 "2022-08-28T23:20:47Z")

</div>

Hi, I am new to Julia and in the documentation I came across this: julia\> big"1.23456789012345678901" 1.234567890123456789010000000000000000000000000000000000000000000000000000000004 At first I thought that this is so…

---

## [Representing very big numbers](https://discourse.julialang.org/t/representing-very-big-numbers/84589)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 17\
**Last updated:** [July 23, 2022, 10:30pm UTC](https://discourse.julialang.org/t/representing-very-big-numbers/84589 "2022-07-23T22:30:40Z")

</div>

How can I perform arithmetic on numbers on the order of a googloplex i.e. 10^(10^100)? I don’t have enough memory to express them exactly as integers with all their digits, but I’d like to be able to represent them as B…

---

## [Higher precision leads to incorrect results?](https://discourse.julialang.org/t/higher-precision-leads-to-incorrect-results/75248)

<div class="topic-metadata">

**Author:** [@chrisoffner](https://discourse.julialang.org/u/chrisoffner)\
**Replies:** 19\
**Last updated:** [January 28, 2022, 7:32pm UTC](https://discourse.julialang.org/t/higher-precision-leads-to-incorrect-results/75248 "2022-01-28T19:32:55Z")

</div>

I’m working through Arthur & Vassilvitskii’s \\Omega(n^2) lower bound proof for the iterative closest point (ICP) algorithm in \\mathbb{R} (Theorem 3.4 in the paper) and thought it’d be neat to visualize their construction…

---

## [Promotion to BigFloat -- no zero padding](https://discourse.julialang.org/t/promotion-to-bigfloat-no-zero-padding/66042)

<div class="topic-metadata">

**Author:** [@LolianSh](https://discourse.julialang.org/u/LolianSh)\
**Replies:** 8\
**Last updated:** [August 9, 2021, 12:47am UTC](https://discourse.julialang.org/t/promotion-to-bigfloat-no-zero-padding/66042 "2021-08-09T00:47:44Z")

</div>

Hi, I am encountering some problems when promoting Float64 to a BigFloat, specifically the fact that I do not get a zero padding beyond the Float64 precision. For example I have the following: julia\> BigFloat(0.01) 0.…

---

## [Is \`BigFloat\` loss of precision intended?](https://discourse.julialang.org/t/is-bigfloat-loss-of-precision-intended/61728)

<div class="topic-metadata">

**Author:** [@MarcMush](https://discourse.julialang.org/u/MarcMush)\
**Replies:** 5\
**Last updated:** [May 24, 2021, 7:03pm UTC](https://discourse.julialang.org/t/is-bigfloat-loss-of-precision-intended/61728 "2021-05-24T19:03:06Z")

</div>

when doing any operation on a BigFloat, the precision of the result always reverts back to the default one, instead of getting it from the operands. Is this behavior intended and if yes, why ? julia\> a=BigFloat("1.1", …

---

## [Why is big(0.5) printed as 0.50?](https://discourse.julialang.org/t/why-is-big-0-5-printed-as-0-50/59395)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 6\
**Last updated:** [April 17, 2021, 5:06pm UTC](https://discourse.julialang.org/t/why-is-big-0-5-printed-as-0-50/59395 "2021-04-17T17:06:04Z")

</div>

I’m not sure if this is the intended behavior: julia\> 0.5 0.5 julia\> big(0.5) 0.50 julia\> big(0.5) == 0.5 true Why the extra 0 at the end for a BigFloat?

---

## [Sparse vectors and BigFloat Heisenbug](https://discourse.julialang.org/t/sparse-vectors-and-bigfloat-heisenbug/54707)

<div class="topic-metadata">

**Author:** [@mbesancon](https://discourse.julialang.org/u/mbesancon)\
**Replies:** 4\
**Last updated:** [February 6, 2021, 10:14am UTC](https://discourse.julialang.org/t/sparse-vectors-and-bigfloat-heisenbug/54707 "2021-02-06T10:14:28Z")

</div>

I have in some weird side effect with structs of sparse vectors of BigFloats, where operating on a copy of the sum seems to change the struct itself. In spirit, the structure of the code looks like below. After a copyin…

---

## [Promote big duals in ForwardDiff](https://discourse.julialang.org/t/promote-big-duals-in-forwarddiff/53126)

<div class="topic-metadata">

**Author:** [@xzackli](https://discourse.julialang.org/u/xzackli)\
**Replies:** 0\
**Last updated:** [January 10, 2021, 10:30pm UTC](https://discourse.julialang.org/t/promote-big-duals-in-forwarddiff/53126 "2021-01-10T22:30:31Z")

</div>

I’m computing some derivatives of functions where the interior temporarily enters the realm of BigFloat, using ForwardDiff g(x) = float(log(exp(x\*1e6))) ForwardDiff.derivative(g, 1.0) NaN In this example, the exponent…
