ttyplot

Realtime terminal plotter
git clone git://git.sgregoratto.me/ttyplot
Log | Files | Refs | README | LICENSE

commit db211e4dcdfb3f27bc8359c0d439c0bb237618b6
parent 52d59dc207734ae83a8d5c4fa3967ebf3b6abc35
Author: Antoni Sawicki <tenox@google.com>
Date:   Sun,  5 May 2019 02:04:40 -0700

geminmax in one loop instad of 3

Diffstat:
Mttyplot.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ttyplot.c b/ttyplot.c @@ -51,16 +51,15 @@ void getminmax(int pw, int n, double *values, double *min, double *max, double * *max=FLT_MIN; tot=FLT_MIN; - for(i=0; i<pw; i++) + for(i=0; i<pw; i++) { if(values[i]>*max) *max=values[i]; - for(i=0; i<pw; i++) if(values[i]<*min) *min=values[i]; - for(i=0; i<pw; i++) tot=tot+values[i]; + } *avg=tot/pw; }