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
7 votes
1 answer
268 views

Bug in ListPlot?

I want to check if this is a bug before I email WR about it. I can't get ListPlot[] to make scatter plots over a very small area: ...
Jerry Guern's user avatar
  • 4,553
5 votes
1 answer
235 views

Compilation, square roots, and integers

After looking at this question, particularly this answer, I wrote my own performance test, using the two functions ...
rogerl's user avatar
  • 4,209
11 votes
1 answer
143 views

Abnormal behavior of RealDigits[x]

In the Details of the document of RealDigits writes the following line: RealDigits[x] normally returns a list of digits of ...
xzczd's user avatar
  • 63.8k
3 votes
2 answers
122 views

Make mathematica "forget" numbers beyond the precision goal

I need Mathematica to remember only things upto two decimal places. I'm currently using the unwieldy Floor[x*100]/100 which works but is there a better way to ...
user1936752's user avatar
1 vote
1 answer
569 views

How to increase the precision to get the correct roots at the boundaries?

I want to solve an equation and Plot a graph of $\delta(\tau)$, where $0<\tau,\delta<1$. In principal $\delta(0)=1,\delta(1)=0$. However, when I solve the equation, the points near $\tau=1$ can'...
an offer can't refuse's user avatar
2 votes
2 answers
978 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 ...
Alex's user avatar
  • 755
0 votes
1 answer
146 views

N, machine precision and expression evaluation [closed]

I should state that I am a Mathematica beginner but I checked the questions about machine vs arbitrary precision (such as: this one ) and I continue to have the following issue while trying to ...
George's user avatar
  • 39
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 ...
user8074's user avatar
  • 1,582
1 vote
0 answers
102 views

Odd plotting/math issue (could be a precision problem) [closed]

I've got a pretty odd error on a project I'm working on and was hoping to enlist some advice to fix it. The goal of this notebook is to show that I can eliminate the non-normalizable (blowing up part) ...
Schwinger's user avatar
  • 151
0 votes
2 answers
94 views

Varying results from the Round function

My problem is simple. Consider the following. ...
plhn's user avatar
  • 113
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 ...
Joel Bosveld's user avatar
10 votes
1 answer
310 views

Can Someone Please Explain Internal`$SameQTolerance?

If I input Internal`$SameQTolerance (* output = 0.30103 *) which is the approximation of Log[10,2], or ...
user155812's user avatar
2 votes
1 answer
232 views

Precision of LinearModelFit with Polynomials

I have a Problem regarding the fit of given points with a polynomial up to the fifth degree. tableofvalues=Import["tableofvalues.csv"] My polynomial is: ...
mcocdawc's user avatar
  • 451
16 votes
4 answers
456 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 ...
David Zhang's user avatar
  • 2,306
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 ...
David Zhang's user avatar
  • 2,306
1 vote
1 answer
165 views

Why does it matter at what point I replace?

I need to find four orthogonal linear combinations of complicated functions, that vanish at four different points. I use (LK4 is defined below, but its shape should have nothing to do with my problem)...
Neuneck's user avatar
  • 655
11 votes
1 answer
689 views

Compilation of Total with compensated summation

I sometimes obtain an unexpected error when trying to call a compiled version of Total with compensated summation turned on. More specifically I define ...
Eckhard's user avatar
  • 1,395
2 votes
1 answer
295 views

