小编net*_*otz的帖子

Swagger Swashbuckle Asp.NET Core:显示有关使用的每个枚举的详细信息

我有以下枚举:

public enum TicketQuestionType
{
    General = 1,
    Billing = 2,
    TMS = 3,
    HOS = 4,
    DeviceManagement = 5
}
Run Code Online (Sandbox Code Playgroud)

和模型类:

public class TicketCreateApi
{
    public string Subject { get; set; }
    public TicketQuestionType QuestionType { get; set; } = TicketQuestionType.General;
    public TicketType Type { get; set; } = TicketType.Problem;
    public TicketStatus Status { get; set; } = TicketStatus.New;
    public TicketPriority Priority { get; set; } = TicketPriority.Normal;
    public string Description { get; set; }
    public List<string> Attachments { …
Run Code Online (Sandbox Code Playgroud)

asp.net-web-api swagger swashbuckle asp.net-core swashbuckle.aspnetcore

15
推荐指数
1
解决办法
1万
查看次数

PROLOG - 如何舍入浮点数的小数?

我在知识库中有这一行:

height(Hipot,Y) :- Y is sin(pi/6)*Hipot.
Run Code Online (Sandbox Code Playgroud)

它计算一个直角三角形的导管之一。

当向 Prolog 询问 的值时Y,即 cathetus,我得到一个不准确的数字:

?- height(1,Y).
Y = 0.49999999999999994.
Run Code Online (Sandbox Code Playgroud)

但实际值是1/2,所以应该输出0.5。我想不准确是因为使用了pi,但我想继续使用它,所以我如何舍入Y到 0.5?

floating-point prolog prolog-toplevel

1
推荐指数
1
解决办法
2105
查看次数