#square number

1 messages · Page 1 of 1 (latest)

full starBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

wispy lintel
#

!cppref sqrt

full starBOT
wispy lintel
#

so what part are you struggling with?

#

checking if it's a square numbers is quite simple when you have the square root

#

and what is your code so far

#

can't help you without seeing any code

swift spoke
#

also debugging is important, it's very easy and a great help for finding issues

quick ruin
#

sqrt() has some very heavy requirements on correctness (compared to other math functions). It is also usually hardware implemented (sqrtss/sqrtsd). With NaN/inf checks it takes usually less than 16 cycles on modern architectures to get the results. (Sqrt itself having usually ~12 cycles latency).

#

So checking against square root is the easiest and fastest way

#

(just me posting stuff for other people that might be interested)

wispy lintel
raven spire
#

Hi.

full starBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.