Good Morning,

The standard use for FLOOR(x) is the greatest integer less than or equal to x. I usually denote that by [x] (since Gauss), and call it "integer part." This terminology is standard in math, but not so much in comp sci.

The function iPart(x) is related to FLOOR(x) by iPart(x)=FLOOR(x) if FLOOR(x) > or = 0, and FLOOR(x)+1 otherwise. (So iPart is not the integer part, but what remains after droping everything to the right of the decimal point.) This is what the Help documentation in the Prime states, but not what it actually uses: in the Prime FLOOR(x) and iPart(x) seem to be the same thing: iPart(-1.23) returns -2, but it should return -1.

Using these function in a program brings up some serious trouble.

Here is an example. This program below computes the binary expression B of a whole number N as a string of 0's and 1's:

EXPORT Bin(N)

BEGIN

LOCAL B:="";

WHILE N>0 DO

IF FP(N/2) =0 THEN B:=B+"0";

ELSE B:=B+"1";

END;

N:=FLOOR(N/2);

END;

PRINT(B);

END;

This works fine, but if I replace the 8th line with

N:=iPart(N/2);I get "Bin Error: Bad argument type."

The Debug feature in Program does not really help much (and is mostly undocumented in the user guide).

I hope that you can replicate this, and if so, fix it!

*Edited: 1 Dec 2013, 1:22 p.m. *