本文整理汇总了C#中AType.ConvertToFloat方法的典型用法代码示例。如果您正苦于以下问题:C# AType.ConvertToFloat方法的具体用法?C# AType.ConvertToFloat怎么用?C# AType.ConvertToFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AType
的用法示例。
在下文中一共展示了AType.ConvertToFloat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostProcess
protected override AType PostProcess(AType argument, AType result)
{
// if there is any float in the integer list, convert the whole list to float
if (argument.Type == ATypes.AInteger && result.Any(item => item.Type == ATypes.AFloat))
{
result.ConvertToFloat();
}
return result;
}
示例2: PostProcess
//If the argument type is integer, the result can be float than
//we have to convert all items to float.
protected override AType PostProcess(AType argument, AType result)
{
if (argument.Type == ATypes.AInteger)
{
bool convert = false;
foreach (AType item in result)
{
if (item.Type == ATypes.AFloat)
{
convert = true;
break;
}
}
if (convert)
{
result.ConvertToFloat();
}
}
return result;
}
示例3: CreateLaminateJob
/// <summary>
/// </summary>
/// <param name="right"></param>
/// <param name="left"></param>
private LaminateJobInfo CreateLaminateJob(AType right, AType left)
{
LaminateJobInfo laminateInfo =
new LaminateJobInfo(left.Length != 0 ? left.Type : right.Type);
if (left.IsArray && !right.IsArray)
{
laminateInfo.Left = left.Clone();
laminateInfo.Right = DyadicFunctionInstance.Reshape.Execute(right, left.Shape.ToAArray());
}
else if (!left.IsArray && right.IsArray)
{
laminateInfo.Right = right.Clone();
laminateInfo.Left = DyadicFunctionInstance.Reshape.Execute(left, right.Shape.ToAArray());
}
else
{
laminateInfo.Right = right.Clone();
laminateInfo.Left = left.Clone();
}
// check if the types are same
if (right.Type != left.Type)
{
if (left.Type == ATypes.AFloat && right.Type == ATypes.AInteger)
{
right = right.ConvertToFloat();
}
else if (left.Type == ATypes.AInteger && right.Type == ATypes.AFloat)
{
left = left.ConvertToFloat();
}
else if (!(Utils.IsSameGeneralType(left, right)
|| left.Type == ATypes.ANull || right.Type == ATypes.ANull))
{
throw new Error.Type(TypeErrorText);
}
}
// check the length, shape and rank
if (laminateInfo.Left.Rank != laminateInfo.Right.Rank)
{
throw new Error.Rank(RankErrorText);
}
if (!laminateInfo.Left.Shape.SequenceEqual(laminateInfo.Right.Shape))
{
throw new Error.Length(LengthErrorText);
}
if (laminateInfo.Left.Rank >= 9 || laminateInfo.Right.Rank >= 9)
{
throw new Error.MaxRank(MaxRankErrorText);
}
return laminateInfo;
}