QB64 Phoenix Edition
testing a number's quare root is an integer and casting to a value? - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: testing a number's quare root is an integer and casting to a value? (/showthread.php?tid=3428)

Pages: 1 2 3


RE: testing a number's quare root is an integer and casting to a value? - madscijr - 01-28-2025

(01-27-2025, 11:33 PM)SMcNeill Wrote: Just curious:  Is anyone else's OCD trying to explode at the title of this topic?  QUARE ROOT??!! 

GAAAAAHHHHH!!!!!!
Hahaha, mighta started as a typo, but now I feel like a Quare Root should be its own thing! 
What could that be used for? Hmmmm  Tongue

(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


From Wiki:
Quote:What is mod 1 in math?
The range of values for an integer modulo operation of n is 0 to n − 1. a mod 1 is always 0. When exactly one of a or n is negative, the basic definition breaks down, and programming languages differ in how these values are defined.
I probably shoulda not even mentioned MOD, that wasn't going to work!


RE: testing a number's quare root is an integer and casting to a value? - Pete - 01-28-2025

(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


RE: testing a number's quare root is an integer and casting to a value? - madscijr - 01-28-2025

(01-28-2025, 01:55 AM)Pete Wrote: This reminds me of that thread a few years back by Chris Whistlehole. Sorry, I'm bad with last names.

Chris Whistlehole!
You could be famous with a stage name like that!!!
Wink


RE: testing a number's quare root is an integer and casting to a value? - Pete - 01-28-2025

But can someone really make a living in the gay porn industry? Wait, where's Clippy???

Pete Big Grin


RE: testing a number's quare root is an integer and casting to a value? - madscijr - 01-28-2025

(01-28-2025, 02:25 AM)Pete Wrote: But can someone really make a living in the gay porn industry? Wait, where's Clippy???

Pete Big Grin
There's always that career option if the hand modeling doesn't pan out, but I hope you'd choose TV weatherman first. But why bothet? With a name like Chris Whistlehole, one could be the next Barry Manilow, Justin Timberlake or Shaun Cassidy... just saying


RE: testing a number's quare root is an integer and casting to a value? - SMcNeill - 01-28-2025

(01-28-2025, 03:51 AM)madscijr Wrote:
(01-28-2025, 02:25 AM)Pete Wrote: But can someone really make a living in the gay porn industry? Wait, where's Clippy???

Pete Big Grin
There's always that career option if the hand modeling doesn't pan out, but I hope you'd choose TV weatherman first. But why bothet? With a name like Chris Whistlehole, one could be the next Barry Manilow, Justin Timberlake or Shaun Cassidy... just saying

So basically you're saying he could be ... a gay pornstar?   Big Grin


RE: testing a number's quare root is an integer and casting to a value? - madscijr - 01-28-2025

(01-28-2025, 04:04 AM)SMcNeill Wrote:
(01-28-2025, 03:51 AM)madscijr Wrote:
(01-28-2025, 02:25 AM)Pete Wrote: But can someone really make a living in the gay porn industry? Wait, where's Clippy???

Pete Big Grin
There's always that career option if the hand modeling doesn't pan out, but I hope you'd choose TV weatherman first. But why bothet? With a name like Chris Whistlehole, one could be the next Barry Manilow, Justin Timberlake or Shaun Cassidy... just saying
So basically you're saying he could be ... a gay pornstar?   Big Grin
How are the typing skills coming along, Pete?


RE: testing a number's quare root is an integer and casting to a value? - Pete - 01-28-2025

I'm boning up on them as we speak.

Pete Big Grin


RE: testing a number's quare root is an integer and casting to a value? - madscijr - 01-28-2025

(01-28-2025, 04:38 AM)Pete Wrote: I'm boning up on them as we speak.

Pete Big Grin
LoL

For the record, I did not intend for the conversation to go in this direction! 
Tongue


RE: testing a number's quare root is an integer and casting to a value? - Pete - 01-28-2025

Don't worry, the effects only last up to 4-hours. If longer, Steve needs to get me to a physician.

Oh, you said di-rection. Sorry.

Pete Big Grin