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
2answers
96 views

Why is Mathematica's default precision only 16 digits? [on hold]

I was performing some basic computations when I noticed that NumberForm[N[Zeta[3]], {100, 100}] yields ...
0
votes
0answers
32 views

Why LinearLayer does not equal w.x+b [on hold]

Why if I define a linear layer: l1=LinearLayer[50, "Weights" -> wl1, "Biases" -> bl1] and calculate l1[x1]-wl1.x1+bl1 ...
4
votes
2answers
218 views

Underflow error General::munfl from E^x instead of Exp[x]

In contrast to earlier versions, Mathematica 11.3 and 12.0 generate lots of underflow errors from my code, e.g. ...
0
votes
0answers
32 views

Contradictions in PositiveDefiniteQ, Det and Inverse in Mathematica

A few words before the working example. Below we find 2 functions which should theoretically transform any matrix to its closest Symmetric Positive Definite (SPD) matrix: ...
2
votes
1answer
88 views

Correct syntax for working precision in functions version 12

I just recently updated from version 11.2 -> 12...there apparently are quite a few changes since 11.2. $\unicode{952}\unicode{960}$ One being how version >11.3 deal with numbers that approach zero. ...
1
vote
3answers
79 views

When should one write integer numbers with a decimal?

I often see different solutions where users have taken advantage of how Mathematica handles numbers differently. I.e. when is it appropriate to use a decimal point in a calculation? Can someone ...
1
vote
1answer
74 views

Drawing from InverseWishartMatrixDistribution. A machine precision error?

I'm drawing from the Inverse-Wishart Distribution, but I got the following error message: ...
1
vote
1answer
75 views

How can I suppress the warning $\mathrm{\it precision\ may\ be\ lost}$?

When I import data from a .dat file, V11.3 emits the message: is too small to represent as a normalized machine number; precision may be lost. How can I close the ...
4
votes
1answer
210 views

Inexact numbers as keys in Association?

Can someone explain me how Mathematica's Associations behave with inexact numbers as keys: <| 0.22499999999999964` -> a |> [0.22499999999999965`] and <...
1
vote
1answer
72 views

Efficient Round edition with different rounding direction

As pointed out in this post, Mathematica has a special version of Round that Round rounds numbers of the form x.5 toward the nearest even integer. A comment by ...
2
votes
1answer
117 views

How to prevent Mathematica from giving inexact answers

Upon doing a simple subtraction 13.725 - 13.5 both Mathematica 11.3 and 12.0 beta version are giving me 0.22499999999999964 ...
3
votes
1answer
52 views

Forcing divisions to be a machine-precision floating point divisions instead of multiplication by inverse

I want to imitate machine-precision, de facto IEEE division on Mathematica. On my quick trials I find this surprisingly hard to accomplish, since Mma rewrites a / b ...
0
votes
1answer
61 views

ContourPlot showing breaks in contours

I'm trying find graphically the solutions of the intersection of the following functions. ...
2
votes
2answers
125 views

Why is 0 vs 0.0 causing a precision problem?

I wasn't sure what to title this Question. I tried calculating different forms of a continued fraction, and I found that I get a correct result when I set d to 0 but a wrong result (in the final two ...
5
votes
0answers
58 views

Small positive machine number calculation in Mathematica 11.3

In Mathematica version < 11.3, any positive Machine‐Precision Numbers exceeding the range [$MinMachineNumber,$MaxMachineNumber...
5
votes
1answer
95 views

Extracting binary digits of machine precision numbers

Currently, I am developing an octree data structure. And I need it to be fast. To this end, I would like to have a fast way to extract the $m$ binary digits "after the dot" of each entry in a matrix ...
1
vote
2answers
123 views

Truncate a number in mathematica

I want to truncate a simple number to n decimal digits. For example, 2/3. I used f[x_, n_] := N[IntegerPart[x 10^n]/10^n] but I get ...
0
votes
1answer
50 views

How to get the correct result in a simple operation in Mathematica

I have the following values for x[[i]], y[[i]] and A[[i,j]]: ...
2
votes
2answers
89 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
1answer
41 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
1answer
58 views

Numerical precision problem

I have this simple code: ep = 1 - 80000000000 (-(199999/200000) + 1/E^(1/200000)) ep // N -8.27404*10^-8 ...
0
votes
0answers
105 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 ...
1
vote
1answer
80 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 : ...
0
votes
2answers
70 views

equal expressions give different numerical result

I have two expressions, and they are really equal: ...
2
votes
1answer
46 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 (Γ, ...
1
vote
1answer
39 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 ...
14
votes
4answers
360 views

Terrible accuracy of DawsonF

DawsonF[30.] returns 0. The correct value is 0.016676... At least it prints a warning message, ...
5
votes
2answers
353 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 <...
8
votes
1answer
144 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: ...
3
votes
1answer
67 views

Machine Epsilon is not equal to $MachineEpsilon

I try to wrap my head around machine precision calculations in Mathematica (11.2, Linux). I do not understand the following behavior: ...
0
votes
2answers
58 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 ...
1
vote
1answer
96 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
59 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 ...
3
votes
1answer
124 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 ...
2
votes
0answers
92 views

Is it possible to get the original number from DecimalForm?

I'm trying to implement an efficient TSV exporter based on the code from this answer. It works sufficiently quickly but the problem is that OutputForm shows about 6 ...
17
votes
2answers
837 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 ...
6
votes
1answer
330 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
50 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:". ...
7
votes
2answers
229 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 ...
3
votes
1answer
129 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 & ...
29
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 ...
1
vote
0answers
127 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 ...
9
votes
1answer
502 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]: ...
6
votes
4answers
241 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 ...
3
votes
1answer
59 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 ...
1
vote
2answers
114 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 ...
1
vote
0answers
175 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 ...
6
votes
1answer
592 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 ...