home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------
- * filename - ceill.cas
- *
- * function(s)
- * ceill - rounds up a long double
- *-----------------------------------------------------------------------*/
-
- /*
- * C/C++ Run Time Library - Version 5.0
- *
- * Copyright (c) 1987, 1992 by Borland International
- * All Rights Reserved.
- *
- */
-
-
- #pragma inline
- #include <asmrules.h>
-
- #include <_math.h>
- #include <math.h>
-
-
- /*--------------------------------------------------------------------------*
-
- Name ceill - rounds up
-
- Usage long double ceill(long double x);
-
- Prototype in math.h
-
- Description ceill finds the smallest integer not less than x.
-
- Return value ceill returns the integer found as a long double.
-
- *---------------------------------------------------------------------------*/
- #pragma warn -rvl
- long double _FARFUNC ceill (long double x)
- {
- asm FLD LONGDOUBLE (x)
-
- asm mov ax, x [8]
- asm and ax, 7FFFh
- asm cmp ax, 3FFFh + 64 /* 2^64, maximum long double precision */
- asm ja dlm_beyond
-
- asm mov ch,08h /* iNDP-87 control bits for ceiling mode */
- __round();
-
- dlm_beyond: /* magnitudes beyond 2^64 have no fraction */
- dlm_end:
- return;
- }
- #pragma warn .rvl
-