COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### How do you force decimal output?

• Email
• Follow

```How do you force answers to be displayed in decimal format instead of as a fraction?  Here is an example
syms CD
>> cross(ac,CD*Ucd)
ans =
[ (23089284507395629*CD)/144115188075855872, (43129010120971187*CD)/450359962737049600, (14811997678849777*CD)/56294995342131200]

Eval often works but not always,

eval(ans)
ans =
[ (5772321126848907*CD)/36028797018963968, (2695563132560699*CD)/28147497671065600, (925749854928111*CD)/3518437208883200]

It is a different fraction, but still a fraction.

Thanks.
Tom
```
 0

See related articles to this posting

```Tom wrote:
> How do you force answers to be displayed in decimal format instead of as
> a fraction?  Here is an example
> syms CD
>>> cross(ac,CD*Ucd)
> ans =
> [ (23089284507395629*CD)/144115188075855872,
> (43129010120971187*CD)/450359962737049600,
> (14811997678849777*CD)/56294995342131200]

vpa() for specific decimal precision, or double() for binary floating point
```
 0

1 Replies
921 Views

Similar Articles

12/6/2013 9:05:58 AM
page loaded in 41246 ms. (0)