Changeset 9adb61d in mainline for uspace/lib/math/generic/ceil.c
- Timestamp:
- 2015-09-05T11:50:00Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 996dc042, ba8eecf
- Parents:
- e6f5766
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/math/generic/ceil.c
re6f5766 r9adb61d 34 34 35 35 #include <ceil.h> 36 #include <math.h> 36 37 #include <mathtypes.h> 37 #include <trunc.h>38 38 39 /** Ceiling (round towards positive infinity) 39 /** Ceiling (round towards positive infinity, 32-bit floating point) 40 * 41 * @param val Floating point number. 42 * 43 * @return Number rounded towards positive infinity. 44 */ 45 float32_t float32_ceil(float32_t val) 46 { 47 float32_u t; 48 float32_u v; 49 float32_u r; 50 51 v.val = val; 52 t.val = trunc_f32(val); 53 54 if (v.data.parts.sign == 1 || val == t.val) { 55 r = t; 56 } else { 57 r.val = t.val + 1.0; 58 } 59 60 return r.val; 61 } 62 63 /** Ceiling (round towards positive infinity, 64-bit floating point) 40 64 * 41 65 * @param val Floating point number. … … 50 74 51 75 v.val = val; 52 t.val = float64_trunc(val);76 t.val = trunc_f64(val); 53 77 54 78 if (v.data.parts.sign == 1 || val == t.val) {
Note:
See TracChangeset
for help on using the changeset viewer.