The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(49G) Integer Square Detection
10-11-2015, 06:48 AM (This post was last modified: 06-15-2017 01:45 PM by Gene.)
Post: #1
(49G) Integer Square Detection
The programme ISSQ? economically detects whether an integer is a perfect square, returning 1. for yes, 0. for no.

A problem arises in compiling the programme: the ZINTs in bold type have been processed through the command

FPTR2 ^Z>ZH

& are in fact hexadecimal ZINTs - the on-calculator compiler attempts to return the four numbers as decimal ZINTs, thus debilitating the programme.

Similarly, the decompiler produces the programme as here printed, not indicating the hexadecimal nature of the ZINTs.

Anyone have a solution to this compilation problem?


ISSQ?

::
CK1&Dispatch
# FF
::
::
1LAMBIND
TRUE
ZINT 23;
ZINT 11
ZINT 1218:019866014613
ZINT 65
ZINT 402483012450293
ZINT 63
ZINT 202021202030213
ZINT 64
BINT5
ONE_DO
::
1GETLAMSWAP_
FPTR2 ^ZMod
FPTR2 ^Z>#
FPTR2 ^ZBit?
SWAPDROP
?SEMI
ISTOP-INDEX
#2*
#1-
NDROP
FALSE
ExitAtLOOP
;
LOOP
1GETABND
SWAP
NOTcsdrpfls
::
DUP
Z2_
Z<
DUP
?SEMI
DROPDUP
FPTR2 ^Z>ZH
FPTR2 ^ZBits
BINT2
#/
#+
Z2_
SWAP
FPTR2 ^PPow#
BEGIN
SWAPDROPDUP
3PICKOVER
FPTR2 ^ZQUOText
FPTR2 ^QAdd
Z2_
FPTR2 ^ZQUOText
2DUP
Z>
NOT_UNTIL
DROPDUP
FPTR2 ^ZSQ_
ROT
EQUAL
;
SWAPDROP
;
COERCEFLAG
;
;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(49G) Integer Square Detection - Gerald H - 10-11-2015 06:48 AM



User(s) browsing this thread: 1 Guest(s)