[CHANGESET]: First attempt at a single precision type.

David Bateman David.Bateman at motorola.com
Mon Apr 28 05:11:21 CDT 2008


Jaroslav Hajek wrote:
> There is also an alternative view: a user may be used to do
> calculations in double precision
> (most users are), but he may get a single-precision result from
> external data read or calculation that just uses single precision, and
> the lower precision will then "infect" a whole chain of calculations,
> and things may break up (for instance, Infs may suddenly appear in a
> calculation).
> For instance, I dislike the idea of ppval called with double
> coefficients on single input converting first the coefficients into
> single; that's not what I would expect it to do.
> (and it will be much slower
>   
I don't disagree with the precision argument, just that I see the logic
behind mathworks choice as well even if its a logic based on
practicality rather than mathematical correctness. I'll wait for a
consensus (ie John's opinion) and do it that way.

> This seems logical to me. In indexed assignment, the type of lhs
> should not be changed,
> because you expect the non-indexed elements to remain intact.
>
> But it leads to another interesting point:
> unlike Matlab, Octave has +=, -= etc.
> In the following expressions with A double matrix and x single scalar,
> what should the type of A be?
> A += x; % A = A + x  ==> single ???
> A(:,1) += x; % A(:,1) = A(:,1) + x   ==> double, due to the indexing ???
>   
Yes, at least if we accept matlab's demotion to single and subsasgn
behavior.. This is logical as the a+=b is short-hand for a=a+b...


D.

-- 
David Bateman                                David.Bateman at motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



More information about the Octave-maintainers mailing list