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

Martin McClure martin.mcclure at gemtalksystems.com
Tue Mar 4 11:39:43 PST 2014

> Hi Martin,
> Yes, that looks a bit clunky and probably slow? I am writing reports
> where I print lots of floats, so this may be important.
> Also, yes, my numbers can be negative and even between 0 and 1.0. Also,
> not only Float but SmallDouble as well....
> Wish there could be a simple method (primitive) to print all type of
> 64-bits floats without the exponential notion...
> For the moment I guess I will stay with the exponential :(

Hi Mariano,

Clunky it definitely is. Though the *real* algorithm would be a lot more 

But how slow is slow? How many is "lots" and how often do you need to 
print them? When it comes to performance, assumptions are very risky. I 
recommend trying it and testing what the performance is, rather than 
assuming it will be too slow. You can probably do that kind of test in 
half an hour or so.

SmallDouble and Float should be completely polymorphic (at least plenty 
polymorphic for this job), so you shouldn't have to worry about the 
difference. The handling of negative and 0 - 1 won't add much complexity.



More information about the Glass mailing list