Changeset 516e780 in mainline for uspace/lib/math/generic/fabs.c
- Timestamp:
- 2018-08-31T11:55:41Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fa86fff
- Parents:
- 7f7d642
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-08-31 11:55:41)
- git-committer:
- GitHub <noreply@…> (2018-08-31 11:55:41)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/math/generic/fabs.c
r7f7d642 r516e780 1 1 /* 2 * Copyright (c) 201 5 Jiri Svoboda2 * Copyright (c) 2014 Martin Decky 3 3 * All rights reserved. 4 4 * … … 34 34 35 35 #include <math.h> 36 #include <fabs.h>37 36 38 /** Absolute value (32-bit floating point) 39 * 40 * Compute absolute value. 41 * 42 * @param arg Argument. 43 * 44 * @return Absolute value. 45 * 46 */ 47 float32_t float32_fabs(float32_t arg) 37 float fabsf(float val) 48 38 { 49 if (arg < 0.0) 50 return -arg; 51 else 52 return arg; 39 return copysignf(val, 1.0f); 53 40 } 54 41 55 /** Absolute value (64-bit floating point) 56 * 57 * Compute absolute value. 58 * 59 * @param arg Argument. 60 * 61 * @return Absolute value. 62 * 63 */ 64 float64_t float64_fabs(float64_t arg) 42 double fabs(double val) 65 43 { 66 if (arg < 0.0) 67 return -arg; 68 else 69 return arg; 44 return copysign(val, 1.0); 70 45 } 71 46
Note:
See TracChangeset
for help on using the changeset viewer.