Modify machine precision

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Modify machine precision

AlbFrigerio
Hi there,

is there a way to force the machine precision to be different from eps?

Looking at the manual, I only found the command save_precision, but it is not what I'm looking for ...

Thank you,

  Alberto
Reply | Threaded
Open this post in threaded view
|

Re: Modify machine precision

Jordi Gutiérrez Hermoso-2
On 28 March 2012 11:50, AlbFrigerio <[hidden email]> wrote:
> is there a way to force the machine precision to be different from eps?

Buy a different machine, one that doesn't adhere to IEEE 754 (I'm not
sure these exist anymore), or use a different program that does slower
multiprecision computations in software, not in hardware.

If you're having problems with precision, the solution is usually to
understand hardware floats and roundoff error. Quarteroni, Sacco &
Saleri has a nice discussion of the problem in chapter 2. If you don't
have a copy available in the library, let me know, and I can think of
other ways to help you.

- Jordi G. H.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

R: Re: Modify machine precision

AlbFrigerio
Hi Jordi,

thank you for your reply.

So you are telling me that in Octave there is no way to force machine precision in a program? My problem is that I'm doing some analyses with another precision whose machine precision is 1e-13 and I was wondering to set that value in my program too (only in this one, not in Octave as a whole) to have a check of our results ...

Thanks again,

  Alberto

Il 28/03/12, Jordi Gutiérrez Hermoso <[hidden email]> ha scritto:
On 28 March 2012 11:50, AlbFrigerio <[hidden email]> wrote:
> is there a way to force the machine precision to be different from eps?

Buy a different machine, one that doesn't adhere to IEEE 754 (I'm not
sure these exist anymore), or use a different program that does slower
multiprecision computations in software, not in hardware.

If you're having problems with precision, the solution is usually to
understand hardware floats and roundoff error. Quarteroni, Sacco &
Saleri has a nice discussion of the problem in chapter 2. If you don't
have a copy available in the library, let me know, and I can think of
other ways to help you.

- Jordi G. H.

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: R: Re: Modify machine precision

martin_helm
Am 29.03.2012 10:34, schrieb alberto frigerio:

> Hi Jordi,
>
> thank you for your reply.
>
> So you are telling me that in Octave there is no way to force machine
> precision in a program? My problem is that I'm doing some analyses
> with another precision whose machine precision is 1e-13 and I was
> wondering to set that value in my program too (only in this one, not
> in Octave as a whole) to have a check of our results ...
>
> Thanks again,
>
>   Alberto
Of course I do not know the details of the problem you try to simulate,
but it sounds a bit like you should consider to use a computer algebra
system for that special situation where you can define the arbitrary
precision yourself (or arbitrary unprecision in this case). There are
several truly free versions out there, myself I use maxima for things
outside the comfort zone of octave there is also a free/libre version of
axiom and there is sage (I am not familiar with the latter two). At
least in maxima you can define exactly what prec. you want.
Be aware that you pay a high price in cpu usage with a CAS since the
arbitrary prec. arithmetic does not directly map to the cpu features and
is completely simulated in software.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Re: Modify machine precision

Jordi Gutiérrez Hermoso-2
In reply to this post by AlbFrigerio
2012/3/29 alberto frigerio <[hidden email]>:
> So you are telling me that in Octave there is no way to force machine
> precision in a program? My problem is that I'm doing some analyses with
> another precision whose machine precision is 1e-13

Listen to what you just said. Programs have different *machine*
precision? The *machine* precision isn't determined by software, but
it's a property of your hardware, of your *machine*. Your computer has
an FPU, and this FPU has certain limitations:

    http://en.wikipedia.org/wiki/Floating-point_unit

If you need variable precision arithmetic, you can try to use vpa from
the symbolic package, but depending on what you're doing, I would
follow Martin Helm's recommendation and use a program other than
Octave.

HTH,
- Jordi G. H.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Re: Modify machine precision

nrjank
Alberto: just so we're clear, could you provide a concise example of
the data you're working with and what you're trying to do with it?
Before we send you off to a Maxima or Mathematica solution, it would
be good to verify that the problem here isn't just definitions or
communication. :)

nickj

2012/3/29 Jordi Gutiérrez Hermoso <[hidden email]>:

