help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculation issue with octave (data unexpectedly go to zero at some


From: Dmitri A. Sergatskov
Subject: Re: Calculation issue with octave (data unexpectedly go to zero at some point)
Date: Thu, 27 Feb 2014 20:11:45 -0600


Back to the original problem.
I think if we pre-scale argument such that X is about MAXINT, we get the max
possible accuracy in this situation. In this particular case


Gamma = 1.62e7;
duration = 10/Gamma;
dt = 0.0025/Gamma;
t   = 0:dt:duration;
sc = 2^31 / duration ;
y = mod (sc*t, sc*0.2/Gamma)/sc;

[a,b] = find(abs(y) < eps);

sum(a)
ans =  51

b =

 Columns 1 through 11:

      1     81    161    241    321    401    481    561    641    721    801

 Columns 12 through 22:

    881    961   1041   1121   1201   1281   1361   1441   1521   1601   1681

 Columns 23 through 33:

   1761   1841   1921   2001   2081   2161   2241   2321   2401   2481   2561

 Columns 34 through 44:

   2641   2721   2801   2881   2961   3041   3121   3201   3281   3361   3441

 Columns 45 through 51:

   3521   3601   3681   3761   3841   3921   4001


Perhaps we should include such pre-scaling in the code of rem and mod
if we try for matlab compatibility...

Dmitri.
--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]