本文整理汇总了C#中SObject.isFlonum方法的典型用法代码示例。如果您正苦于以下问题:C# SObject.isFlonum方法的具体用法?C# SObject.isFlonum怎么用?C# SObject.isFlonum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SObject
的用法示例。
在下文中一共展示了SObject.isFlonum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: op1_flonump
public static SObject op1_flonump(SObject arg) {
return Factory.makeBoolean(arg.isFlonum());
}
示例2: datum2foreign
//.........这里部分代码省略.........
case 0: // object
{
if (obj is SFixnum || obj is ForeignBox) {
return obj;
} else {
Exn.error ("datum->foreign (object) expected F");
return Factory.Impossible;
}
}
case 1: // schemeobject
{
return Factory.makeForeignBox (obj);
}
case 2: // string
{
if (obj is SByteVL) {
string value = ((SByteVL)obj).asString();
return Factory.makeForeignBox (value);
} else {
Exn.error ("datum->foreign (string) expected string");
return Factory.Impossible;
}
}
case 3: // symbol
{
Exn.error
("datum->foreign (symbol) not implemented in runtime");
return Factory.Impossible;
}
case 4: // bytes
{
if (obj is SByteVL) {
return Factory.makeForeignBox
(((SByteVL)obj).elements);
} else {
Exn.error
("datum->foreign (bytes) expected bytevector");
return Factory.Impossible;
}
}
case 5: // int
{
if (obj is SFixnum) {
return obj;
} else if (obj.isBignum()) {
SByteVL n = (SByteVL)obj;
if (Number.getBignumLength(n) == 1) {
uint magn = (uint)(Number.bignumRef(n, 1) << 16)
+ (uint)Number.bignumRef(n, 0);
int val = magn;
if (! (Number.getBignumSign(n)))
magn = - magn;
return Factory.makeForeignBox (val);
}
}
Exn.error("datum->foreign (int) expected small integer");
return Factory.Impossible;
}
case 6: // float
{
if (obj.isFlonum()) {
double value = ((SByteVL)obj).unsafeAsDouble(0);
return Factory.makeForeignBox ((float)value);
} else {
Exn.error("datum->foreign (float) expected flonum");
return Factory.Impossible;
}
}
case 7: // double
{
if (obj.isFlonum()) {
double value = ((SByteVL)obj).unsafeAsDouble(0);
return Factory.makeForeignBox (value);
} else {
Exn.error("datum->foreign (float) expected flonum");
return Factory.Impossible;
}
}
case 8: // void
{
Exn.error("datum->foreign (void) not allowed");
return Factory.Impossible;
}
case 9: // message filter
{
if (obj is Procedure)
return Factory.makeForeignBox
(new FFI_message_filter ((Procedure) obj));
else {
Exn.error
("datum->foreign (message filter) expected procedure");
return Factory.Impossible;
}
}
#endif
}
Exn.error("datum->foreign: unknown conversion");
return Factory.Impossible;
}