# \#numbers

**URL:** https://discourse.julialang.org/tag/numbers/75.md

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

---

## [Hemiplex numbers and factoring symmetric indefinite matrices](https://discourse.julialang.org/t/hemiplex-numbers-and-factoring-symmetric-indefinite-matrices/138501)

<div class="topic-metadata">

**Author:** [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Replies:** 3\
**Last updated:** [July 29, 2026, 1:01pm UTC](https://discourse.julialang.org/t/hemiplex-numbers-and-factoring-symmetric-indefinite-matrices/138501 "2026-07-29T13:01:18Z")

</div>

I’m pleased to announce the release of two new numeric packages, HemiplexNumbers and HemiplexFactorizations, and their accompanying manuscript Jordan algebras, hemiplex numbers, and the Cholesky decomposition of arbitrar…

---

## [Parse with exponent D](https://discourse.julialang.org/t/parse-with-exponent-d/133715)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 4\
**Last updated:** [November 7, 2025, 1:24pm UTC](https://discourse.julialang.org/t/parse-with-exponent-d/133715 "2025-11-07T13:24:04Z")

</div>

I tried parsing the values printed to file by some old Fortran code. This code uses the exponent D for double precision numbers, like 2.73150000000000003D+02. I can use the replace command to replace the “D” with “E”, …

---

## [How would I view/use Number Base from 2 to 256](https://discourse.julialang.org/t/how-would-i-view-use-number-base-from-2-to-256/129412)

<div class="topic-metadata">

**Author:** [@two\_four\_six](https://discourse.julialang.org/u/two_four_six)\
**Replies:** 4\
**Last updated:** [July 13, 2025, 10:47am UTC](https://discourse.julialang.org/t/how-would-i-view-use-number-base-from-2-to-256/129412 "2025-07-13T10:47:14Z")

</div>

Data at rest is binary. When I read a file, it is presented in an output, like print() in hex. Julia converts the binary state of the file and outputs the hex info. This isn’t the behavior I need. I would like to take …

---

## [Round a float, and force a specific number of decimal places](https://discourse.julialang.org/t/round-a-float-and-force-a-specific-number-of-decimal-places/87547)

<div class="topic-metadata">

**Author:** [@Nash](https://discourse.julialang.org/u/Nash)\
**Replies:** 8\
**Last updated:** [May 2, 2025, 8:28pm UTC](https://discourse.julialang.org/t/round-a-float-and-force-a-specific-number-of-decimal-places/87547 "2025-05-02T20:28:23Z")

</div>

Rounding a float to two decimal places, say, does not necessarily create a number with two decimal places. For example round(10.001, digits = 2) produces 10.0 How can I force a specific number of shown decimal places? …

---

## [InexactError vs OverflowError](https://discourse.julialang.org/t/inexacterror-vs-overflowerror/127108)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 3\
**Last updated:** [March 18, 2025, 7:05pm UTC](https://discourse.julialang.org/t/inexacterror-vs-overflowerror/127108 "2025-03-18T19:05:55Z")

</div>

I have a number type which throws when the result of a binary operation like + or \* is not representable in this type. I think InexactError is the right choice of exception, while OverflowError seems like a bad choice be…

---

## [Convert vector of binaries to decimal and/or hex](https://discourse.julialang.org/t/convert-vector-of-binaries-to-decimal-and-or-hex/124974)

<div class="topic-metadata">

**Author:** [@stefaniecg](https://discourse.julialang.org/u/stefaniecg)\
**Replies:** 4\
**Last updated:** [January 20, 2025, 4:15pm UTC](https://discourse.julialang.org/t/convert-vector-of-binaries-to-decimal-and-or-hex/124974 "2025-01-20T16:15:43Z")

</div>

I want to convert a binary string to decimal. This converst one item of the array to an int value: bit\_vector = digits(0x0284, base=2, pad=16) convert(Int,bit\_vector\[1\]) but i want something like this, but it does not…

---

## [How to read a line character by character?](https://discourse.julialang.org/t/how-to-read-a-line-character-by-character/122734)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 15\
**Last updated:** [November 19, 2024, 11:53am UTC](https://discourse.julialang.org/t/how-to-read-a-line-character-by-character/122734 "2024-11-19T11:53:02Z")

</div>

Hello, I have a file as follows: 1 2 3 4 5 6 7 8 9 10 I want to calculate the sum of the above numbers. With a command like below I read a whole line and not individual numbers: inn = open("input.txt", "r") inp = rea…

---

## [Checking divisibility efficiently](https://discourse.julialang.org/t/checking-divisibility-efficiently/121418)

<div class="topic-metadata">

**Author:** [@barucden](https://discourse.julialang.org/u/barucden)\
**Replies:** 6\
**Last updated:** [October 17, 2024, 12:47pm UTC](https://discourse.julialang.org/t/checking-divisibility-efficiently/121418 "2024-10-17T12:47:04Z")

</div>

Is there a function in Base like isdivisible(m::Integer, n::Integer) that returns true if m is divisible by n? A straightforward implementation would be isdivisible(m, n) = iszero(m % n) Modulo works just fine for Ints…

---

## [Differing construction and conversion for subtypes of Number](https://discourse.julialang.org/t/differing-construction-and-conversion-for-subtypes-of-number/119886)

<div class="topic-metadata">

**Author:** [@brainandforce](https://discourse.julialang.org/u/brainandforce)\
**Replies:** 0\
**Last updated:** [September 26, 2024, 12:18am UTC](https://discourse.julialang.org/t/differing-construction-and-conversion-for-subtypes-of-number/119886 "2024-09-26T00:18:48Z")

</div>

After reading a few threads here, I’ve come to understand that for subtypes of Number, construction and conversion should have nearly identical behavior (with one exception: it is expected that construction always return…

---

## [Decimal2rational](https://discourse.julialang.org/t/decimal2rational/117147)

<div class="topic-metadata">

**Author:** [@mefi](https://discourse.julialang.org/u/mefi)\
**Replies:** 7\
**Last updated:** [July 18, 2024, 8:42am UTC](https://discourse.julialang.org/t/decimal2rational/117147 "2024-07-18T08:42:29Z")

</div>

Is there an easy way to convert a periodic decimal number into a fraction? As a mathematician I like not rationalize(0.85555555555)!! That really leaves a homemade algorithm that handles the periodic part separately? t…

---

## [Displaying numbers in Julia](https://discourse.julialang.org/t/displaying-numbers-in-julia/112807)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 15\
**Last updated:** [April 11, 2024, 11:04pm UTC](https://discourse.julialang.org/t/displaying-numbers-in-julia/112807 "2024-04-11T23:04:27Z")

</div>

I want to make a very simple calculation: julia\> 6500 \* ( (1.10)^58 ) 1.6356451710902702e6 But, the format I’m hoping to for is 1,635,645.17 or 1635645.17. I spent 10 minutes searching the internet & Julia built in h…

---

## [Custom Complex number type for specific Real type](https://discourse.julialang.org/t/custom-complex-number-type-for-specific-real-type/109374)

<div class="topic-metadata">

**Author:** [@mattsignorelli](https://discourse.julialang.org/u/mattsignorelli)\
**Replies:** 9\
**Last updated:** [January 30, 2024, 12:40am UTC](https://discourse.julialang.org/t/custom-complex-number-type-for-specific-real-type/109374 "2024-01-30T00:40:26Z")

</div>

Hello! I have implemented a Julia interface to a C library for a special number type. The real and complex types are handled internally by the C library, so I have Julia wrapper structs that are basically MyNumber and Co…

---

## [@Printf with DecFP / Dec128](https://discourse.julialang.org/t/printf-with-decfp-dec128/108996)

<div class="topic-metadata">

**Author:** [@JonT](https://discourse.julialang.org/u/JonT)\
**Replies:** 2\
**Last updated:** [January 19, 2024, 10:08pm UTC](https://discourse.julialang.org/t/printf-with-decfp-dec128/108996 "2024-01-19T22:08:42Z")

</div>

I’m seeing two different outputs for Dec128 numbers println() vs @printf: (Julia v1.10.0 with DecFP v1.3.2) using Printf, Quadmath, DecFP C = log2(big(ℯ)) # \\euler \<tab\> to get symbol d = convert(Dec128, C) println("C …

---

## [Decimal commas instead of points](https://discourse.julialang.org/t/decimal-commas-instead-of-points/67446)

<div class="topic-metadata">

**Author:** [@danilo-bc](https://discourse.julialang.org/u/danilo-bc)\
**Replies:** 7\
**Last updated:** [January 7, 2024, 9:05pm UTC](https://discourse.julialang.org/t/decimal-commas-instead-of-points/67446 "2024-01-07T21:05:33Z")

</div>

Does Julia provide a simple way to use decimal commas instead of the standard point? Some countries use that standard and working with local data is sometimes a hassle. For example, importing spreadsheets with percentag…

---

## [\[ANN\] RepeatingDecimalNotations.jl](https://discourse.julialang.org/t/ann-repeatingdecimalnotations-jl/108011)

<div class="topic-metadata">

**Author:** [@hyrodium](https://discourse.julialang.org/u/hyrodium)\
**Replies:** 1\
**Last updated:** [January 6, 2024, 6:54am UTC](https://discourse.julialang.org/t/ann-repeatingdecimalnotations-jl/108011 "2024-01-06T06:54:35Z")

</div>

Hi all, I’m pleased to announce my package RepeatingDecimalNotations.jl (repo, docs). This package has some operations with repeating decimals. Define rational number with string macro like rd"123.4(56)". Convert R…

---

## [Why is there a discrepancy in the value of sqrt(2) from Wolfram Alpha and Julia?](https://discourse.julialang.org/t/why-is-there-a-discrepancy-in-the-value-of-sqrt-2-from-wolfram-alpha-and-julia/107461)

<div class="topic-metadata">

**Author:** [@chandra](https://discourse.julialang.org/u/chandra)\
**Replies:** 5\
**Last updated:** [December 11, 2023, 11:55pm UTC](https://discourse.julialang.org/t/why-is-there-a-discrepancy-in-the-value-of-sqrt-2-from-wolfram-alpha-and-julia/107461 "2023-12-11T23:55:14Z")

</div>

On the Wolfram Alpha website, I get this approximation for sqrt(2) 1.4142135623730950488016887242096980785696718753769480731766797379... With the Julia REPL, I get sqrt(2) 1.4142135623730951 and convert(BigFloat, sq…

---

## [Type for large "float like" integers?](https://discourse.julialang.org/t/type-for-large-float-like-integers/107454)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 8\
**Last updated:** [December 11, 2023, 5:32pm UTC](https://discourse.julialang.org/t/type-for-large-float-like-integers/107454 "2023-12-11T17:32:34Z")

</div>

Out of curiosity, is there a provided primitive type to represent a very large integer number with a fixed precision (e.g. 64), for example for an integer like 4.35e435 ? Obviously the information about this monster num…

---

## [Convert floating point to integer type?](https://discourse.julialang.org/t/convert-floating-point-to-integer-type/103273)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 6\
**Last updated:** [August 28, 2023, 12:34pm UTC](https://discourse.julialang.org/t/convert-floating-point-to-integer-type/103273 "2023-08-28T12:34:06Z")

</div>

Currently, the float function allows one to go from an Integer type to a floating-point type. julia\> float(BigInt) BigFloat Is there a function to go the other way, that is given BigFloat as an argument, it returns Big…

---

## [Overview of different number representations, philosophies and use cases](https://discourse.julialang.org/t/overview-of-different-number-representations-philosophies-and-use-cases/102910)

<div class="topic-metadata">

**Author:** [@i9e1](https://discourse.julialang.org/u/i9e1)\
**Replies:** 6\
**Last updated:** [August 18, 2023, 8:18am UTC](https://discourse.julialang.org/t/overview-of-different-number-representations-philosophies-and-use-cases/102910 "2023-08-18T08:18:04Z")

</div>

Hello, there is some activity to implement different number formats other than Rational and float. All approaches known to me so far try to tackle a fundamental tradeoff: We want our calculations to be fast and accurat…

---

## [Performance / Memory differences between constructors of BigInts](https://discourse.julialang.org/t/performance-memory-differences-between-constructors-of-bigints/102863)

<div class="topic-metadata">

**Author:** [@maxasauruswall](https://discourse.julialang.org/u/maxasauruswall)\
**Replies:** 5\
**Last updated:** [August 16, 2023, 4:07pm UTC](https://discourse.julialang.org/t/performance-memory-differences-between-constructors-of-bigints/102863 "2023-08-16T16:07:11Z")

</div>

Hi all, I’m playing around with arbitrary precision integers in a jupyter notebook (Macbook air, Julia v1.10.0-beta1). I noticed a difference between two constructors of BigInts: @btime BigInt(1234567890) # 45.294 ns…

---

## [\[Blog Post\] A Fun Exploration of Perfect, Abundant, and Deficient Numbers](https://discourse.julialang.org/t/blog-post-a-fun-exploration-of-perfect-abundant-and-deficient-numbers/99168)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 5\
**Last updated:** [May 23, 2023, 3:17am UTC](https://discourse.julialang.org/t/blog-post-a-fun-exploration-of-perfect-abundant-and-deficient-numbers/99168 "2023-05-23T03:17:58Z")

</div>

Hey folks, I recently wrote a blog post with a very small computational treatment of exploring abundant, deficient, and perfect numbers (the latter only briefly) alongside aliquot sequences. This was my first foray into…

---

## [How to convert a number to an hexadecimal \`bitstring\`?](https://discourse.julialang.org/t/how-to-convert-a-number-to-an-hexadecimal-bitstring/98673)

<div class="topic-metadata">

**Author:** [@tokujin](https://discourse.julialang.org/u/tokujin)\
**Replies:** 3\
**Last updated:** [May 11, 2023, 11:27am UTC](https://discourse.julialang.org/t/how-to-convert-a-number-to-an-hexadecimal-bitstring/98673 "2023-05-11T11:27:11Z")

</div>

I can do string(parse(Int, bitstring(x), base=2), base=16) to convert bitstring(x) to an hexadecimal string, but is there another way, one which is simpler and doesn’t trim the leading zeros off of integers?

---

## [Convert Vectors of Numbers and Bases to Two-Dimensional Matrix of Strings](https://discourse.julialang.org/t/convert-vectors-of-numbers-and-bases-to-two-dimensional-matrix-of-strings/97520)

<div class="topic-metadata">

**Author:** [@Cougar](https://discourse.julialang.org/u/Cougar)\
**Replies:** 9\
**Last updated:** [April 16, 2023, 2:39pm UTC](https://discourse.julialang.org/t/convert-vectors-of-numbers-and-bases-to-two-dimensional-matrix-of-strings/97520 "2023-04-16T14:39:40Z")

</div>

Given two Vector{Int64} n and b shown below, I’m looking for a succinct and efficient way to build the 3×3 Matrix{String} described … top row is binary, octal, hexadecimal expansions of 321. middle row is binary, oct…

---

## [Displaying Rationals](https://discourse.julialang.org/t/displaying-rationals/9475)

<div class="topic-metadata">

**Author:** [@Jean\_Michel](https://discourse.julialang.org/u/Jean_Michel)\
**Replies:** 32\
**Last updated:** [March 20, 2023, 9:44am UTC](https://discourse.julialang.org/t/displaying-rationals/9475 "2023-03-20T09:44:10Z")

</div>

I have a small complaint about julia. I use all the time matrices of Rationals, like \> 10×10 Array{Rational{Int64},2}: \> 2//1 0//1 0//1 0//1 0//1 0//1 0//1 0//1 0//1 0//1 \> 0//1 2//1 0//1 0//1 0/…

---

## [Isusefulnumber()](https://discourse.julialang.org/t/isusefulnumber/93795)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 2\
**Last updated:** [January 30, 2023, 10:24pm UTC](https://discourse.julialang.org/t/isusefulnumber/93795 "2023-01-30T22:24:45Z")

</div>

Is there a function available to check in a large vector, if one of the following occurs in a vector: missing nothing Inf NaN ? Here is my snippet to investigate a vector for such elements: a = \[1.3, NaN, Inf, missi…

---

## [Strange behavior of mod with float](https://discourse.julialang.org/t/strange-behavior-of-mod-with-float/93536)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 3\
**Last updated:** [January 25, 2023, 10:52pm UTC](https://discourse.julialang.org/t/strange-behavior-of-mod-with-float/93536 "2023-01-25T22:52:12Z")

</div>

Hello, What is the best way to determine if a float number b is an integer multiple of another float number a, (i.e. b = k a with k an integer)? I wanted to use the following test abs(mod(b, a))\<1e-12, but I am confuse…

---

## [Get the decimal part of a number](https://discourse.julialang.org/t/get-the-decimal-part-of-a-number/78282)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 7\
**Last updated:** [January 15, 2023, 2:14am UTC](https://discourse.julialang.org/t/get-the-decimal-part-of-a-number/78282 "2023-01-15T02:14:07Z")

</div>

Is there a function in Base Julia to get the decimal part of a number? I feel like I’ve seen that function before, but now I can’t find it. For example, I would like the following: julia\> x = 12.345; julia\> foo(x) 0.34…

---

## [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…

---

## [Indexing a number](https://discourse.julialang.org/t/indexing-a-number/88735)

<div class="topic-metadata">

**Author:** [@Woodmouth](https://discourse.julialang.org/u/Woodmouth)\
**Replies:** 13\
**Last updated:** [October 14, 2022, 9:08pm UTC](https://discourse.julialang.org/t/indexing-a-number/88735 "2022-10-14T21:08:27Z")

</div>

If a number is generally treated as a list, \> 1\[1\] 1 \> 1\[2\] BoundsError \>length(1) 1 and so on, how come 1\[:\] gives an error? I would have expected the result to be the same as \[1\]\[:\]. I think this should be included…

---

## [Looking for ONE package, to do BASIC number formatting for console-text-output](https://discourse.julialang.org/t/looking-for-one-package-to-do-basic-number-formatting-for-console-text-output/88655)

<div class="topic-metadata">

**Author:** [@fins](https://discourse.julialang.org/u/fins)\
**Replies:** 21\
**Last updated:** [October 14, 2022, 12:08pm UTC](https://discourse.julialang.org/t/looking-for-one-package-to-do-basic-number-formatting-for-console-text-output/88655 "2022-10-14T12:08:42Z")

</div>

Hi, I’ve recently explored a lot of packages to get more of an idea, of what kind of functionality is being covered in the julia-ecosystem, as it applies to my needs. While there are some very nice and powerful package…

[Next page](https://discourse.julialang.org/tag/numbers/75.md?match_all_tags=true&page=1&tags%5B%5D=numbers)
