From 8145ba753df183f0d48cd6e9cc5a01b215eb31dc Mon Sep 17 00:00:00 2001 From: Julian Weigt Date: Fri, 16 Jan 2026 13:41:52 +0100 Subject: Properly use header files and change return type for conversion from bool to int. --- ratio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ratio.c') diff --git a/ratio.c b/ratio.c index 3bb5ef3..bf428ec 100644 --- a/ratio.c +++ b/ratio.c @@ -135,14 +135,14 @@ double to_double(rational r){ return i*((double)r.n)/((double)r.d); } -bool to_string(char* s, rational r){ +int to_string(char* s, rational r){ double f = to_double(r); sprintf(s,"%llu / %llu = %f… +/- %6.1e",r.n,r.d,f,f*DBL_EPSILON); - return true; + return 0; } -bool root_to_string(char* s, rational r, unsigned int p){ +int root_to_string(char* s, rational r, unsigned int p){ double f = pow(to_double(r),1.0/p); sprintf(s,"(%llu / %llu)^1/%i = %f… +/- %6.1e",r.n,r.d,p,f,2*DBL_EPSILON*f); - return true; + return 0; } -- cgit v1.2.3