How to stop Mathematica from turning .02 into 0.019999999999999997` [closed]

...
Daniel Berkowitz's user avatar
0 votes
1 answer
172 views

Floating point arithmetic bug caused by Table[]

I was doing something fairly ordinary and noticed something I can't, for the life of me, explain. For context, I wanted to take make a function that takes an array of data like the one below, then an ...
YungHummmma's user avatar
  • 3,002
2 votes
0 answers
161 views

Enforcing WorkingPrecision in NIntegrate

I have a very complicated 2D integral that I need to calculate repeatedly, and I'm trying to speed it up a bit, since at the moment it's taking a couple of days to complete. One thing I've noticed is ...
Widjet's user avatar
  • 199
26 votes
2 answers
2k views

Different floating-point numbers equal?

Let's define two different numbers. x = 1. y = 1. + 2^-52 (* equivalently, 1 + $MachineEpsilon *) Let's make sure they're different with ...
2012rcampion's user avatar
  • 7,801
3 votes
2 answers
1k views

NIntegrate 2D highly oscillatory function

I am trying to integrate a function, and the error I get is greater than the result. So I need to calculate ...
oaroldan's user avatar
6 votes
2 answers
178 views

How can I make 1+$MachineEpsilon not look like 1?

I undarstand that 1+$MachineEpsilon is actually not equal 1. However, it persists to look like it was equal ...
gaazkam's user avatar
  • 817
6 votes
0 answers
168 views

Can I force Mathematica to use machine precision? [duplicate]

Some built-in functions (like Exp) give an arbitrary precision result, even when the argument is a machine precision number. Example: ...
Niki Estner's user avatar
3 votes
2 answers
332 views

WorkingPrecision causes issue in the NIntegrate

I really can't figure out why my code sometimes is not working. My integrals involve two variables (k and kz). The integration ...
Chien-Te Wu's user avatar
1 vote
0 answers
65 views

Which operations preserve digit precision?

Imagine I had to use numbers with a 600 precision digits. Do all mathematical operations, like +,-,...
An old man in the sea.'s user avatar
2 votes
2 answers
745 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 ...
diverger's user avatar
  • 407
3 votes
1 answer
522 views

Reasonable choice of MachinePrecision, AccuracyGoal and PrecisionGoal for NDSolve

I am trying to use this model for later use in FindFit: ...
Ramiro Magno's user avatar
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$. ...
apt45's user avatar
  • 1,628
2 votes
1 answer
1k views

How to increase significant digits in Mathematica

How can I increase the number of significant digits in Mathematica? When I import a matrix, an element like 112.5276 is rounded to 112.528. I would like to increase the number of significant digits ...
MOON's user avatar
  • 3,834
1 vote
2 answers
119 views

Decimal output from a simple equation

Let x= 0.0000000000000000036; y = 1 - x If i type this in Mathematica the answer of y is 1. I want the answer to be as it ...
Nikolas's user avatar
  • 105
4 votes
1 answer
176 views

How to map HoldForm?

I'm trying to compare between Sqrt[3.] and Sqrt[3]. To display the result, I mapped HoldForm to display the expressions on the left hand column (code at end), but it seems like Sqrt[3.] had been ...
seismatica's user avatar
  • 5,061
9 votes
1 answer
167 views

Why am I getting wildly incorrect results from FirstPassageTimeDistribution with inexact transition matrix?

Working on some large systems using DiscreteMarkovProcess, I changed the transition matrix to machine precision vs using exact values, which sped things up handily. ...
ciao's user avatar
  • 25.6k
9 votes
1 answer
770 views

Machine Epsilon

I'm trying to evaluate the machine epsilon of my computer (see below). I wrote this: ...
Eric's user avatar
  • 93
0 votes
1 answer
90 views

Unexpected behavior of subtraction with approximate numbers [duplicate]

I'm using the Table command to generate a list of values: FullForm /@ Table[10. - x, {x, 2.7, 2.8, .1}] and I get the ...
Ivan's user avatar
  • 1
0 votes
1 answer
2k views

How to get more accurate orthonormal eigenvectors?

I have a matrix M with real entries in MachinePrecision. I compute its eigenvectors and construct matrix ...
user18742's user avatar
6 votes
1 answer
235 views

Machine precision infinity

Is it possible to obtain the machine precision (double) version of Infinity? This is useful when using LibraryLink and C ...
Lorenzo Pistone's user avatar
0 votes
0 answers
70 views

Number precision in a list [duplicate]

I have list with elements: ...
Ziva's user avatar
  • 787
0 votes
2 answers
240 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 ...
Ziva's user avatar
  • 787
4 votes
2 answers
2k views

Floating point addition not associative

Can anybody explain the following behavior? x = 0.2 + (0.3 + 0.1); y = (0.2 + 0.3) + 0.1; x == y (* -> True *) But actually the variables do not exactly ...
Ruben Garcia's user avatar
2 votes
1 answer
2k views

Plot periodic function from Dirac delta function [duplicate]

Sorry for my bad english. I need to plot periodic function from dirac delta: δT(t)=∑δ(t–n*T), where T - is a constant, and n=-20..20 And after them, plot new function fd=f(t)*δT(t) - discrete signal ...
Venzo's user avatar
  • 21
5 votes
1 answer
2k views

Error about limit MaxExtraPrecision

After my evaluations I have an error: N::meprec: Internal precision limit $MaxExtraPrecision=50. reached while evaluating ... ...
Ziva's user avatar
  • 787
6 votes
1 answer
163 views

Issues with $MachineEpsilon

I'm attempting to add $MachineEpsilon to numbers I am pulling from the domains of 3 interpolating functions. I pulled 3 numbers, and for one of these numbers adding ...
Nicole's user avatar
  • 87
2 votes
0 answers
568 views

how to calculate with just double floating point precision [duplicate]

I want to calculate with simple double floating point precision. ...
user11523's user avatar
42 votes
2 answers
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 ...
Mark Adler's user avatar
  • 4,939
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 ...
alfC's user avatar
  • 877
0 votes
1 answer
272 views

How to improve the performance of this code

I have implemented a code in Mathematica 9 to simulate a scattering problem, and I got really disappointed about its performance when compared to Matlab. Since I am a newbie in Mathematica, would ...
Alex's user avatar
  • 1
17 votes
2 answers
343 views

CompiledFunction returns machine numbers smaller than $MinMachineNumber

When thinking on the workaround for this LogLogPlot bug suggested by halirutan I noticed that CompiledFunction actually can ...
Alexey Popkov's user avatar
2 votes
2 answers
177 views

Long run time for older code that ran fast in older versions

The following code block is in Trott's Guidebook for Programming. The associated notebook says that this and a few other routines ran in a matter of seconds. I killed it after half an hour. I am ...
NotAZombie's user avatar
4 votes
1 answer
3k views

CompiledFunction::cfse: "Compiled expression X should be a machine-size integer

I am trying to use a compiled function in order to save time... LegrendeTransform = Compile[{y}, MaxValue[Sin[x] - x *y , x]] Now I want to to evaluate and ...
altroware's user avatar
  • 274