Post Reply 
Plus42 Equations, Preview Release
12-20-2021, 11:10 PM
Post: #161
RE: Plus42 Equations, Preview Release
(12-09-2021 12:03 PM)Gjermund Skailand Wrote:  if you are going to expand the functions for logic or bits it would be nice to have a "find first set bit function". Presently the fastest way I know of is to calculate IP(ln(X)/ln(2)+1) and possibly correct for rounding errors. Is there any faster way?

I was re-reading the thread and just realized I never replied to this. Apologies!

I'll make a note of this in my long-term to-do list. I don't think I'll put this in Plus42 1.0, but I have a bunch of functions that I may add later, and maybe also include in Free42, and these include some advanced binary stuff, like rotations and shifts, and IEEE-754-2008 floating-point conversions. (I don't know how many people want those, but I could put them to good use tracking down errors in the Intel library test suite!) And a find-first-bit would fit right in. Or log2()...
Visit this user's website Find all posts by this user
Quote this message in a reply
12-21-2021, 08:39 AM
Post: #162
RE: Plus42 Equations, Preview Release
Thank you Thomas.
Some time ago, when you added local variables, I ported the solver part of Valentin Albillos Soduko for the HP71 to free42, and then noticed much of the time was spent looping to find first set bit.
So it is more of a nice to have feature, even though it would have been a significant speed-up.
br Gjermund
Find all posts by this user
Quote this message in a reply
12-21-2021, 09:54 AM
Post: #163
RE: Plus42 Equations, Preview Release
(12-20-2021 11:10 PM)Thomas Okken Wrote:  I'll make a note of this in my long-term to-do list. I don't think I'll put this in Plus42 1.0, but I have a bunch of functions that I may add later, and maybe also include in Free42, and these include some advanced binary stuff, like rotations and shifts, and IEEE-754-2008 floating-point conversions. (I don't know how many people want those, but I could put them to good use tracking down errors in the Intel library test suite!) And a find-first-bit would fit right in. Or log2()...
That would be great, currently the 16C is the only machine that can do this stuff. And a native base-2 log would be a nice addition. It would be nice to use when doing research for some embedded software development where this low-level calculations are still used.
Find all posts by this user
Quote this message in a reply
12-21-2021, 07:03 PM
Post: #164
RE: Plus42 Equations, Preview Release
New update:

1. Fixed a crash in handling N+U (Number+Unit) program lines.
2. Better TRACE behavior with the UNITS catalog.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-21-2021, 10:15 PM (This post was last modified: 12-21-2021 10:32 PM by ijabbott.)
Post: #165
RE: Plus42 Equations, Preview Release
(12-21-2021 08:39 AM)Gjermund Skailand Wrote:  Thank you Thomas.
Some time ago, when you added local variables, I ported the solver part of Valentin Albillos Soduko for the HP71 to free42, and then noticed much of the time was spent looping to find first set bit.
So it is more of a nice to have feature, even though it would have been a significant speed-up.
br Gjermund

There are ways to find the lowest set bit without looping if it uses 2's complement arithmetic. With an integer in X, duplicate it to Y, change sign, use the AND function. You end up with a single-bit number in X (a power of 2). If you need it as a bit number, do a log base 2. For example:

48
ENTER
+/-
AND

(X now contains 16.)

(Exit the BASE menu here to avoid a "Divide by 0" error below.)
LN
2
LN
/

(X now contains 4. Might need to round it to the nearest integer.)

.5
+
IP

(Definitely an integer 4 now!)

— Ian Abbott
Find all posts by this user
Quote this message in a reply
12-21-2021, 10:26 PM
Post: #166
RE: Plus42 Equations, Preview Release
The integer base-2 logarithm, aka the number of bits required to represent n, can be found by a simple iteration. There is a nice version in One-minute Marvels. This would be fast enough in FOCAL, and virtually instantaneous in C.

Code:

