Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 724
  • Last Modified:

Reminder of a Floating Point to Floating Point Devision Divistion. Is it Possible?

Hi,

I'm translating a VB.NET Code to Delphi (Pascal). In this code, MOD operator used to get the reminder of a floating point division. I could not understand what a reminder of a floating point division mean and How it's possible to get a reminder of such division.

Here is the code I'm got in stuck with:
        If angle Mod Math.PI = Math.PI / 2D Then Return Single.PositiveInfinity

In pascal there is DIV and MOD operator but they both could only used to get the reminder of Integer division. For floating point division, / Operator could be used. But there is no operator for calculating the reminder of a floating point division.

So, Does it really possible to get the reminder of floating point division? If so, how could I translate this code to pascal?

Second What "2D" mean? Does it mean that it's a Double Number?


Private Function GetAngularCoefficient(ByVal segment As PointF()) As Single
        If segment.Length <> 2 Then Throw New ArgumentException("Parameter must be of 2 items", "segment")
        Dim U As PointF = segment(0)
        Dim V As PointF = segment(1)
        Dim angle As Double = GetAngularCoefficientRads(U, V)
 
 
        If angle Mod Math.PI = Math.PI / 2D Then Return Single.PositiveInfinity
        If angle Mod Math.PI = -Math.PI / 2D Then Return Single.NegativeInfinity
        Return CSng(Math.Tan(angle))
    End Function

Open in new window

0
ShimaAlavi
Asked:
ShimaAlavi
  • 2
1 Solution
 
ShimaAlaviAuthor Commented:
I'm not sure. But As I understand from searches on the internet, MOD operator return reminder of Integer division and not floating-point division.
0
 
ShimaAlaviAuthor Commented:
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now