Changeset 83932dc9 in mainline for uspace/lib/math/generic/fmod.c
- Timestamp:
- 2018-09-12T16:51:07Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b2aaaa0
- Parents:
- ec9aadd
- git-author:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-09-12 16:50:02)
- git-committer:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-09-12 16:51:07)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/math/generic/fmod.c
rec9aadd r83932dc9 35 35 #include <math.h> 36 36 37 /** Remainder function (32-bit floating point)38 *39 * Calculate the modulo of dividend by divisor.40 *41 * This is a very basic implementation that uses42 * division and multiplication (instead of exact43 * arithmetics). Thus the result might be very44 * imprecise (depending on the magnitude of the45 * arguments).46 *47 * @param dividend Dividend.48 * @param divisor Divisor.49 *50 * @return Modulo.51 *52 */53 float fmodf(float dividend, float divisor)54 {55 // FIXME: replace with exact arithmetics56 57 float quotient = truncf(dividend / divisor);58 59 return (dividend - quotient * divisor);60 }61 62 37 /** Remainder function (64-bit floating point) 63 38 *
Note:
See TracChangeset
for help on using the changeset viewer.