# Calculations

Page 1 of 1

## 5 Replies - 713 Views - Last Post: 05 October 2012 - 03:27 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=294365&amp;s=e9ad41d3b6977028b426e9ba9f591365&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 krakatoa

Reputation: 0
• Posts: 30
• Joined: 04-October 12

# Calculations

Posted 05 October 2012 - 02:07 AM

Hello. I have a problem displaying double values, it removes 0 in front. For example answer should be 0.14 and it gives me 141.37.
Is This A Good Question/Topic? 0

## Replies To: Calculations

### #2 janne_panne

• WinRT Dev

Reputation: 428
• Posts: 1,047
• Joined: 09-June 09

## Re: Calculations

Posted 05 October 2012 - 02:28 AM

Without seeing your code it's impossible to tell what's wrong. Sure we could throw guesses but that's not worth it.

### #3 sepp2k

• D.I.C Lover

Reputation: 2610
• Posts: 4,163
• Joined: 21-June 11

## Re: Calculations

Posted 05 October 2012 - 02:32 AM

If it just cut off "0.", the result would be 14137, not 141.37, right (assuming the number in question was really 0.14137 - not just 0.14)? It looks more like the result got multiplied by 1000 somewhere.

But as Janne_panne said, it's impossible for us to tell you how that happened without seeing your code.

### #4 krakatoa

Reputation: 0
• Posts: 30
• Joined: 04-October 12

## Re: Calculations

Posted 05 October 2012 - 03:07 AM

For example
```
private void button1_Click(object sender, EventArgs e)
{
double x = Convert.ToDouble(textBox1.Text);
double y = Convert.ToDouble(textBox2.Text);
textBox3.Text = Convert.ToString(x+y);
}

```

0.6 + 0.5 i am getting 11

### #5 sepp2k

• D.I.C Lover

Reputation: 2610
• Posts: 4,163
• Joined: 21-June 11

## Re: Calculations

Posted 05 October 2012 - 03:23 AM

So you enter 0.6 and 0.5 in textBox1 and textBox2 respectively? What's your system's locale?

Conversions to and from strings are locale-sensitive by default. If your system's locale that uses commas instead of dots as the decimal separator, you'll need to enter the numbers as 0,6 and 0,5 or you'll need to tell the conversion methods to use a different locale.

### #6 krakatoa

Reputation: 0
• Posts: 30
• Joined: 04-October 12

## Re: Calculations

Posted 05 October 2012 - 03:27 AM

Thanks, with "," it works