Solved

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

Posted on 2008-06-22
2
708 Views
Last Modified: 2013-11-05
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
Comment
Question by:ShimaAlavi
  • 2
2 Comments
 

Author Comment

by:ShimaAlavi
ID: 21841292
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
 

Accepted Solution

by:
ShimaAlavi earned 0 total points
ID: 21841310
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now