RWalib C Array Library User Guide > Rounding Operations > alibCeil
  

alibCeil
Applies the ceil function to each element of an array. The PV-WAVE API for this routine is the SMALL_INT Function.
Prototypes
void alibCeilf( wvlong n, float *p, float *r )
void alibCeild( wvlong n, double *p, double *r )
Parameters
n — (Input) The number of elements in the array.
*p — (Input) The n-element source array.
*r — (Input/Output) The destination array. On return, r[i] = ceil(p[i]). This operation can be done in-place, i.e., r can equal p.
Example
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alib.h"
void main() {
   /* make up some data for the examples */
   float  f0[5]={-1.75,-0.5,0.25,2,2.25}, *f;
   /* make output array */
   f = (float*)malloc(5*sizeof(float));
   printf( "\n\n show array f0" );
      alibinit( NULL, NULL, NULL, NULL );
      alibPrintArrayf( 1, 1, 1, 5, f0, NULL );
   printf( "\n\n show the ceiling of each element in f0" );
      alibCeilf( 5, f0, f );
      alibPrintArrayf( 1, 1, 1, 5, f, NULL );
}
 
Output:
 
 show array f0
 
  -1.750e+00  -5.000e-01   2.500e-01   2.000e+00   2.250e+00
 
 show the ceiling of each element in f0
 
  -1.000e+00  -0.000e+00   1.000e+00   2.000e+00   3.000e+00

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.