gold-melt-value 0.1.0

Compute precious-metal melt value by karat, weight, and live spot price (gold, silver).
Documentation
  • Coverage
  • 61.54%
    8 out of 13 items documented1 out of 6 items with examples
  • Size
  • Source code size: 6.62 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 293.72 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • theluckystrike

gold-melt-value

crates.io docs.rs

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 live gold calculator, which shows the price of gold per gram by karat.

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

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 and the 14k gold price per gram page.

License: MIT