Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
testing a number's quare root is an integer and casting to a value?
#12
(01-27-2025, 11:29 PM)bplus Wrote: What is Mod 1 ?
Code: (Select All)
For i = 1 To 10

    MySquareRoot! = Sqr(i)

    Print i, MySquareRoot!, MySquareRoot! Mod 1, _IIf((MySquareRoot! Mod 1 = 0), "Integer", "Not Integer")
Next

looks like mod 1 = 0 for everything!

I give the testing of a number as an integer with Mod 1, a mod 1 rating. Smile

LOL a mod 1 rating.

I'll give that an admin +1!

Code: (Select All)
bottom = 1: top = 11
For i = bottom To top
    Print top; "mod"; i; " = "; top Mod i
Next

Makes a nice pattern, because 11 is a prime number. I mean I get it, every number divided by itself, which is mod 1, has no remainder.

I was almost tempted to post: If num mod(Int(num)) = 0 The Print "Integer" ' Of course that fails if num = 0.

This reminds me of that thread a few years back by Chris Whistlehole. Sorry, I'm bad with last names.

Pete
Reply


Messages In This Thread
RE: testing a number's quare root is an integer and casting to a value? - by Pete - 01-28-2025, 01:55 AM



Users browsing this thread: 1 Guest(s)