# gold-melt-value
[](https://crates.io/crates/gold-melt-value)
[](https://docs.rs/gold-melt-value)
Compute precious-metal **melt value** from karat (purity), weight, and a live spot
price. Pure, dependency-free Rust math — the same engine behind the
[GoldGramPrice](https://goldgramprice.com/) live gold calculator, which shows
[the price of gold per gram by karat](https://goldgramprice.com/14k-gold-price-per-gram/).
## Why
Gold is quoted per **troy ounce**, but most people hold it in **grams** and in mixed
**karats**, so the headline spot price is rarely what a given piece is worth. Melt
value = `grams × (karat/24) × (spot ÷ 31.1034768)`. This crate does that math (and
pennyweight / troy-ounce variants) with no dependencies.
## Usage
```rust
use gold_melt_value::{melt_value_grams, purity};
let spot_per_oz = 3983.30; // USD per troy ounce
let grams = 10.0; // a 10 g chain
let karat = 14;
let usd = melt_value_grams(grams, karat, spot_per_oz);
assert!((usd - 746.6).abs() < 0.1);
assert_eq!(purity(14), 14.0 / 24.0);
```
## Live calculator
For an interactive, always-fresh version with today's spot price built in, see the
[free gold melt-value calculator](https://goldgramprice.com/gold-calculator/) and the
[14k gold price per gram](https://goldgramprice.com/14k-gold-price-per-gram/) page.
License: MIT