A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

# Questions tagged [number-representation]

Questions about interpretation of numeric input or how Mathematica stores and manipulates numbers internally.

144 questions
Filter by
Sorted by
Tagged with
3k views

### When can I assume that all decimal digits returned by Mathematica are provably correct?

How to Control the Precision and Accuracy of Numerical Results Arbitrary-Precision Numbers Mathematica works with exact numbers and with two different types of approximate numbers: machine-...
40k views

### Entering numbers in Scientific Notation?

I need to play with a lot of powers such as 10^-3. 1E-3 does not work for it. Is there any short form for it?
3k views

### Formatting a fraction as a mixed number

Is there a command that will take a rational number and rewrite it in a mixed-number-like form? That is, I'd like to apply a command to something like 10/7 and get ...
2k views

### Real Numbers in the Wolfram Language

Epilog: Much of the discussion in the answers below revolves around the distinction between Real as a data type and real numbers as a domain or class of numbers (irrespective of the form in which ...
2k views

### Is this the most efficient way to round approximate integers to integers while leaving other Reals untouched?

This might seem like an overly simple question, but I need to specify custom plot tick marks as integers (no trailing decimal point) if they are approximately integers, but not if they are not. Using <...
4k views

### How to implement Donald Knuth's up-arrow notation

How does one enter very large numbers in up-arrow notation? Up-arrow notation was created by Donald Knuth to write very large numbers in it iterated exponentiation form, for example 6↑↑3 = 6^6^6.
2k views

### Number format in Legend Labels

I would like to use the usual (new and nice) BarLegend[] with something like BarLegend[{"LakeColors", 1/10000 {-2, 2}}] which ...
420 views

### Tidy form of numbers with errors using ScientificForm

Say I've computed something and got a number 0.02112398 with a computed error: 0.000331 Formatting it with ScientificForm[0.02112398 \[PlusMinus] 0.000331] gives me:...
759 views

### Does Mathematica have an equivalent of Python's float.as_integer_ratio?

The Python programming language has a float.as_integer_ratio(x) function which exactly converts an IEEE 754 floating-point number into a numerator/denominator pair ...
678 views

### Understanding simple numerical calculation

I am trying to understand why N[0.1]//FullForm returns 0.1' (A). Indeed, $0.1$ in base two is $0.000110011001100110011...$. If I ...
1k views

### Expression of uncertainty in measurement.

I have a problem with writing a Mathematica function. I have been requested to show the results of my experiments with the measurement uncertainty (mu) like below: ...
4k views

### How do I get Mathematica to show a number in non-exponential form? [duplicate]

Sometimes I make a calculation in Mathematica that produces a big number, which Mathematica shows like so: -1.52522*10^7 This is annoying to me, because I want ...
408 views

### How to copy formatted numbers as MathML without quotation marks?

I have the following code: a = 6.08717*10^6; b = a/3; c = a*1.5; d = a^2; matrix={{a, b, c, d},{b, c, d, a},{c, d, a, b},{d, a, b, c}}; matrix // EngineeringForm ...
4k views

### Convert a string to hex number?

How can I convert a string containing a hex number such as "6b" to a hex digit that mathematica can use to do math with? I have tried using ...
451 views

### How to format a number with an error?

I'm having a surprising amount of difficulty in trying to format some numbers with errors. I can't find any previous attempts to do this here or elsewhere and it would surely be of use to the ...
1k views

### Mod[1.2, 0.2] is not equal to zero

Why doesn't the following expression evaluate to zero? In:=Mod[1.2, 0.2] Out=0.2 Edit: This is what I wanted to do: ...
2k views

### Test if number represents an integer

I can't figure out how to test if a number is an integer. I have found IntegerQ, but this function only checks if the type of the input is an integer, not whether ...
502 views

### Machine Epsilon

I'm trying to evaluate the machine epsilon of my computer (see below). I wrote this: ...
323 views

### Is it possible to lower the bitwidth of (floating point) numbers?

The answer to this question will most probably be a definite no. Nevertheless, I would like to know whether it is possible to represent reals in the memory on less than the standard 32 or 64 bits (...
3k views

### How to plot logarithmic scales

How can a simple logarithmic number line be drawn between any 2 integer values? The closest function I found in the documentation is LogLinearPlot[] and I've been ...
477 views

### How to write an array of repeated numbers as a single number

Let's say we have a random number consisting of an arbitrary number of digits, such as for example 3097. This number can be represented as an array of repeated numbers with Mathematica by typing <...
189 views

### Arbitrary-Precision Arithmetic behaves unexpectedly

I want to understand how small numerical errors propagate through a computation and may drastically change the final result. To this end, I consider a toy world in which every number is limited to ...
446 views

### Scientific notation for exact numbers?

Some of my symbolic computations involve many large numbers, e.g.: 37894580188800000000000000000000000000000000000000 As the computation is symbolic, I'd like to leave the numbers in exact form, ...
904 views

### Enter exact rational numbers easily with decimal notation

Is there a simple way to enter decimal numbers such as 0.123 so that Mathematica interprets it as an exact rational number 123/1000?
146 views

### Problem to import numbers longer than 19-digit with “JSON” or “RawJSON”

Bug introduced in 11.0.1 or earlier and fixed in 12.0. MMA 11.0.1.0 (Windows 10, 64-bit) I see that "JSON" import can be buggy (154245), so my question is simple: can the following behaviour be ...
2k views

### How to get exact Rationalize of a decimal number?

This is on Mathematica 11.1 on Windows 7. I have this value 0.97646105481464028 which I'd like to get exact rational for it. I have thought that every terminating ...
225 views

### Join decimal part

I have a list of mesures that each vector is like {0,1,-2,259} but it should be like {0.1,-2.259} So I did a rule, like ...
761 views

### Fast Karatsuba Squaring, how to?

I want to improve timing of squaring for big numbers. So I asked What is the fastest way to split a number into parts and What is the most efficient way to add zeros to end of a number with several ...
3k views

### Converting numbers to integers

I've read the available documentation but I still haven't found an NumberForm -> Integer function yet. No result in this site's search, either. Does it exist? ...
144 views

### Why 2^^1*^k does not work?

Table[2^^1*^k,{k,0,10}] This gives an error, why is that? Also this BaseForm[2 ** 1*^ #, 16] & /@ Range What is ...
282 views

### Calculations after NumberForm [duplicate]

As specified in documentation center the functions AccountingForm, NumberForm, etc. are useful only to display numbers in ...
755 views

### Customizing decimal mark used in plot frame tick labels

I am using the Plot function in a usual way. I use Mathematica 9.0.1.0 in English (I do not know if it is available in other languages, but I do not mind), and as a ...
264 views

### How to format natural numbers so that they are 2 digits long?

I want to format all numbers from 1 to 50 so that they are all 2 digits long. desiredOutput={01,02,...,49,50} Digging through the documentation the ...
515 views

### Is there a command that does exact numerical conversion of non-exact to exact numbers?

I generally prefer to do all my intermediate calculations with exact numbers, and then round my result at the end. Thus I will typically convert each arbitrary-precision number to its exact equivalent;...
852 views

### What is the FullForm of 36^^sadjh.87s567*^-34?

The Mathematica parser parses and computes number literals before sending them to FullForm even if Hold is applied. Thus the ...
261 views

### How can I improve NumberString?

I would like to test strings to see if they represent numbers. This should include number representations with precision marks and scientific notation. NumberString ...
8k views

### Convert Integer to Real [duplicate]

Is there a preferred way of converting an Integer to a Real? What I'm using at the moment is ...
184 views

### Dynamically updated AccountingForm

Bug introduced in 10.4 or earlier and persisting through 11.1.1 CASE:3918306 confirmed I freshly installed Wolfram Mathematica. I can't quite remember how to output a dynamically updated variable ...
166 views

### Showing AlgebraicNumber[1/2 (1 + Sqrt), {-3, 2}] in human-readable way

Is there a function to show algebraic numbers in Mathematica more conveniently? I am looking for something similar to MatrixForm for matrices. For example, I would like to view ...
133 views

### Early vs. late application of arbitrary precision

The following arbitrary-precision computations, in which arbitrary precision is applied early (to the inputs), both work as expected: ...
234 views

### Display All Output Numbers in HEX

How might I modify Mathematica such that I can get the following functionality when working with HEX values. The odd lines are input and the even output. Red values should be the HEX values. What ...
282 views

### NMinimize seems to call function with the same values multiple times

I have to minimize a function where the evaluation of one parameter set takes very long (around 5sec) and discovered alongside, that NMinimize seems to call this ...
208 views

### Convert decimal value to hexadecimal

How can I convert for example 62343 to a hexadecimal value 45 to a hexadecimal value ? I see I can use: IntegerDigits[62343, 16] = {15, 3, 8, 7} ...
252 views

### How to convert list of digits to number? [closed]

I have a list such as: a = {1, 2, 4, 3}; and I want to get the 'number' of the list. For this example, I want to get this number: ...
430 views

### Representation of Rational Numbers

Following up on this question I would like to understand the way MMA represents rational numbers. First of all, as Carl Woll suggested, x/y is not a simple ...
330 views

### Using FromDigits to convert number strings to numbers

I've loved mathematics for a very long time but am only now beginning my journey to learn to code. The attached image shows the two different outputs (out-5, out 6) for a simple crypto-cypher I'm ...
401 views

### What is the most efficient way to add zeros to end of a number?

Beside *10^n, is there a faster way to add thousands of zeros to end of a number? Updated Timings: ...
149 views

### number format with fixed total digit

How to get an output of number form of a given TOTAL digit? For example, a total digit of 3, then one get 1.00 for 1. ...
### Self-locating Strings in $\pi$?
According to The Pi-Search Page, in the first 100 million digits of $\pi$ the following numbers are self-locating: 1, 16470, 44899, 79873884. The following inefficient code (which also does not ...