---
title: "When should I use double instead of decimal?"  
description: "When should I use double instead of decimal?"  
author: "Revati S Misra"  
published: 2023-08-18  
updated: 2023-08-19  
canonical: https://www.mindstick.com/forum/159582/when-should-i-use-double-instead-of-decimal  
category: "c#"  
tags: ["c#", ".net", "Data Types"]  
reading_time: 2 minutes  

---

# When should I use double instead of decimal?

When should I use double [instead of](https://www.mindstick.com/articles/330/triggers-in-sql-server) [decimal](https://www.mindstick.com/forum/34709/please-write-a-program-for-decimal-to-binary-conversion-in-c-sharp)?

## Replies

### Reply by Aryan Kumar

In Java, you should use `double` instead of `decimal` when you need to store a floating-point number with more precision than `decimal` can offer.

- `double` is a 64-bit floating-point number, while `decimal` is a 16-bit floating-point number. This means that `double` can store numbers with more precision than `decimal`.
- `double` is also more efficient than `decimal` for storing large numbers.

Here is a table summarizing the differences between `double` and `decimal` in Java:

| Feature | double | decimal |
| --- | --- | --- |
| Precision | 64 bits | 16 bits |
| Range | ±1.7976931348623157e+308 | ±3.4028234663852886e+38 |
| Efficiency | More efficient for storing large numbers | Less efficient for storing large numbers |

In general, you should use `double` when you need to store a floating-point number with more precision than `decimal` can offer. You should use `decimal` when you need to store a floating-point number with a fixed precision, such as currency.

Here are some examples of when you should use `double` instead of `decimal`:

- Storing the value of pi
- Storing the weight of an object in grams
- Storing the temperature in Celsius
- Storing the area of a circle in square meters

Here are some examples of when you should use `decimal`:

- Storing the price of an item in dollars
- Storing the balance of an account in cents
- Storing the interest rate on a loan in percent
- Storing the exchange rate between two currencies


---

Original Source: https://www.mindstick.com/forum/159582/when-should-i-use-double-instead-of-decimal

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