> 2012/3/29 alberto frigerio <[hidden email]>:
>> So you are telling me that in Octave there is no way to force machine
>> precision in a program? My problem is that I'm doing some analyses with
>> another precision whose machine precision is 1e-13
>
> Listen to what you just said. Programs have different *machine*
> precision? The *machine* precision isn't determined by software, but
> it's a property of your hardware, of your *machine*. Your computer has
> an FPU, and this FPU has certain limitations:
>
>    http://en.wikipedia.org/wiki/Floating-point_unit
>
> If you need variable precision arithmetic, you can try to use vpa from
> the symbolic package, but depending on what you're doing, I would
> follow Martin Helm's recommendation and use a program other than
> Octave.
>
> HTH,
> - Jordi G. H.
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

R: Re: Re: Modify machine precision

AlbFrigerio
No problem :)

Attached you will find the Input data, my results and my friend one. As you might see, they are very similar but not the same.

With matrix X and vector w, the result is given by r = X' * (prod(X*w')./(X*w')); .

Jordi, you are right, I try to explain better what I mean.
eps is the smallest number so that alpha + eps <> alpha. Is there a way to say Octave "Look, I don't want eps to be your default value no more, please use for the function I'm running now this neweps value" ? Obviously it doesn't work if I simpy assign eps = neweps in the script file. I don't know if using my friend precision I will reach his solution, but I do not have any other way to check it ...

Thanks everyone,

   Alberto

Il 29/03/12, Nicholas Jankowski <[hidden email]> ha scritto:
Alberto: just so we're clear, could you provide a concise example of
the data you're working with and what you're trying to do with it?
Before we send you off to a Maxima or Mathematica solution, it would
be good to verify that the problem here isn't just definitions or
communication. :)

nickj

2012/3/29 Jordi Gutiérrez Hermoso <[hidden email]>:

> 2012/3/29 alberto frigerio <[hidden email]>:
>> So you are telling me that in Octave there is no way to force machine
>> precision in a program? My problem is that I'm doing some analyses with
>> another precision whose machine precision is 1e-13
>
> Listen to what you just said. Programs have different *machine*
> precision? The *machine* precision isn't determined by software, but
> it's a property of your hardware, of your *machine*. Your computer has
> an FPU, and this FPU has certain limitations:
>
>    http://en.wikipedia.org/wiki/Floating-point_unit
>
> If you need variable precision arithmetic, you can try to use vpa from
> the symbolic package, but depending on what you're doing, I would
> follow Martin Helm's recommendation and use a program other than
> Octave.
>
> HTH,
> - Jordi G. H.
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave

InputMat.txt (1K) Download Attachment
InputVec.txt (28 bytes) Download Attachment
ResultFriend.txt (246 bytes) Download Attachment
ResultOctave.txt (264 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

R: Re: Re: Modify machine precision

John W. Eaton
Administrator
On 29-Mar-2012, alberto frigerio wrote:

| Is there a way to say
| Octave "Look, I don't want eps to be your default value no more, please use for
| the function I'm running now this neweps value" ?

No.

jwe
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Modify machine precision

Jordi Gutiérrez Hermoso-2
In reply to this post by AlbFrigerio
On 29 March 2012 11:30, alberto frigerio
<[hidden email]> wrote:
> eps is the smallest number so that alpha + eps <> alpha. Is there a
> way to say Octave "Look, I don't want eps to be your default value
> no more, please use for the function I'm running now this neweps
> value" ?

No, not if you want to perform these computations in hardware anymore.
If you want to perform them in software, which is slower, you have to
use different software.

- Jordi G. H.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

R: Re: Re: Re: Modify machine precision

AlbFrigerio
'Right, thanks everyone and sorry for bothering you all.

Have a nice day,

  Alberto

Il 29/03/12, Jordi Gutiérrez Hermoso <[hidden email]> ha scritto:
On 29 March 2012 11:30, alberto frigerio
<[hidden email]> wrote:
> eps is the smallest number so that alpha + eps <> alpha. Is there a
> way to say Octave "Look, I don't want eps to be your default value
> no more, please use for the function I'm running now this neweps
> value" ?

No, not if you want to perform these computations in hardware anymore.
If you want to perform them in software, which is slower, you have to
use different software.

- Jordi G. H.

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave