From: ananda on
how can i reduce the precision of an floating point number???
please any one help me...
From: dpb on
ananda wrote:
> how can i reduce the precision of an floating point number???
> please any one help me...

for what definition of "reduce" and "precision", pray tell?

context, context, context...

single() is one way from default doubles, floor() will certainly have an
effect is another.

Otoh, if one is simply talking about _displayed_ precision and not
internal, there are various ways that include formatting in output
statements or num2str() or the various options in the format command for
the command window.

Not sure which of those (if any) is what is desired...

--
From: Walter Roberson on
dpb wrote:
> ananda wrote:
>> how can i reduce the precision of an floating point number???
>> please any one help me...
>
> for what definition of "reduce" and "precision", pray tell?
>
> context, context, context...
>
> single() is one way from default doubles, floor() will certainly have an
> effect is another.

And adding a random number to the result would have yet another effect.

(Don't laugh -- taking a random offset around coordinates is a technique used
to try to get out of local minima in some minimization techniques. If you
think about such a situation, you will see that it could well be said that in
that situation the existing values are "too precise" (too narrow of a minima)
and random offsets give you a controlled method of probing the "nearby"
neighbourhood.)
 | 
Pages: 1
Prev: DATA TYPES
Next: Optimization of function