Questions tagged [number-representation]

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

40 questions
Filter by
Sorted by
Tagged with
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 <...
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-...
955 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: ...
274 views

Calculations after NumberForm [duplicate]

As specified in documentation center the functions AccountingForm, NumberForm, etc. are useful only to display numbers in ...
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: ...
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 (...
105 views

Unexpected behavior from NumberForm of a matix [duplicate]

If I calculate the dimension of the matrix after NumberForm directly, then there will be something wrong ...
751 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 ...
891 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?
672 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

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 ...
259 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 ...
771 views

hexList[] returns a list of decimal numbers

Sorry for not being clear about this question earlier. I appreciate the answers I got, but the edits I made should make the question more understandable. I have been working with hex in Mathematica,...
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 ...
395 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 ...
99 views

NumberForm and Precision

With MachinePrecision this construction works as expected ...
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? ...
128 views

Testing for a vector of reals [closed]

Suppose I define: RealVector[expr_]:=VectorQ[expr,NumberQ[#]&&Head[#]===Real)]; Then: ...
200 views

The precision of the number

I have problem in Mathematica with unnecessary rounding which is caused by high precision. For example I have value a = 2.052685846*10^-1865, when I make ...
1k 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 ...
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 ...
187 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 ...
715 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 ...
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 ...
135 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 ...
103 views

ExponentFunction not respected in NumberForm when typesetting zero?

Let's try to typeset a couple of numbers with a precision accuracy of 4: 04 14 10000004 I do not want the numbers returned with ...
135 views

Rationalize error

The docs state that "Rationalize[x,dx] yields the rational number with smallest denominator that lies within dx of x." However, testing this out it appears to be false. ...
109 views

LieArt — 3 different 8 dimensional irreducible representation of $\mathrm{SO}(8)$ and their decompositions

I am using the LieArt which you can download freely online https://arxiv.org/pdf/1206.6379.pdf There are three different 8 dimensional $\mathrm{SO}(8)$ irreducible representations, formally it is ...
486 views

Machine Epsilon

I'm trying to evaluate the machine epsilon of my computer (see below). I wrote this: ...
228 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 ...
164 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 ...
123 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: ...
94 views

StringTemplate does not respect NumberFormat

I am trying to write Latex report generator for my standard data analysis. But there is an issue with formatting numbers I can not get around. I would like to make use of my own ...
160 views

How can I completely discard decimals after a set number of significant figures?

I have a number with a long decimal tail, like x=1.23456789789456123 and I would like to (i) keep the first $n$ significant figures, and (ii) completely discard ...
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: ...
144 views

How to plot data that are already in scientific form? [duplicate]

I've got an array of data shown in scientific form. Which looks like this: x = {0.0001,ScientificForm[0.999890436521418]} Now I'm trying to use ListPlot to plot ...
263 views

Converting a quantity to a decimal form [closed]

I have a function giving me this: (5 Coulomb)/(6 Second) as output. I want this in decimal form and would like to have the variables taken off the end for unit ...
699 views

What is the fastest way to split a number into parts?

I have very large numbers (million digits). number = A*10^partlen + B As of now, I split the numbers by this way: ...