本文整理匯總了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