diff options
| author | Julian Weigt <juw@posteo.de> | 2026-01-16 13:41:52 +0100 |
|---|---|---|
| committer | Julian Weigt <juw@posteo.de> | 2026-02-04 15:55:53 +0100 |
| commit | 8145ba753df183f0d48cd6e9cc5a01b215eb31dc (patch) | |
| tree | 6ab91cd3774bb42d55c196db26387f67bf082da3 /ratio.c | |
| parent | 5c0dc646b78e2d7ef25088ac78397e2ed613cba1 (diff) | |
Properly use header files and change return type for conversion from bool to int.
Diffstat (limited to 'ratio.c')
| -rw-r--r-- | ratio.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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; } |
