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

What's the smallest positive real allowed in mathematica?

This question may be a bit strange, but in this question, one of the answers suggests substituting some negatives values in a matrix by the smallest positive real number allowed. So, I was wondering ...
0 votes
0 answers
329 views

Plot a function with very small values, close to zero

I want to plot a function with very small values, close to zero, but even though the limit is -3/2 as x->0, I can't get any ...
0 votes
1 answer
109 views

Simple division with high precision in Mathematica [closed]

I want to do a simple division i.e. 0.70524/0.51824 . What I want is to find the result of the roundation of this division for precision from 1 to 19 decimal digits....
3 votes
1 answer
141 views

Numerical precision problem

I have this simple code: ep = 1 - 80000000000 (-(199999/200000) + 1/E^(1/200000)) ep // N -8.27404*10^-8 ...
3 votes
1 answer
136 views

Copy-paste with annoying trailing 0s

When one copies an output containing machine-precision numbers to a input, many trailing 0s appears. For example : Evaluate the following expression : ...
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 ...
0 votes
2 answers
90 views

equal expressions give different numerical result

I have two expressions, and they are really equal: ...
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 ...
1 vote
1 answer
50 views

How to choose elements of a matrix with internally generated variables and rank them with real coefficients

I have a Code (a long one), part of it is below. The following piece basically multiplies an adjacency matrix with a vector of equilibrium values. Then tries to pick non-zero elements to be used in ...
2 votes
1 answer
158 views

Working Precision warnings for ParametricPlot

I wish to plot a series of parametric curves for the following function called poly that has five parameters (Γ, ...
15 votes
4 answers
671 views

Terrible accuracy of DawsonF

DawsonF[30.] returns 0. The correct value is 0.016676... At least it prints a warning message, ...
8 votes
3 answers
6k views

Machine precision near zero: not fulfilled?

I am puzzled by the behavior of Mathematica machine precision with numbers approaching zero. This manifests itself, e.g., with FixedPoint and the like. In the ...
5 votes
2 answers
584 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 <...
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: ...
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: ...
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 ...
8 votes
2 answers
536 views

Dealing with numbers too large for machine precision in Graphics

Graphics only supports machine precision numbers (i.e. number that can be converted to machine precision). Take for example ...
1 vote
1 answer
162 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
0 answers
103 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
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 ...
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 ...
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 ...
3 votes
1 answer
136 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
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 ...
8 votes
1 answer
987 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
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:". ...
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 ...
4 votes
1 answer
249 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
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 ...
0 votes
2 answers
962 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
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]: ...
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 ...
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 ...
31 votes
8 answers
2k 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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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: ...
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}$? ...
11 votes
2 answers
881 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 ...
2 votes
2 answers
744 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
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 ...
1 vote
0 answers
290 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
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 ...
5 votes
6 answers
3k 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
4 answers
315 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
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^...
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? ...