本文整理汇总了C++中KReturnFloatValue函数的典型用法代码示例。如果您正苦于以下问题:C++ KReturnFloatValue函数的具体用法?C++ KReturnFloatValue怎么用?C++ KReturnFloatValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KReturnFloatValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Complex_catanhf
//## Complex Complex.catanhf();
static KMETHOD Complex_catanhf(KonohaContext *kctx, KonohaStack *sfp)
{
kComplex *kc = (kComplex *) sfp[0].asObject;
float _Complex zf = (float _Complex)kc->z;
float ret = catanh(zf);
KReturnFloatValue(ret);
}
示例2: Complex_catanhl
//## Complex Complex.catanhl();
static KMETHOD Complex_catanhl(KonohaContext *kctx, KonohaStack *sfp)
{
kComplex *kc = (kComplex *) sfp[0].asObject;
long double _Complex zl = (long double _Complex)kc->z;
long double ret = catanh(zl);
KReturnFloatValue(ret);
}
示例3: Complex_cexp
//## Complex Complex.cexp();
static KMETHOD Complex_cexp(KonohaContext *kctx, KonohaStack *sfp)
{
kComplex *kc = (kComplex *) sfp[0].asObject;
double _Complex z = kc->z;
double ret = cexp(z);
KReturnFloatValue(ret);
}
示例4: kJSON_getFloat
//## JSONFloat JSON.getFloat(String key);
static KMETHOD kJSON_getFloat(KonohaContext *kctx, KonohaStack *sfp)
{
JSON obj = ((kJSON *)sfp[0].asObject)->json;
const char *key = S_text(sfp[1].asString);
double json = JSON_getDouble(obj, key);
KReturnFloatValue(json);
}
示例5: Int_opDIV
/* float / float */
static KMETHOD Int_opDIV(KonohaContext *kctx, KonohaStack *sfp)
{
kfloat_t n = sfp[1].floatValue;
if(unlikely(n == 0.0)) {
THROW_ZeroDividedException(kctx, sfp);
}
KReturnFloatValue(sfp[0].intValue / n);
}
示例6: PyObject_toFloat
static KMETHOD PyObject_toFloat(KonohaContext *kctx, KonohaStack *sfp)
{
kPyObject *po = (kPyObject *)sfp[0].asObject;
double v = PyFloat_AsDouble(po->self);
if(PyErr_Occurred()) {
v = 0;
}
KReturnFloatValue(v);
}
示例7: Math_random
static KMETHOD Math_random(KonohaContext *kctx, KonohaStack *sfp)
{
kfloat_t ret;
#if defined(K_USING_INT32)
ret = genrand_real1();
#else
ret =genrand64_real1();
#endif
KReturnFloatValue(ret);
}
示例8: Complex_cpowf
//## Complex Complex.cpowf();
static KMETHOD Complex_cpowf(KonohaContext *kctx, KonohaStack *sfp)
{
kComplex *kx = (kComplex *) sfp[0].asObject;
float _Complex x = (float _Complex)kx->z;
float real = (float)sfp[1].floatValue;
float imaginary = (float)sfp[2].floatValue;
float _Complex y = real + I * imaginary;
float ret = cpowf(x, y);
KReturnFloatValue(ret);
}
示例9: Complex_cpowl
//## Complex Complex.cpowl();
static KMETHOD Complex_cpowl(KonohaContext *kctx, KonohaStack *sfp)
{
kComplex *kx = (kComplex *) sfp[0].asObject;
long double _Complex x = (long double _Complex)kx->z;
long double real = (long double)sfp[1].floatValue;
long double imaginary = (long double)sfp[2].floatValue;
long double _Complex y = real + I * imaginary;
long double ret = cpowl(x, y);
KReturnFloatValue(ret);
}
示例10: Complex_csinl
//## Complex Complex.csinl();
static KMETHOD Complex_csinl(KonohaContext *kctx, KonohaStack *sfp)
{
kComplex *kc = (kComplex *) sfp[0].asObject;
long double _Complex zl = (long double _Complex)kc->z;
#if !defined(__CYGWIN__)
long double ret = csinl(zl);
#else
long double ret = csin(zl);
#endif
KReturnFloatValue(ret);
}
示例11: ResultSet_getFloat
//## float ResultSet.getFloat(String name);
static KMETHOD ResultSet_getFloat(KonohaContext *kctx, KonohaStack *sfp)
{
kResultSet *rs = (kResultSet *)sfp[0].asObject;
int idx = ResultSet_FindColumn(kctx, rs, sfp[1].asString);
kfloat_t res = 0.0;
if(idx >= 0) {
ktypeattr_t type = rs->column[idx].type;
if(type == KType_Int) {
res = (kfloat_t) rs->column[idx].val.intValue;
} else if(KDefinedKonohaCommonModule() && type == KType_float) {
res = rs->column[idx].val.floatValue;
}
}
KReturnFloatValue(res);
}
示例12: Curl_getInfo
////## dynamic Curl.getInfo(int type);
static KMETHOD Curl_getInfo(KonohaContext *kctx, KonohaStack *sfp)
{
CURL* curl = toCURL(sfp[0].asObject);
char *strptr = NULL;
long lngptr = 0;
double dblptr = 0;
if(curl != NULL) {
kint_t curlinfo = sfp[1].intValue;
switch(curlinfo) {
case CURLINFO_HEADER_SIZE:
case CURLINFO_REQUEST_SIZE:
curl_easy_getinfo(curl, curlinfo, &lngptr);
KReturnUnboxValue(lngptr);
break;
case CURLINFO_REDIRECT_TIME:
case CURLINFO_TOTAL_TIME:
case CURLINFO_NAMELOOKUP_TIME:
case CURLINFO_CONNECT_TIME:
case CURLINFO_PRETRANSFER_TIME:
case CURLINFO_STARTTRANSFER_TIME:
case CURLINFO_SIZE_UPLOAD:
case CURLINFO_SIZE_DOWNLOAD:
case CURLINFO_SPEED_DOWNLOAD:
case CURLINFO_SPEED_UPLOAD:
curl_easy_getinfo(curl, curlinfo, &dblptr);
KReturnFloatValue(dblptr);
break;
case CURLINFO_EFFECTIVE_URL:
case CURLINFO_CONTENT_TYPE:
curl_easy_getinfo(curl, curlinfo, &strptr);
KReturn(KLIB new_kString(kctx, OnStack, strptr, strlen(strptr), 0));
break;
default: {
// TODO ktrace
// KNH_NTRACE2(ctx, "curl_easy_getinfo", K_FAILED, KNH_LDATA(LOG_i("curlinfo", curlinfo)));
break;
}
}
}
KReturn(K_NULL);
}
示例13: Float_opSUB
/* float - float */
static KMETHOD Float_opSUB(KonohaContext *kctx, KonohaStack *sfp)
{
KReturnFloatValue(sfp[0].floatValue - sfp[1].floatValue);
}
示例14: Int_opADD
static KMETHOD Int_opADD(KonohaContext *kctx, KonohaStack *sfp)
{
KReturnFloatValue(sfp[0].intValue + sfp[1].floatValue);
}
示例15: Float_opPlus
static KMETHOD Float_opPlus(KonohaContext *kctx, KonohaStack *sfp)
{
KReturnFloatValue((sfp[0].floatValue));
}