Whole number function

i'm haveing a bit of trouble creating a whole number function that returns a true/false boolean variable. I've narrowed the problem down to what i believe is the math that the function contains. Or if there's an easier way of doing this i'd like to know it as well.

i've included the code that i have so far, mabye that'll help a bit:

Function PerfectSquare(intNumber) As Boolean
[b]intNumber = Sqr(intNumber)
intNumber = dblNumber Mod 1[/b] 'INCORRECT!! - I need to know what to put here so that 'intNumber'
'would equal a whole number or a decimal that would return 'FALSE'
If intNumber <> 0 Then
PerfectSquare = False
PerfectSquare = True
End If
End Function


  • This will tell you if its a whole number or not:

    Private Function flgWhole(dblInput As Double) As Boolean

    If dblInput = Int(dblInput) Then flgWhole = True

    End Function

    Is this what you meant?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion