Changeset 516e780 in mainline for uspace/lib/math/generic/__fpclassify.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 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/math/generic/__fpclassify.c
r7f7d642 r516e780 1 1 /* 2 * Copyright (c) 201 5 Jiri Svoboda2 * Copyright (c) 2018 CZ.NIC, z.s.p.o. 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libmath 30 * @{ 29 #include <math.h> 30 #include <stdarg.h> 31 32 /** 33 * Fallback symbol used when code including <math.h> is compiled with something 34 * other than GCC or Clang. The function itself must be built with GCC or Clang. 31 35 */ 32 /** @file 33 */ 36 int __fpclassify(size_t sz, ...) 37 { 38 va_list ap; 39 va_start(ap, sz); 34 40 35 #include <math.h> 36 #include <sqrt.h> 41 int result; 37 42 38 /** Single precision square root 39 * 40 * Compute square root. 41 * 42 * @param val Value 43 * 44 * @return Square root. 45 * 46 */ 47 float32_t float32_sqrt(float32_t val) 48 { 49 return pow_f32(val, 0.5); 43 switch (sz) { 44 case 4: 45 result = fpclassify((float) va_arg(ap, double)); 46 break; 47 case 8: 48 result = fpclassify(va_arg(ap, double)); 49 break; 50 default: 51 result = fpclassify(va_arg(ap, long double)); 52 break; 53 } 54 55 va_end(ap); 56 return result; 50 57 } 51 58 52 /** Double precision square root53 *54 * Compute squre root.55 *56 * @param val Value57 *58 * @return Square root.59 *60 */61 float64_t float64_sqrt(float64_t val)62 {63 return pow_f64(val, 0.5);64 }65 66 /** @}67 */
Note:
See TracChangeset
for help on using the changeset viewer.