The fact that the function name ends in % doesn't seem to make it an integer function (although the QL user guide says that "the type of data returned by the function is indicated by the type appended to the function identifier") any more than parameter names have no type until they are set, so parameter x% could be float or integer, depending on what it is made when parameters are passed.

As a workaround, add INT in line 160

160 IF INT(x%) < i : RETurn INT(x%) : ELSE return INT(i)

Dilwyn

-----Original Message----- From: Michael Bulford via Ql-Users
Sent: Thursday, August 10, 2017 5:54 PM
To: ql-users@lists.q-v-d.com ; ql-users-requ...@lists.q-v-d.com
Subject: [Ql-Users] Function type error

Hi all,
I've no idea whether this has been mentioned before, but consider this … 100 :110 PRINT #0, Min_Int%(330.7, 440.7)120 PAUSE -1130 STOP140 :150 DEFine FuNction Min_Int%(x%,i)160 IF x% < i : RETurn x% : ELSE : RETurn i170 END DEFine The correct result should be 331, sincethis is an integer function.On QPC2, SBASIC gives the result as 330.7QLiberator likewise also gives 330.7 Can anything be done? Michael

_______________________________________________
QL-Users Mailing List

---
This email has been checked for viruses by AVG.
http://www.avg.com
_______________________________________________
QL-Users Mailing List

Reply via email to