Expand description
§gold-melt-value
Compute precious-metal melt value from karat (purity), weight, and a live spot price. Pure, dependency-free math — the same engine behind the GoldGramPrice live gold calculator.
§Quick example
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);
// 10 g of 14k contains ~5.83 g pure gold → melt ≈ $747.05
assert!((usd - 747.05).abs() < 0.05);
assert_eq!(purity(14), 14.0 / 24.0);Modules§
- karats
- Common karat purities used in jewelry (US).
Constants§
- GRAMS_
PER_ TROY_ OZ - Grams in one troy ounce (1 oz t = 31.1034768 g).
Functions§
- melt_
value_ dwt - Melt value for a weight in pennyweight (dwt). 1 dwt = 1/20 troy oz.
- melt_
value_ grams - Melt value (in the spot-price currency) for a given weight in grams,
karat, andspot_per_troy_oz. - melt_
value_ troy_ oz - Melt value for a weight in troy ounces (already in troy units).
- purity
- Decimal purity for a karat value (karat / 24).
- spot_
per_ gram - Spot price per gram of pure metal, derived from a per-troy-ounce quote.