/* writeIntegerValue - write an integer value */ bool write_ctx::writeIntegerValue(value v) { return s->put(CsFaslTagInteger) && s->put_int( CsIntegerValue(v) ); }
/* CSF_abs - built-in function 'abs' */ static value CSF_abs(VM *c) { CsCheckArgCnt(c,3); CsCheckType(c,3,CsNumberP); if (CsIntegerP(CsGetArg(c,3))) { int_t v = CsIntegerValue(CsGetArg(c,3)); return CsMakeInteger(v >= 0 ? v : -v); } else { float_t v = CsFloatValue(CsGetArg(c,3)); return CsMakeFloat(c,v >= 0.0 ? v : -v); } }
/* FloatValue - convert a value to float */ static float_t FloatValue(value val) { if (CsFloatP(val)) return CsFloatValue(val); return (float_t)CsIntegerValue(val); }