problem with std.variant rounding

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 2 01:02:23 PDT 2017


On Saturday, 29 April 2017 at 08:57:09 UTC, Petar Kirov 
[ZombineDev] wrote:
> On Friday, 28 April 2017 at 18:08:38 UTC, H. S. Teoh wrote:
>> On Fri, Apr 28, 2017 at 04:42:28PM +0000, via 
>> Digitalmars-d-learn wrote: [...]
>>>         writefln(text("%.", i, "f"), x);
>> [...]
>>
>> There's no need to use text() here:
>>
>> 	writefln("%.*f", i, x);
>>
>> does what you want.
>>
>>
>> T
>
> Thanks, I missed the fact that * could be used for specifying 
> the precision, in addition to the width.

I need co concatenate string with variant type (I am doing SQL 
query).

What is the best way to put it? It's seems that if I am doing 
simple `replace`

string sql = "..."
sql.replace(`37.72308`, 
to!string(cargpspoint.lon)).replace(`55.47957`, 
to!string(cargpspoint.lat))

I am loosing accuracy. Is there any better way?


More information about the Digitalmars-d-learn mailing list