[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Set value to a custom significance. (no display)
From: |
John W. Eaton |
Subject: |
Re: Set value to a custom significance. (no display) |
Date: |
Mon, 1 Mar 2010 14:09:09 -0500 |
On 1-Mar-2010, Judd Storrs wrote:
| First of all, the machine native floating point is base 2, not base 10
| so this is going to be an approximation. However, something like this
| may work by removing the remainder at each step:
|
| octave:1> format long
| octave:2> a = 0.499/2
| a = 0.249500000000000
| octave:3> a = round(100*a)/100
| a = 0.250000000000000
| octave:3> b = a * 2
| b = 0.500000000000000
| octave:4> b = round(100*b)/100
| b = 0.500000000000000
|
| You could use round, ceil or floor depending on how you want rounding to work.
I recently added a chop function:
http://hg.savannah.gnu.org/hgweb/octave/rev/27777bd27e71
But I have to ask: Why do you think you want to do this? What are
you trying to accomplish?
jwe