[Glass] Is there a way to print a Float with all decimals but without exponential notation?

Mariano Martinez Peck marianopeck at gmail.com
Mon Mar 3 05:46:24 PST 2014


Hi guys.

I am exporting some data to a CSV file and I am finding some differences
with Pharo. For my use-case, I would like to:

- Print all decimals of the float
- do not round
- do not show exponential notation

#greaseString (or doing self printOn: strm base: 10.) rounds the string.
For example:

19896.800000000003 greaseString
-> '19896.8'

while in Pharo I get (what I want)

19896.800000000003 greaseString
-> '19896.800000000003'


#asStringUsingFormat: allows me to NOT use exponential notion..but I am
forced to define the first and second parameter as well :(

#asString shows me all decimals but it uses the exponential notion:

19896.800000000003 asString
-> '1.9896800000000003E+04'


So what I need is a kind of #asString but not using exponential notion. Is
that possible?


Thanks in advance,

On Mon, Mar 3, 2014 at 10:42 AM, Mariano Martinez Peck <
marianopeck at gmail.com> wrote:

> Hi guys.
>
> I am exporting some data to a CSV file and I am finding some differences
> with Pharo. For my use-case, I would like to:
>
> - Print all decimals of the float
> - do not round
> - do not show exponential notation
>
> #greaseString (or doing self printOn: strm base: 10.) rounds the string.
> For example:
>
> 19896.800000000003 greaseString
> '19896.8'
>
> while in Pharo I get
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20140303/3c96df27/attachment.html>


More information about the Glass mailing list