Embed:
(wiki syntax)
Show/hide line numbers
float.h
Go to the documentation of this file.
00001 /* 00002 # This file is Copyright 2009 Dean Hall. 00003 # 00004 # This file is part of the PyMite VM. 00005 # The PyMite VM is free software: you can redistribute it and/or modify 00006 # it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2. 00007 # 00008 # The PyMite VM is distributed in the hope that it will be useful, 00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00011 # A copy of the GNU GENERAL PUBLIC LICENSE Version 2 00012 # is seen in the file COPYING in this directory. 00013 */ 00014 00015 00016 #ifndef __FLOAT_H__ 00017 #define __FLOAT_H__ 00018 00019 00020 /** 00021 * \file 00022 * \brief Float Object Type 00023 * 00024 * Float object type header. 00025 */ 00026 00027 00028 /** 00029 * Float obj 00030 * 00031 * 32b floating point number 00032 */ 00033 typedef struct PmFloat_s 00034 { 00035 /** Object descriptor */ 00036 PmObjDesc_t od; 00037 00038 /** Float value */ 00039 float val; 00040 } PmFloat_t, *pPmFloat_t; 00041 00042 00043 #ifdef HAVE_FLOAT 00044 00045 /** 00046 * Creates a new Float object 00047 * 00048 * @param f Value to assign float (signed 32-bit). 00049 * @param r_pint Return by ref, ptr to new float 00050 * @return Return status 00051 */ 00052 PmReturn_t float_new(float f, pPmObj_t *r_pf); 00053 00054 /** 00055 * Implements the UNARY_NEGATIVE bcode. 00056 * 00057 * Creates a new float with a value that is the negative of the given float. 00058 * 00059 * @param pobj Pointer to target object 00060 * @param r_pint Return by ref, ptr to float 00061 * @return Return status 00062 */ 00063 PmReturn_t float_negative(pPmObj_t pf, pPmObj_t *r_pf); 00064 00065 /** 00066 * Returns by reference a float that is x op y. 00067 * 00068 * @param px The float left-hand argument 00069 * @param py The float right-hand argument 00070 * @param r_pn The return value of x op y 00071 * @param op The operator (+,-,*,/ and power) 00072 * @return Return status 00073 */ 00074 PmReturn_t float_op(pPmObj_t px, pPmObj_t py, pPmObj_t *r_pn, int8_t op); 00075 00076 /** 00077 * Returns by reference a boolean that is x op y. 00078 * 00079 * @param px The float left-hand argument 00080 * @param py The float right-hand argument 00081 * @param r_pn The return value of x cmp y 00082 * @param cmp The comparison operator 00083 * @return Return status 00084 */ 00085 PmReturn_t float_compare(pPmObj_t px, pPmObj_t py, pPmObj_t *r_pobj, 00086 PmCompare_t cmp); 00087 00088 #ifdef HAVE_PRINT 00089 /** 00090 * Sends out a float object. 00091 * The number is preceded with a "-" when necessary. 00092 * 00093 * @param pObj Ptr to float object 00094 * @return Return status 00095 */ 00096 PmReturn_t float_print(pPmObj_t pf); 00097 00098 #endif /* HAVE_PRINT */ 00099 00100 #endif /* HAVE_FLOAT */ 00101 00102 #endif /* __FLOAT_H__ */
Generated on Tue Jul 12 2022 17:07:01 by
1.7.2