[scilab-Users] Integer to string - excluding scientific notation

Mathieu Dubois mathieu.dubois at limsi.fr
Fri Dec 9 18:44:39 CET 2011


Hello,

I see 2 options.

First you can change the format with which the data are displayed (see 
help('format')).
For instance:
-->c=3e8
  c  =
     3.000D+08
-->string(c)
  ans  =
  3.000D+08
-->format(15) // Display more digits
-->c
  c  =
     300000000.

Second you can generate the string with mprintf and related function 
(see help('mprintf')):
-->mprintf("%d", c)
300000000

I prefer the second option because you won't need to use format at every 
startup.

HTH,
Mathieu

On 12/09/2011 06:11 PM, lukeaarond wrote:
> I have a large number that I save as an integer. Whenever I access that
> number it comes out in scientific notation. It is fine because scilab always
> remembers what the actual integer is, however, when I save it as a string it
> only remembers the scientific notation which ends up rounding the number.
> See the following:
>
> -->numb1=127015695
>   numb1  =1.270D+08
>
> -->ShowScilabRemembers=numb1-127000000
>   ShowScilabRemembers  =15695.
>
> -->String1=string(numb1)
>   String1  =1.270D+08
>
> -->ShowRounded=evstr(String1)-127000000
>   ShowRounded  =0.
>
> How to I make scilab save the number as a string without using the
> scientific notation?
>
> Thank you.
>
> --
> View this message in context: http://mailinglists.scilab.org/Integer-to-string-excluding-scientific-notation-tp3573472p3573472.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.




More information about the users mailing list