<< 0 1 ROT FOR c 1 + c STEP >>
Find all posts by this user
Quote this message in a reply
12-23-2021, 12:07 PM
Post: #167
RE: Plus42 Equations, Preview Release
Thank you ijabott and Keith for the suggestions. The algorithms are new to me. I't just that I think ARM and probably also iphone processors have this implemented in hardware. Calculating a ln2(x) with 25 decimals? to find a position in 9 (or 27) bits is a bit extravagant? when, even if it fast, it could be much faster. Have good Xmas. Gjermund
Find all posts by this user
Quote this message in a reply
12-28-2021, 02:32 AM
Post: #168
RE: Plus42 Equations, Preview Release
New update: Directories.

New commands: MKDIR, RMDIR, CHDIR, UPDIR, ROOTDIR, PATH.
For the sake of RPL muscle memory, these aliases are also available: CRDIR for MKDIR, PGDIR for RMDIR, and HOME for ROOTDIR.

These commands are in the DIR section in the fourth row of the CATALOG menu. Or, well, except for PATH, which I just noticed I forgot to add to the catalog. But the function is available and it does work. (With the 2-line screen, PATH may not be the most useful function, since all you'll see is { N-Item List }, but PRX is your friend.)

For interactive directory navigation, use CATALOG → DIRS, which is in the first row of the CATALOG menu, where FCN used to be. (FCN was moved to the second row.) Note that the directory listings are under CATALOG → DIRS, while the directory functions are under CATALOG → DIR.

This is still very new, so use at your own risk. Back up your state files!

Note that programs and variables from ancestor directories are accessible, but read-only. You won't see them in the catalog, but XEQ and RCL will find them. But attempting to edit a program that isn't in the current directory will result in a Restricted Operation message, and attempting to modify a variable that isn't in the current directory will result in a Variable Not Writable message. Specifically, Variable Not Writable will happen with STO+, STO-, STO×, STO÷, X<>, ISG, DSE, and HEAD, and when trying to STO to a numbered register when REGS is in an ancestor direcory. If you RCL a variable that is found in an ancestor directory and then try to STO it under the same name, a new copy will be stored in the current directory; STO always writes to the current directory, never to an ancestor.

More features are coming, including the ability to change the order of items in the DIRS, PGM, and variable catalogs, the ability to move things between directories, including entire directories, and symbolic links and search paths. And subdirectory support for the built-in HTTP server in the iOS version (does anyone still use the HTTP server?) And maybe other things?
Visit this user's website Find all posts by this user
Quote this message in a reply
12-28-2021, 12:15 PM (This post was last modified: 12-28-2021 12:21 PM by ggauny@live.fr.)
Post: #169
RE: Plus42 Equations, Preview Release
Hello,

It's impossible here and for me to install plus42 1.0 apk. I've download it on my Samsung A41 but when I want to install a window appears and say : want you update this application ? in blue letters it is write undo and install.
But when I press : install, a window say : Plus 42, application non installed.

I have already on my android phone Free42 and plus42, but impossible for Plus beta test. You know why ? May be if you explain me well I shall enjoy of new features.

I enjoy very well on my Asus PC window 10.

Thanks.

Gérard.
Find all posts by this user
Quote this message in a reply
12-28-2021, 12:27 PM
Post: #170
RE: Plus42 Equations, Preview Release
(12-28-2021 12:15 PM)ggauny@live.fr Wrote:  It's impossible here and for me to install plus42 1.0 apk. I've download it on my Samsung A41 but when I want to install a window appears and say : want you update this application ? in blue letters it is write undo and install.
But when I press : install, a window say : Plus 42, application non installed.

I think this is because I reset the apk version number of Plus42 a while ago. It looks like Android won't allow an apk with a lower version number to replace one with a higher version number. Try uninstalling Plus42 and then installing the new version, that should work.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-28-2021, 12:49 PM
Post: #171
RE: Plus42 Equations, Preview Release
New update: Fixed a couple of issues with reading older state files.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-28-2021, 03:45 PM
Post: #172
RE: Plus42 Equations, Preview Release
Hi Thomas,

In the latest build, SHIFT+CLEAR followed by CLALL causes the Plus42 binary to crash. I'm running Plus 42 on an M1 Macbook Air running macOS 12.1 Monterey.

Directories sound wonderful!

In your earlier post you asked (with reference to iOS) "does anybody still use the HTTP server"? The answer for me at least is that I've not been using it since I discovered how easy it was to get stuff into Plus42 using cut and paste. I think a web technology that might be more useful on the Plus42 iOS app would be if it supported Custom URL schemes to allow Plus42 to be controlled from other apps. If that existed people could use Plus42 from Shortcuts as a calculation engine for other apps.

Thanks again for your amazing work on Plus42 and all best wishes for a happy 2022!

Bob
Find all posts by this user
Quote this message in a reply
12-28-2021, 05:35 PM
Post: #173
RE: Plus42 Equations, Preview Release
@Thomas,

Well, I've uninstalled old Plus42 and then the installation of the plus41 1.0 beta work.

Thank you much and kudos for your work.

Happy new year to you and all followers !

Gérard.

Gérard.
Find all posts by this user
Quote this message in a reply
12-28-2021, 05:55 PM
Post: #174
RE: Plus42 Equations, Preview Release
New update:

1. Fixed CLALL crash
2. Fixed several bugs that basically made equations loaded from pre-directory state files unusable
3. Fixed possible crash on Windows when launching without a state file
Visit this user's website Find all posts by this user
Quote this message in a reply
12-29-2021, 01:13 AM
Post: #175
RE: Plus42 Equations, Preview Release
New update:

1. STO (and other store operations) was writing outside of the current directory. It should never do that, instead always writing to the current directory, even if an existing variable with the given name exists in an ancestor directory.
2. Σ+, Σ-, and CLΣ should report Variable Not Writable when REGS is in an ancestor directory, but they didn't, and would happily write to REGS in that case. That was wrong; fixed.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-29-2021, 02:47 PM
Post: #176
RE: Plus42 Equations, Preview Release
(12-29-2021 01:13 AM)Thomas Okken Wrote:  New update:

1. STO (and other store operations) was writing outside of the current directory. It should never do that, instead always writing to the current directory, even if an existing variable with the given name exists in an ancestor directory.
2. Σ+, Σ-, and CLΣ should report Variable Not Writable when REGS is in an ancestor directory, but they didn't, and would happily write to REGS in that case. That was wrong; fixed.
Using latest release, it so impossible to me to delete a (empty) dir: press RMDIR, press soft key with for name, no errors, dir still there.
Am I doing something wrong?
Find all posts by this user
Quote this message in a reply
12-29-2021, 04:36 PM
Post: #177
RE: Plus42 Equations, Preview Release
(12-29-2021 02:47 PM)Marco Polo Wrote:  Using latest release, it so impossible to me to delete a (empty) dir: press RMDIR, press soft key with for name, no errors, dir still there.
Am I doing something wrong?

No, you're not doing anything wrong.
Just a minute...
Visit this user's website Find all posts by this user
Quote this message in a reply
12-29-2021, 04:39 PM
Post: #178
RE: Plus42 Equations, Preview Release
New update:

1. Fixed RMDIR.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-29-2021, 05:51 PM
Post: #179
RE: Plus42 Equations, Preview Release
(12-29-2021 04:39 PM)Thomas Okken Wrote:  New update:

1. Fixed RMDIR.
I would like to have such quick response from my IT dept.
:-)

Thank you!
Find all posts by this user
Quote this message in a reply
12-29-2021, 06:06 PM
Post: #180
RE: Plus42 Equations, Preview Release
(12-29-2021 05:51 PM)Marco Polo Wrote:  
(12-29-2021 04:39 PM)Thomas Okken Wrote:  New update:

1. Fixed RMDIR.
I would like to have such quick response from my IT dept.
:-)
At least you have a response from your IT dept. LOL
Find all posts by this user
Quote this message in a reply
Post Reply 




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