Questions tagged [machine-precision]

For questions on the use of machine-precision real numbers (also known as floats), the numbers that can be directly manipulated through the underlying numerical capabilities of your computer system.

Filter by
Sorted by
Tagged with
1
vote
1answer
102 views

Performance Tuning - How can I make Mathematica to use less than certain digits number?

I would like to know if there is a way to make Mathematica to use at most certain digit number. For example, Suppose I want to calculate 2*Pi. x=N[Pi] y=2*x ...
0
votes
0answers
70 views

Getting max precision limit overflow for a very simple calculation

I've never seen this error on such a simple calculation. Does anybody know how to fix this annoying error?
5
votes
1answer
71 views

Precision-related error in Audio

Bug introduced in 11.3 or earlier CASE:4075745 I have been experimenting with using Audio and associated functions for data acquisition using an external sound ...
4
votes
1answer
132 views

The algorithm behind InputForm for machine numbers

There are several questions on this site about implementing fast CSV/TSV export for machine numbers without loss of precision. Recently I discovered that Export ...
6
votes
1answer
105 views

Bug in floating-point number comparisons near $MachineEpsilon?

I stumbled over the following weird behavior when comparing floating-point numbers close to 1.0: qq = 1.0 + 60.0 $MachineEpsilon; and then ...
2
votes
1answer
116 views

Floor inconsistent with Less for machine-precision approximate numbers

For machine-precision numbers, Mathematica uses a tolerance for comparisons, so that 1.-$MachineEpsilon==1. However, Floor does ...
2
votes
1answer
109 views

Showing what happens with a number beyond machineprecision

I want to play around a bit in Mathematica to understand how floating-point precision, rounding and truncation actually works. I understand that Machineprecision is $2^{-52}$. First of all I would ...
6
votes
1answer
424 views

What is wrong with importing Real32 or Real64?

Those who visit the chat might have seen the question of varkor. I'm posting it here in the hope that I have missed something. Assume you have a real number ...
1
vote
1answer
51 views

Precision Issue with Log

I have the following codes. Naturally, I expect to get zero. I thought it is due to some possible issues stated as "Machine-precision inputs can give numerically wrong answers on branch cuts:". ...
30
votes
2answers
4k views

Why does Mathematica results differ from C++ results within machine precision?

I am trying to wrap my head around floating-point precision. Performing the following numeric operation: 275./6.*1.03692775514337 in Mathematica and C++ and ...
4
votes
1answer
143 views

Is Mathematica, while operating within $MachinePrecision IEEE 754 compliant?

I was looking in Mathematicas documentation and could not find to which point Mathematica includes the IEEE 754 standard? It is mention it in its documentation MachinePrecision under Background & ...
1
vote
0answers
143 views

Machine Learning Predict Precision

I have this code p = Predict[{1 -> 123456789123456789, 3 -> 987654321987654321}] values are big, more than 15 digits (standard machine precision). when I ...
0
votes
2answers
494 views

How to use Working Precision to get good result and plot?

I have a function f(x) which I would like to see going up for very low values of x: from an asymptotic study, I expect it to go to Infinity for low x; however, I can see an elbow and many oscillations....
9
votes
1answer
513 views

What explains the inaccuracies in machine-precision 'integers' with trigonometry or powers?

This Mathematica tutorial notes some strange behaviour with calculations such as Sin[10^50]: ...
3
votes
1answer
65 views

Precision improvement for solution of the simplest low-pass filter

I solved the most basic low-pass filter using NDSolve in Mathematica and LTSpice. The solution provided by Mathematica seems to lack precision. I tried to deal with WorkingPrecision but I didn't ...
8
votes
1answer
117 views

Unexpected behavior from CoordinateBoundingBoxArray with Into[1] and 0.41

I want to get the four corners of a Cuboid. This usually works: CoordinateBoundingBoxArray[{-{1., 1.}, {1., 1.}}, Into@1] gives ...
30
votes
8answers
1k views

Elegant high precision `log1p`?

Sometimes it is hard to understand how numerical expressions are evaluated. I remember reading claims by Wolfram on how smart the Kernel is to evaluate expressions trees numerically by recognizing ...
1
vote
0answers
192 views

Printing Precision of Machine Numbers

Is Mathematica making the print precision rounding judgment more stringent based on whether or not the number is above or below the rounding target? If so, why? In my real case, I have many numbers ...
1
vote
2answers
116 views

MemberQ[{0.01, 0.05}, (0.01*9*2)/9/2] returns False

Multiplying and dividing by the same stuff seems to alter the value. Quite curiously, if the value you start from is large enough (greater than 0.05 in my case) you do not see the problem. Any idea ...
0
votes
0answers
59 views

ListLinePlot gives the correct values but N doesn't

I have solved a set of 6 differential equations with DSolve. When I use the table command and produce the results of one of the equations given by DSolve, the ListLinePlot command gives me the correct ...
7
votes
1answer
613 views

Really understanding precision

I've been reading the documentation in Mathematica about precision, namely: Exact and Approximate Results Arbitrary-Precision Numbers Arbitrary-Precision Calculations Machine-Precision Numbers ...
0
votes
0answers
40 views

Unpredictable behavior of numerical error

A comparison of float calculation and exact expression for NumberForm[0.3^2 - (3/10)^2, 18] gives an exact zero for $0.3$. However, ...
3
votes
1answer
206 views

Precision of integers vs. Precision of floating numbers

It seems that Mathematica can handle very big integers accurately, but cannot do the same for floating numbers. See the following code: ...
0
votes
1answer
118 views

How to use a higher precision?

Below is my code. If I set W to $10^{55}$, it breaks down and the result is wrong. What do I need to do to use W as large as $10^{200}$? ...
11
votes
2answers
758 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 ...
39
votes
1answer
1k views

