Post Reply 
newRPL: [UPDATED April 27-2017] Firmware for testing available for download
05-07-2017, 06:55 PM
Post: #657
RE: newRPL: [UPDATED April 27-2017] Firmware for testing available for download
(05-07-2017 04:04 AM)The Shadow Wrote:  There's something similar going on with algebraics... 'X/2' EVAL's to '1/2*X', which seems odd.

Also, algebraics aren't handling 0 right: 'X*0' EVAL's to '0*X', 'X+0' and '0+X' don't change, and 'X+1+Y-1' EVAL's to 'X+0+Y'.

Bear in mind there's no CAS yet. There's only a rudimentary numeric reduction that allows you to work with fractions, so when you EVAL, numbers tend to be grouped together before variables, much like when you write a polynomial:
a*x+b*X^2+... the coefficients go first.
and it favors displaying fractions as fractions 1/2, instead of 2^(-1)*X.

Regarding simplifications like adding 0: I didn't get to implement any of that yet, it makes sense that adding 0 (or multiplying by 1) should be eliminated during the numeric reduction.
Now multiplying by 0 is a different story: 0*X cannot be simplified unless you know what X contains. It could be Infinity, then the result would be indeterminate, not zero.

(05-07-2017 04:04 AM)The Shadow Wrote:  
Quote:Can you provide an example that fails? my tests here worked OK. Thanks.

I've been trying to recreate FXND, because I need it for a lot of things I do. In the absence of POS and SUB, I've been using NTHTOKEN, TRIM, and RTRIM.

If you do ->Q on pi0 (other 'big' fractions work this way too), you get '1.483552189208E19/4.722293284944896863E18'

I use NTHTOKEN to split that around the "/". So far so good. I RTRIM the first piece to get rid of the "'" and it works. I TRIM the second piece of "'", and I get "4.722293284944896863E18', with the single quote still on the end but the double quote missing. This object then acts very bizarrely when I STR-> and try to do arithmetic with it - it acts sort of like an algebraic.

In this case NTHTOKEN worked, RTRIM and TRIM both worked. What happens is that for whatever reason it seems my code beautifier is adding a new line at the end of that object, so TRIM is not removing the tick mark, because there's a non-separator character after that.
You need to include a newline as a separator as well (for now anyway, the code beautifier doesn't need to add a newline at the end so that's probably changing soon):
"'
" TRIM
and it will remove both characters.

As far as when you ran STR-> on that number, it seems it was compiled as a valid identifier, which is a bug (it should've been rejected as a syntax error). It behaves like any other identifier after that.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL: [UPDATED April 27-2017] Firmware for testing available for download - Claudio L. - 05-07-2017 06:55 PM



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