float.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _PICO_FLOAT_H
8#define _PICO_FLOAT_H
9
10#include <math.h>
11#include <float.h>
12#include "pico.h"
13#include "pico/bootrom/sf_table.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
42float int2float(int32_t f);
43float uint2float(uint32_t f);
44float int642float(int64_t f);
45float uint642float(uint64_t f);
46float fix2float(int32_t m, int e);
47float ufix2float(uint32_t m, int e);
48float fix642float(int64_t m, int e);
49float ufix642float(uint64_t m, int e);
50
51// These methods round towards -Infinity.
52int32_t float2fix(float f, int e);
53uint32_t float2ufix(float f, int e);
54int64_t float2fix64(float f, int e);
55uint64_t float2ufix64(float f, int e);
56int32_t float2int(float f);
57uint32_t float2uint(float f);
58int64_t float2int64(float f);
59uint64_t float2uint64(float f);
60
61// These methods round towards 0.
62int32_t float2int_z(float f);
63int64_t float2int64_z(float f);
64int32_t float2uint_z(float f);
65int64_t float2uint64_z(float f);
66
67float exp10f(float x);
68void sincosf(float x, float *sinx, float *cosx);
69float powintf(float x, int y);
70
71#if !PICO_RP2040 || PICO_COMBINED_DOCS
72int64_t float2fix64_z(float f, int e);
73float fdiv_fast(float n, float d);
74float fsqrt_fast(float f);
75#endif
76
77#ifdef __cplusplus
78}
79#endif
80
81#endif