help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disable Scientific Notation when using num2str function


From: James Sherman Jr.
Subject: Re: Disable Scientific Notation when using num2str function
Date: Wed, 24 Oct 2012 08:17:11 -0400

On Wed, Oct 24, 2012 at 7:25 AM, Juan Pablo Carbajal <address@hidden> wrote:
On Wed, Oct 24, 2012 at 1:11 PM, bobkarh <address@hidden> wrote:
> I am trying to convert a big number like :
>
> 12345678901234567890
>
> into a string by using:
>
> num2str(12345678901234567890)
>
> but the result is:
>
> ans = "1.2346e+019"
>
> That answer "ans" is a STRING with size :
> size [1 , 11]
> (one row, eleven columns)...and for example: value at column number two is
> "."
>
> SO I'VE LOST MY NUMBER!!!
> AND I DON'T WANT THIS!!!!!
>
> I want the original number to be a string
> ans= "12345678901234567890"
>
> I have tried to change format, using the function "format"
> but it doesn't work... I have also tried to change the built in variable:
> "fixed_point_format ()"
> but that doesn't work either....
>
> IS THERE A WAY TO CONVERT A LARGE NUMBER TO A LARGE STRING?????
>
>
>
>
>
> --
> View this message in context: http://octave.1599824.n4.nabble.com/Disable-Scientific-Notation-when-using-num2str-function-tp4645685.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

no need to SCREAM!!!
a = 1234567890;
sprintf("%.0f",a)
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave

I believe the problem you are having is that your numbers are so large that they require more bits than are available on your machine.  Thus, it can't represent that number without using floating point/scientific notation.  I'm not sure what you can do besides keep the number always as a string.
 
James Sherman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]