Rev | Line | |
---|
[4271] | 1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
| 2 | * Qwt Widget Library
|
---|
| 3 | * Copyright (C) 1997 Josef Wilgen
|
---|
| 4 | * Copyright (C) 2002 Uwe Rathmann
|
---|
| 5 | *
|
---|
| 6 | * This library is free software; you can redistribute it and/or
|
---|
| 7 | * modify it under the terms of the Qwt License, Version 1.0
|
---|
| 8 | *****************************************************************************/
|
---|
| 9 |
|
---|
| 10 | #include "qwt_math.h"
|
---|
| 11 |
|
---|
| 12 | /*!
|
---|
| 13 | \brief Find the smallest value in an array
|
---|
| 14 | \param array Pointer to an array
|
---|
| 15 | \param size Array size
|
---|
| 16 | */
|
---|
| 17 | double qwtGetMin( const double *array, int size )
|
---|
| 18 | {
|
---|
| 19 | if ( size <= 0 )
|
---|
| 20 | return 0.0;
|
---|
| 21 |
|
---|
| 22 | double rv = array[0];
|
---|
| 23 | for ( int i = 1; i < size; i++ )
|
---|
| 24 | rv = qMin( rv, array[i] );
|
---|
| 25 |
|
---|
| 26 | return rv;
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | /*!
|
---|
| 31 | \brief Find the largest value in an array
|
---|
| 32 | \param array Pointer to an array
|
---|
| 33 | \param size Array size
|
---|
| 34 | */
|
---|
| 35 | double qwtGetMax( const double *array, int size )
|
---|
| 36 | {
|
---|
| 37 | if ( size <= 0 )
|
---|
| 38 | return 0.0;
|
---|
| 39 |
|
---|
| 40 | double rv = array[0];
|
---|
| 41 | for ( int i = 1; i < size; i++ )
|
---|
| 42 | rv = qMax( rv, array[i] );
|
---|
| 43 |
|
---|
| 44 | return rv;
|
---|
| 45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.