Skip to content

Commit ad5153e

Browse files
committed
fix: calculation for area in miles
1 parent a686e7f commit ad5153e

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v0.1.7 - Thu, 6 March 2025
2+
3+
- Fix calculation for area in miles
4+
15
# v0.1.6 - Thu, 6 March 2025
26

37
- Use correct units for area

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

countryfetch/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "countryfetch"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
edition = "2024"
55
repository = "https://github.com/nik-rev/countryfetch"
66
homepage = "https://github.com/nik-rev/countryfetch"

countryfetch/src/country_format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ pub fn format_country(
315315
.then_some(country.map_or(gen_country.emoji(), |c| c.emoji.as_str())),
316316
area_km: (!args.no_area).then_some(country.map_or(gen_country.area_km(), |c| c.area_km)),
317317
// rounds to the nearest 100
318-
area_mi: (!args.no_area).then_some((area_km * 0.62137 * 0.01).round() / 0.01),
318+
area_mi: (!args.no_area).then_some((area_km * (0.62137_f64.powi(2)) * 0.01).round() / 0.01),
319319
country_name: country.map_or(
320320
gen_country.country_name(),
321321
super::country::Country::country_name,

0 commit comments

Comments
 (0)