strange parsing Double behaviour...

Posted by Cristian Boariu on Stack Overflow See other posts from Stack Overflow or by Cristian Boariu
Published on 2010-05-17T20:14:29Z Indexed on 2010/05/17 20:20 UTC
Read the original article Hit count: 221

Filed under:

Hi,

I have this line of code:

return (this.pretWithoutDiscount / Double.Parse(UtilsStatic.getEuroValue())).ToString("N2") + "€";

In debug mode i've tested and the values are:

UtilsStatic.getEuroValue() = "4.1878"

this.pretWithoutDiscount = 111.0

Can anyone explaing WHY:

Double.Parse(UtilsStatic.getEuroValue()) = 41878.0

when it should be 4.1878 ??

Thanks...

PS: UtilsStatic.getEuroValue returns a string.

© Stack Overflow or respective owner

Related posts about c#