Solved

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

Posted on 2008-06-22
2
712 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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