Is there a difference between Divide[a,b] and a/b?

In this comment it was asserted that Divide[a,b] and a/b are different, though the documentation indicates that they are the ...
2
votes
2answers
570 views

'eps' equivalent in Mathematica

In MATLAB, there is a function named eps. eps Spacing of floating point numbers. D = eps(X), is the positive distance from ABS(X) to the next larger in ...
12
votes
1answer
700 views

Why does 1 - Exp[-10.0^12] cause an out-of-memory error?

I would like to understand why evaluation of the expression 1 - Exp[-10.0^12] causes an out-of-memory error and how can I prevent such errors when calculating ...
1
vote
0answers
196 views

Treating a bad conditioned covariance matrix

I am trying to detect outliers in a big dataset using the Mahalanobys distance method. To calculate the Mahalanobys distance for a given vector $x$ from a mean vector $\mu$ you have to compute the ...
1
vote
0answers
142 views

Chop intermediate results of NDSolve after each step [closed]

Using NDSolve for a set of three ordinary differential equations, I ran into the problem that intermediate results quickly develop negligible imaginary parts. I get ...
5
votes
6answers
2k views

Why is this Mandelbrot set's implementation infeasible: takes a massive amount of time to do?

The Mandelbrot set is defined by complex numbers such as $z=z^2+c$ where $z_0=0$ for the initial point and $c\in\mathbb C$. The numbers grow very fast in the iteration. ...
3
votes
4answers
240 views

Precision problem with numerical solution of a differential equation

I want solve $$ 2\sqrt{|\gamma|}x = \int_{1}^{t} dy \sqrt{\frac{1+2|\gamma_2|y}{y^2(1-y)}} $$ where $0<t\leq $1. I'm using a for cycle to evaluate t, calculate the integral and the assign the $x$. ...
3
votes
1answer
109 views

Why does this rounding happen at machine precision?

Clearly, dividing by two in a binary number shifts the decimal point like this: BaseForm[InputForm[7], 2] BaseForm[InputForm[7/2 // N], 2] It gives: 2^^111 and 2^...
4
votes
1answer
359 views

What happens at the end of MachinePrecision? Is the remainder discarded or rounded?

What happens at the end of MachinePrecision? Is the remainder discarded or rounded? This code suggests it is discarded; is that conclusion correct? Why is it not rounded? ...
3
votes
1answer
86 views

problem in matching two sets of particles

I have been trying to simulate a simple system in which there are two set of particles. One kind of particles are localized on the boundary of a circle (shown in purple below), whereas the second kind ...
7
votes
4answers
180 views

Definition of $MachineEpsilon

$MachineEpsilon x = 0.0000000000000001 % + 1 % - 1 As expected the final result equals zero, since x < MachineEpsilon ($2.22045\times10^{-16}$). However, if I ...
2
votes
2answers
523 views

Export numeric data with preset decimal places

I have a table of pairs of numbers, each with 300 decimal places, which are all important. If saved using Export["data.dat", data] and then imported back via Import["data.dat"] - then the 300 decimal ...
4
votes
4answers
2k views

Making a calculation with high precision

I would like to make the following calculation: 1/Sqrt[1 - (150^2 10^(-4))/(9 10^16.)] - 1 Mathematica 8 returns 0. The result is obviously not 0, but my ...
9
votes
1answer
501 views

Machine Epsilon

I'm trying to evaluate the machine epsilon of my computer (see below). I wrote this: ...
4
votes
1answer
73 views

A simple syntax does not work

The code below does not work. Can anyone tell me why? Thanks! ...
6
votes
1answer
191 views

ConvexHullMesh fails with small numbers

When I try to get the ConvexHullMesh of a List of points that are "small scale", I get errors: ...
6
votes
1answer
560 views

Machine-Precision and Arbitrary Precision [closed]

What is meant by a machine number in the Mathematica documentation? What is the difference between machine-precision and fixed-point precision? What is arbitrary precision?
16
votes
4answers
387 views

Does Mathematica have an equivalent of C's nextafter?

In C (and many other programming languages), there is a function double nextafter(double x, double y) which takes two (IEEE 754) floating-point numbers and ...
4
votes
1answer
248 views

MachinePrecision versus $MachinePrecision in NDSolve

I'd like to understand why one of these inputs gives me an error and the other doesn't: ...
2
votes
1answer
3k views

How to change machineprecision digits

I am trying to compute t0: ...
10
votes
2answers
870 views

Why is Mathematica destroying this graph?

Here I have a picture of a function I graphed: reg[x_,y_]:=(x^2+y^2)Cos[4ArcTan[y/x]]; Plot3D[reg[x,y],{x,-2,2},{y,-2,2},AxesLabel->Automatic] And here is ...
4
votes
2answers
942 views

How do I overcome an Overflow?

I'm trying to calculate entropies for an absolutely giant system by counting states, and this means I have to use some obscenely large numbers. I'm running ...
3
votes
1answer
397 views

Mathematica Precisions vs Doubles in C/C++

I'm having a bit of an issue regarding numerical precision and I'm not sure how to deal with it. I have a certain randomly generated matrix, say $M$, that I wish to compute the eigenvalues. The ...
4
votes
1answer
403 views

How to calculate accurate answer in Mathematica?

I accidentally discovered for myself, that Mathematica outputs inaccurate answer. For instance, if I take $\sin(2 \cdot \pi \cdot 0.5) = 0 $, then in Mathematica it is: But if I calculate it on site ...
3
votes
1answer
94 views

My NIntegrate expression returns a wildly inaccurate value

I am trying to integrate a function using NIntegrate: ...