0
Besvaret
Exchanging a value in a double precision array
Hello.
I am not sure if the following is really intended:
Adding a mp number to a double number:
a=mp('1.1');
b=1.1;
test=a+b;
The variable test is a mp number, so the variable 'b' was cast to mp.
If I assign a mp number to a double array, it will be cast to double.
A=1:10;
A(1,1)=A(1,1)+a;
The array A is still double.
Probably this is done intentionally, but I think it was different in an older version. (I have the newest one)
Best regards,
Michael
I am not sure if the following is really intended:
Adding a mp number to a double number:
a=mp('1.1');
b=1.1;
test=a+b;
The variable test is a mp number, so the variable 'b' was cast to mp.
If I assign a mp number to a double array, it will be cast to double.
A=1:10;
A(1,1)=A(1,1)+a;
The array A is still double.
Probably this is done intentionally, but I think it was different in an older version. (I have the newest one)
Best regards,
Michael
Kundesupport af UserEcho
In case of scalar operands - MATLAB casts to more powerful or custom type.
In case of arrays - the scalar RHS entity is converted to LHS type.
Actually it is a good solution. Otherwise, the whole array A would be converted to 'double' in the case:
A=mp(1:10)
A(1,1)=10;
% A becomes 'double' !
This would be much more unexpected behavior, isn't it?
You might notice some speed-up for large matrices (~10-15%).