' This example demonstrates Math.IEEERemainder()
Class Example
Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
Dim doubleResult As Double
Dim divisor As Double
Dim str1 As [String] = "The IEEE remainder of {0:e}/{1:f} is {2:e}"
divisor = 2.0
outputBlock.Text += String.Format("{0}Divide two double-precision floating-point values:", vbCrLf) & vbCrLf
doubleResult = Math.IEEERemainder([Double].MaxValue, divisor)
outputBlock.Text &= "1) "
outputBlock.Text += String.Format(str1, [Double].MaxValue, divisor, doubleResult) & vbCrLf
divisor = 3.0
doubleResult = Math.IEEERemainder([Double].MaxValue, divisor)
outputBlock.Text &= "2) "
outputBlock.Text += String.Format(str1, [Double].MaxValue, divisor, doubleResult) & vbCrLf
outputBlock.Text &= "Note that two positive numbers can yield a negative remainder." & vbCrLf
End Sub
End Class
'
'This example produces the following results:
' Divide two double-precision floating-point values:
' 1) The IEEE remainder of 1.797693e+308/2.00 is 0.000000e+000
' 2) The IEEE remainder of 1.797693e+308/3.00 is -1.000000e+000
' Note that two positive numbers can yield a negative remainder.