source: mainline/uspace/lib/math/arch/amd64/include/libarch/math.h@ bae1e1f

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since bae1e1f was bae1e1f, checked in by Jiri Svoboda <jiri@…>, 10 years ago

floor() and ceil().

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 * Copyright (c) 2014 Martin Decky
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup libmathamd64
30 * @{
31 */
32/** @file
33 */
34
35#ifndef LIBMATH_amd64_MATH_H_
36#define LIBMATH_amd64_MATH_H_
37
38#include <ceil.h>
39#include <floor.h>
40#include <mathtypes.h>
41#include <mod.h>
42
43static inline float64_t fmod(float64_t dividend, float64_t divisor)
44{
45 return float64_mod(dividend, divisor);
46}
47
48extern float64_t sin(float64_t);
49extern float64_t cos(float64_t);
50
51static inline float64_t ceil(float64_t val)
52{
53 float64_u arg;
54 arg.val = val;
55
56 float64_u ret;
57 ret.data = ceil_float64(arg.data);
58
59 return ret.val;
60}
61
62static inline float64_t floor(float64_t val)
63{
64 float64_u arg;
65 arg.val = val;
66
67 float64_u ret;
68 ret.data = floor_float64(arg.data);
69
70 return ret.val;
71}
72
73extern float64_t trunc(float64_t);
74
75#endif
76
77/** @}
78 */
Note: See TracBrowser for help on using the repository browser.