Changeset 9adb61d in mainline for uspace/lib/math/generic/mod.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/mod.c
re6f5766 r9adb61d 36 36 #include <mod.h> 37 37 38 /** Double precision modulo 38 /** Remainder function (32-bit floating point) 39 * 40 * Calculate the modulo of dividend by divisor. 41 * 42 * This is a very basic implementation that uses 43 * division and multiplication (instead of exact 44 * arithmetics). Thus the result might be very 45 * imprecise (depending on the magnitude of the 46 * arguments). 47 * 48 * @param dividend Dividend. 49 * @param divisor Divisor. 50 * 51 * @return Modulo. 52 * 53 */ 54 float32_t float32_mod(float32_t dividend, float32_t divisor) 55 { 56 // FIXME: replace with exact arithmetics 57 58 float32_t quotient = trunc_f32(dividend / divisor); 59 60 return (dividend - quotient * divisor); 61 } 62 63 /** Remainder function (64-bit floating point) 39 64 * 40 65 * Calculate the modulo of dividend by divisor. … … 56 81 // FIXME: replace with exact arithmetics 57 82 58 float64_t quotient = trunc (dividend / divisor);83 float64_t quotient = trunc_f64(dividend / divisor); 59 84 60 85 return (dividend - quotient * divisor);
Note:
See TracChangeset
for help on using the changeset viewer.