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
5 votes
2 answers
585 views

Why does N not upgrade precision? [duplicate]

Precision[N[1.0, 20]] Precision[N[1, 20]] MachinePrecision 20. It would be so much more intuitive and less error prone, if <...
Johu's user avatar
  • 4,876
9 votes
1 answer
249 views

Plot3D discrepancy between MMA 10 and 11.3 - possible small numbers issue

I'm having some troubles with the following code I wrote in MMA 10 some time ago: ...
Fraccalo's user avatar
  • 5,997
4 votes
1 answer
148 views

Machine Epsilon is not equal to $MachineEpsilon [duplicate]

I try to wrap my head around machine precision calculations in Mathematica (11.2, Linux). I do not understand the following behavior: ...
Robin Geyer's user avatar
0 votes
2 answers
77 views

NIntegrate numerical accuracy and errors

I have the following 3x3 matrix M = {{-I*ω + Γ/2, I*g1, 0}, {I*g1, -I*ω + κ1/2, I*g2}, {0, I*g2, -I*ω + κ2/2}}; Finding the eigenvalues and eigenvectors ...
kowalski's user avatar
  • 385
1 vote
1 answer
164 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 ...
Ricky the Confused's user avatar
0 votes
0 answers
104 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?
user avatar
5 votes
1 answer
78 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 ...
Daniel W's user avatar
  • 3,406
4 votes
1 answer
155 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 ...
Alexey Popkov's user avatar
4 votes
0 answers
176 views

Is it possible to get the original number from DecimalForm?

Bug introduced in 5.2 or earlier and persisting through 13.1.0 [CASE:4315787] Wrong behavior of NumberForm (DecimalForm outputs ...
Alexey Popkov's user avatar
21 votes
2 answers
3k views

New General::munfl error and loss of precision

The latest version 11.3.0.0 of Mathematica returns Indeterminate when evaluating Log[Exp[-800.]]. I believe this was not ...
Valerio's user avatar
  • 1,962
8 votes
1 answer
991 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 ...
halirutan's user avatar
  • 112k
1 vote
1 answer
66 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:". ...
yaykhel's user avatar
  • 171
8 votes
2 answers
590 views

how to get single, and quad Precision out of Mathematica which match Fortran result

by default, if a number has decimal . after it, then Mathematica will do computation using machine Precision, which on my PC (intel hardware) running windows 7 64 ...
Nasser's user avatar
  • 137k
4 votes
1 answer
250 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 & ...
DrDirk's user avatar
  • 447
30 votes
2 answers
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 ...
DrDirk's user avatar
  • 447
1 vote
0 answers
205 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 ...
Zlelik's user avatar
  • 531
9 votes
1 answer
556 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]: ...
numbermaniac's user avatar
6 votes
4 answers
497 views

How do I convert an inexact number smaller than $MinMachineNumber to machine-precision?

I was trying to convert some arbitrary-precision numbers to machine-precision numbers using N[myNumber,MachinePrecision]. But, although my test number did lose some ...
Ruslan's user avatar
  • 7,122
3 votes
1 answer
91 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 ...
space bobcat's user avatar
1 vote
2 answers
154 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 ...
Rho Phi's user avatar
  • 1,410
0 votes
0 answers
64 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 ...
KratosMath's user avatar
  • 1,243
2 votes
0 answers
300 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 ...
Chris Chiasson's user avatar
8 votes
1 answer
821 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 ...
Vicent's user avatar
  • 1,091
0 votes
2 answers
966 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....
Andrea G's user avatar
  • 739
0 votes
0 answers
44 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, ...
pawel_winzig's user avatar
  • 1,567
3 votes
1 answer
266 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: ...
S. Kohn's user avatar
  • 123
12 votes
1 answer
814 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 ...
Ray Shadow's user avatar
  • 7,776
0 votes
1 answer
135 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}$? ...
S. Kohn's user avatar
  • 123
1 vote
0 answers
292 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 ...
John's user avatar
  • 660
1 vote
0 answers
232 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 ...
Janosh's user avatar
  • 1,281
8 votes
1 answer
121 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 ...
masterxilo's user avatar
  • 5,689
6 votes
1 answer
134 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 ...
RonH's user avatar
  • 281
3 votes
1 answer
143 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^...
GambitSquared's user avatar
4 votes
1 answer
364 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? ...
GambitSquared's user avatar
2 votes
1 answer
155 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 ...
GambitSquared's user avatar
3 votes
1 answer
98 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 ...
Ali Hashmi's user avatar
  • 8,900
7 votes
4 answers
351 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 ...
GambitSquared's user avatar
6 votes
1 answer
290 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: ...
DPF's user avatar
  • 1,067
4 votes
1 answer
75 views

A simple syntax does not work

The code below does not work. Can anyone tell me why? Thanks! ...
lol's user avatar
  • 677
8 votes
1 answer
931 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?
Undertherainbow's user avatar
5 votes
1 answer
444 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: ...
Max's user avatar
  • 1,040
10 votes
2 answers
927 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 ...
silvascientist's user avatar
4 votes
2 answers
3k 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 ...
laudiacay's user avatar
  • 562
3 votes
1 answer
645 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 ...
romanovzky's user avatar
4 votes
1 answer
460 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 ...
Roman Alexeev's user avatar
4 votes
1 answer
111 views

My NIntegrate expression returns a wildly inaccurate value

I am trying to integrate a function using NIntegrate: ...
Roopa's user avatar
  • 41
2 votes
1 answer
362 views

How to tell Mathematica to treat all numbers (including those in decimal form) as arbitrary precision numbers

I have code that is essentially numerical. It uses functions like NDSolve and NIntegrate. But in most interesting cases, the ...
QuantumDot's user avatar
  • 19.5k
10 votes
1 answer
395 views

Plot of $\sin(x^x)$ is missing from $x=143$

When plotting the graph of $\sin(x^x)$ I noticed that there is no plot from about $x=143$. I don't suppose there is a purely mathematical explanation for this? So, why is there no graph in ...
GambitSquared's user avatar
4 votes
0 answers
244 views

Classification problem using SVM methods

I am running SVM on mathematica and I a used this code with classes: ...
BetterEnglish's user avatar
1 vote
1 answer
104 views

Wrong Limit[...] for inexact expressions

I noticed that Limit can return nonsense when using inexact parameters. In the following code, a is my (exact/inexact) parameter,...
Martin J.H.'s user avatar