Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
max & min math functions
#1
I think __max and __min are in msvcrt, but cannot declare them in QM ("function not found"), maybe because type is undefined:
dll msvcrt __max
#2
Here's my hacky user-defined max function, is there more efficient code?
Function MaxInt
Code:
Copy      Help
;/
function#  value0 value1 [value2] [value3] [value4] [value5] [value6] [value7] [value8] [value9] [value10]


int* value = &value0
int maxval=value0
for(int'i 1 getopt(nargs))
,maxval=(maxval*(maxval>value[i])) + (value[i]*(value[i]>maxval)) + (maxval*(maxval=value[i]))
ret maxval
#3
__max is C macro. In QM use iif.
iif(a>b a b)


Forum Jump:


Users browsing this thread: 1 Guest(s)