本文整理汇总了VB.NET中System.Math.IEEERemainder方法的典型用法代码示例。如果您正苦于以下问题:VB.NET Math.IEEERemainder方法的具体用法?VB.NET Math.IEEERemainder怎么用?VB.NET Math.IEEERemainder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Math
的用法示例。
在下文中一共展示了Math.IEEERemainder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Example
Module Example
Public Sub Main()
Console.WriteLine($"{"IEEERemainder",35} {"Remainder operator",20}")
ShowRemainders(3, 2)
ShowRemainders(4, 2)
ShowRemainders(10, 3)
ShowRemainders(11, 3)
ShowRemainders(27, 4)
ShowRemainders(28, 5)
ShowRemainders(17.8, 4)
ShowRemainders(17.8, 4.1)
ShowRemainders(-16.3, 4.1)
ShowRemainders(17.8, -4.1)
ShowRemainders(-17.8, -4.1)
End Sub
Private Sub ShowRemainders(number1 As Double, number2 As Double)
Dim formula As String = $"{number1} / {number2} = "
Dim ieeeRemainder As Double = Math.IEEERemainder(number1, number2)
Dim remainder As Double = number1 Mod number2
Console.WriteLine($"{formula,-16} {ieeeRemainder,18} {remainder,20}")
End Sub
End Module
输出:
IEEERemainder Remainder operator 3 / 2 = -1 1 4 / 2 = 0 0 10 / 3 = 1 1 11 / 3 = -1 2 27 / 4 = -1 3 28 / 5 = -2 3 17.8 / 4 = 1.8 1.8 17.8 / 4.1 = 1.4 1.4 -16.3 / 4.1 = 0.0999999999999979 -4 17.8 / -4.1 = 1.4 1.4 -17.8 / -4.1 = -1.4 -1.4