From 942a6711361c371da0736cc62f0e3e2ed13f341b Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Fri, 28 Feb 2025 21:01:26 -0500 Subject: fraction/percent conversion functions --- unit.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'unit.c') diff --git a/unit.c b/unit.c index 9e03abf..de24dc3 100644 --- a/unit.c +++ b/unit.c @@ -45,8 +45,16 @@ double as_rpm(AngularSpeed x) { return x * 60.0 / (2.0 * M_PI); } -Fraction percent(double x); -double as_percent(Fraction x); + +Fraction +percent(double x) { + return x / 100.0; +} + +double +as_percent(Fraction x) { + return x * 100.0; +} Pressure -- cgit v1.2.3