LP-89 - Port OP_15.05.01 fixes. Release notes:
[librepilot.git] / flight / libraries / PyMite / vm / float.h
blob2091f970916e5b9165a359c5173e700ea07f2083
1 /*
2 # This file is Copyright 2009, 2010 Dean Hall.
4 # This file is part of the PyMite VM.
5 # The PyMite VM is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2.
8 # The PyMite VM is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # A copy of the GNU GENERAL PUBLIC LICENSE Version 2
12 # is seen in the file COPYING in this directory.
16 #ifndef __FLOAT_H__
17 #define __FLOAT_H__
20 /**
21 * \file
22 * \brief Float Object Type
24 * Float object type header.
28 /**
29 * Float obj
31 * 32b floating point number
33 typedef struct PmFloat_s
35 /** Object descriptor */
36 PmObjDesc_t od;
38 /** Float value */
39 float val;
40 } PmFloat_t, *pPmFloat_t;
43 #ifdef HAVE_FLOAT
45 /**
46 * Creates a new Float object
48 * @param f Value to assign float (signed 32-bit).
49 * @param r_pint Return by ref, ptr to new float
50 * @return Return status
52 PmReturn_t float_new(float f, pPmObj_t *r_pf);
54 /**
55 * Implements the UNARY_NEGATIVE bcode.
57 * Creates a new float with a value that is the negative of the given float.
59 * @param pobj Pointer to target object
60 * @param r_pint Return by ref, ptr to float
61 * @return Return status
63 PmReturn_t float_negative(pPmObj_t pf, pPmObj_t *r_pf);
65 /**
66 * Returns by reference a float that is x op y.
68 * @param px The float left-hand argument
69 * @param py The float right-hand argument
70 * @param r_pn The return value of x op y
71 * @param op The operator (+,-,*,/ and power)
72 * @return Return status
74 PmReturn_t float_op(pPmObj_t px, pPmObj_t py, pPmObj_t *r_pn, int8_t op);
76 /**
77 * Returns by reference a boolean that is x op y.
79 * @param px The float left-hand argument
80 * @param py The float right-hand argument
81 * @param r_pn The return value of x cmp y
82 * @param cmp The comparison operator
83 * @return Return status
85 PmReturn_t float_compare(pPmObj_t px, pPmObj_t py, pPmObj_t *r_pobj,
86 PmCompare_t cmp);
88 #ifdef HAVE_PRINT
89 /**
90 * Sends out a float object.
91 * The number is preceded with a "-" when necessary.
93 * @param pObj Ptr to float object
94 * @return Return status
96 PmReturn_t float_print(pPmObj_t pf);
98 #endif /* HAVE_PRINT */
100 #endif /* HAVE_FLOAT */
102 #endif /* __FLOAT_H__ */