What it is
To publish an app to the App Store, an app developer must first submit it – along with screenshots, a description, icons, and other information – to Apple for review. After approving the app, Apple places it on the App Store, where users can purchase it and install it directly from their iOS devices. To publish an app to the App Store, an app developer must first submit it – along with screenshots, a description, icons, and other information – to Apple for review. After approving the app, Apple places it on the App Store, where users can purchase it and install it directly from their iOS devices.
Free42 is a re-implementation of the HP-42S Scientific Programmable Calculator and HP-82240 Printer.It is a complete rewrite, not using any HP code. It does not require an HP-42S ROM image.
Free42 is an Open Source project. The executables and source code are released under the terms of the GNU General Public License, version 2.
All third-party code used in Free42 is either in the public domain, or licensed under terms compatible with GPLv2, or used with the authors' permission.
Project Status
The latest release is 3.0.1. If you're interested in what's been going on with Free42, see the project history.
If you have questions or comments about Free42, you can contact me, Thomas Okken, via email at thomasokken@gmail.com.
You can find answers to some frequently asked questions in the Free42 FAQ.
Donations
If you like Free42 and use it regularly, or if you simply want to sponsor the Free42 project, please make a donation.You may donate any amount you wish, large or small.
Donations are processed by PayPal.
Page Contents
DownloadsInstall App On Xcode Simulator Tutorial
Documentation
Free42 Extensions to the HP-42S Instruction Set
HP-42S Undocumented [MIN], [MAX], and [FIND] Functions
Frequently Asked Questions
Downloads
AndroidGet it at Google Play, or if you prefer the manual approach, download Free42Android.apk for side-loading.Requires Android 4.0 or later. | |
iOS (iPhone, iPad, iPod touch)Get it from the App Store.Requires iOS 9.0 or later. | |
WindowsDownload: Free42Windows.zipRequires Windows Vista or later. If Free42 does not run as is, you will also need to download and install the Visual C++ Redistributable for Visual Studio 2015 / 2017 / 2019 (get the file vc_redist.x86.exe). | |
MacOSDownload: Free42Mac.zipRequires MacOS 10.9 or later. | |
LinuxDownload: Free42Linux.tgzBuilt in Ubuntu 14.04, with libc 2.19, libstdc++ 4.8.4, and GTK+ 3.10.8. It should work on any Linux (x86_64) with those or similar libraries. | |
| |
SkinsSome skins to use instead of the faceplates built into Free42. | |
HP-42S/Free42 programsA small collection of HP-42S/Free42 programs. | |
rom2rawA C program that converts user code from HP-41 ROM images, from ROM or MOD files, to Free42/Emu42 compatible 'raw' program files.Download rom2raw.zip; source code and Win32 console executable included. | |
Free42 Source CodeGet it from GitHub: https://github.com/thomasokken/free42Package for GTK only, no HP logo, for building Linux packages: upstream. I cannot keep track of exactly which combinations of tools do and don't work for building Free42, but for what it's worth, these are the ones I use:
|
Documentation
Contents
ManualLoading and Saving Programs
The Hidden Powers of Copy and Paste
Loading, Saving, and Switching States
Binary and Decimal Floating-Point
Manual
There is no manual for Free42 per se, but since it is an accurate simulation of the HP-42S, the original HP-42S Owner's Manual should be adequate for most purposes. I also recommend the Alternative HP-42S/Free42 Manual, written by José Lauro Strapasson and Russ Jones; you can get it here, in PDF and Word formats. Finally, the HP-42S Programming Examples and Techniques book is a great source of advanced programming advice and inspiration.
The User Interface functionality that is specific to Free42, e.g. printer emulation, skin switching, etc., is fairly simple and should be self-explanatory, but Free42 also has extended functionality in the calculator simulation: program import/export, time and date functions, configurable word size for BASE functions, enhanced debugging functions, local variables, and access to the accelerometer / GPS / compass on Android and iOS devices. These are all documented below.
Loading and Saving Programs
Loading and saving programs is possible in all Free42 versions. The exact process is pretty straightforward in the desktop versions (Windows, MacOS, Linux), but it is a bit more complicated on mobile devices.
For instructions for all versions, see here.
Starting with release 2.0, you can use Copy and Paste to get programs into and out of Free42. In PRGM mode, Copy puts a text representation of the current program onto the system clipboard, and Paste takes a text representation of a program from the clipboard and loads it as the last program. This works in all Free42 versions, including mobile.
The Hidden Powers of Copy and Paste
Basic Copy and Paste, handling real and complex scalars, has been a feature of Free42 since its early days. In version 2.0, however, the capabilties of Copy and Paste were greatly improved, now handling all the types of data that the calculator supports.
Scalars
Real and complex numbers are copied from the X register at full precision, without thousands separators, and with a decimal point or comma according to the RDX. or RDX, setting in the DISP menu. Complex numbers are copied with the notation matching the RECT or POLAR setting in the MODES menu: a+bi in RECT mode, and r ∠ θ in POLAR mode.
When pasting scalars, periods and commas are interpreted according to the RDX. / RDX, setting. Thousands separators are permitted but ignored. Complex numbers are recognized in several formats: a+bi, a+bj, and (a, b) representing the rectangular form, and r ∠ θ and r ∡ θ representing the polar form.
Strings
Strings are copied and pasted from and to the X register, up to six characters in length, and from and to the ALPHA register (while in ALPHA mode) up to the full 44-character ALPHA register length. When copying, characters are converted from the HP-42S encoding to Unicode where possible, the only exceptions being the HP-42S characters LF and EC, which have no equivalents in Unicode, and are translated to [LF] and [ESC]. When pasting, Unicode characters that can't be mapped to HP-42S characters are replaced by • (bullet, which looks like a small square).
Matrices
Matrices are copied from and pasted to the X register in tab-delimited text format, where cells are separated by tab characters, and rows are separated by linefeed characters. This format is supported by all major spreadsheet applications, and the Free42 matrix Copy and Paste operations have been tested with Microsoft Excel, Google Sheets, LibreOffice Calc, and Apple Numbers.
Free42 supports copying and pasting complex matrices, but be aware that most spreadsheets offer only very limited support for complex numbers, and Google Sheets does not support them at all.
Programs
When in PRGM mode, Copy and Paste can be used to copy and paste entire programs. When copying, the current program is converted to text format, exactly as when it is printed using PRP. When pasting, the text from the clipboard is parsed as a program listing, and the resulting program is loaded at the end of program memory as a new program. It is possible to paste multiple programs in a single Paste operation; they will be loaded into program memory in the order they appear in the text.
When pasting, all text that Free42 doesn't recognize as HP-42S instructions is silently ignored. This helps with listings that contain comments, but it can cause problems when pasting code that is basically valid, just not formatted in a way Free42 recognizes. Because of this, when pasting a program from an unverified source, it is recommended to at least check that the pasted program has the same number of lines as the listing.
Loading, Saving, and Switching States
Starting with version 2.5, Free42 allows you to save the calculator's state to files, share these files between different instances of Free42, and manage a set of states and switch between them with just a few mouse clicks.
The States command, found in the File menu in the Windows, MacOS, and Linux versions, and in the main menu in the Android and iOS versions, pops up the States management window, as seen in the screen shot on the right.
The calculator's state includes all programs and variables, the automatic stack, the flags, CUSTOM menu, programmable menu, ALPHA register, and all the state associated with the numerical solver and integrator. You can save a state to a file with the extension .f42, and load such files, using the Export and Import commands in the State manager's More menu. States that have been imported show up in the list of States, and can be activated by double-clicking them, or clicking them and then pressing Switch To.
Other operations in the States manager include duplicating an existing state, creating a new, empty state, and renaming an existing state. In addition, the mobile versions of Free42 offer the option of 'sharing' a state, which brings up a system-provided dialog where you can send the state file in an email.
Note that State files are not the same as the 'raw' files used for exchanging programs. A 'raw' file contains one or more programs, but nothing else, and can be loaded into Free42 without replacing what's already there. A state file, by contrast, defines the calculator's entire state, and loading a state file replaces the previously loaded one in memory. You can only work with one state at a time, but states do let you customize the calculator to a far greater extent than merely loading a program can.
Binary and Decimal Floating-Point
While Free42 originally used Binary math exclusively, all releases starting with 1.4 have come in two versions, Binary and Decimal. The two look and behave identically; the only difference is the way they represent numbers internally.
The desktop versions of Free42 on this site, that is, the ones for Windows, MacOS, and Linux, include both the Binary and Decimal versions in the download packages. The versions for Android and iOS, on the other hand, are Decimal only. They could in principle be built with Binary math as well, but due to the way the Android and iOS app stores work, distributing both versions at the same time would be problematic.
Free42 Decimal uses the Intel Decimal Floating-Point Math Library; it uses IEEE 754-2008 quadruple precision decimal floating-point, which consumes 16 bytes per number, and gives 34 decimal digits of precision, with exponents ranging from −6143 to +6144.
Free42 Binary uses the PC's FPU; it represents numbers as IEEE 754 compatible double precision binary floating-point, which consumes 8 bytes per number, and gives an effective precision of nearly 16 decimal digits, with exponents ranging from −308 to +308.
The binary version has the advantage of being much faster than the decimal version; also, it uses less memory. However, numbers such as 0.1 (one-tenth) cannot be represented exactly in binary, since they are repeating fractions then. This inexactness can cause some HP-42S programs to fail.
If you understand the issues surrounding binary floating-point, and you do not rely on legacy software that may depend on the exactness of decimal fractions, you may use Free42 Binary and enjoy its speed advantage. If, on the other hand, you need full HP-42S compatibility, you should use Free42 Decimal.
If you do not fully understand the above, it is best to play safe and use Free42 Decimal.
Free42 Extensions to the HP-42S Instruction Set
This section was last updated on March 4, 2021.Contents
Time and Date FunctionsExtended Functions
BASE Enhancements
Step Into, Step Over, and Step Out
Advanced Subroutine Utilities
Big Stack
Other Extensions
Accelerometer, GPS, and Compass
Time and Date Functions
Free42 provides a number of functions for working with times and dates, and getting the current time and date from the system's real-time clock. These functions are a subset of the functions from the HP-41 Time Module: ADATE ATIME ATIME24 CLK12 CLK24 DATE DATE+ DDAYS DMY DOW MDY TIME, and one additional function, YMD.These functions are documented in detail in the HP-82182A Time Module Owner's Manual and the HP-41CX Owner's Manual, both of which can be viewed on-line here, here, and here.
Note: the date functions handle dates between October 15, 1582, and September 10, 4320. The former is the first day of the Gregorian Calendar, and the latter is 999,999 days later.
The format in which the date functions accept and return dates is MM.DDYYYY when in MDY mode, DD.MMYYYY when in DMY mode, and YYYY.MMDD in YMD mode.
ADATE Appends the contents of the X register to the ALPHA register, formatted as a date value: in DMY mode, DD.MMYYYY is displayed as DD.MM.YYYY; in MDY mode, MM.DDYYYY is displayed as MM/DD/YYYY; and in YMD mode, YYYY.MMDD is displayed as YYYY-MM-DD. In MDY and DMY modes, if the number of digits of the display mode is 4 or less, the century part is omitted; if it is 2 or less, the entire year part is omitted; and if it is 0, the months or days part is omitted (in DMY or MDY mode, respectively). In YMD mode, if the number of digits in the display mode is 2 or less, the day part is omitted, and if it is 0, the month and day parts are omitted.
ATIME Appends the contents of the X register to the ALPHA register, formatted as a time value: HH.MMSSss is displayed as HH:MM:SS.ss. In CLK12 mode, times with HH between −23 and 23 are displayed in 12-hour format: −23 to −13 as −HH−12 PM; −12 to −1 as −HH PM; 0 as 12 AM; 1 to 11 as HH AM; 12 as 12 PM; 13 to 23 as HH−12 PM. When |HH| ≥ 24, the sign is ignored, and HH is shown as is, with no AM or PM appended. In CLK24 mode, HH between −1 and −11 are displayed as −HH+12; all other values are shown as |HH|. No AM or PM are displayed.
If the number of digits of the display mode is 4 or less, the centiseconds part is omitted; if it is 2 or less, the seconds part is omitted; and if it is 0, the minutes part is omitted.
ATIME24 Like ATIME (see above), except it always formats the time in 24-hour format, regardless of the CLK12/CLK24 setting.
CLK12 Display the time in 12-hour format with AM/PM.
CLK24 Display the time in 24-hour format.
DATE Returns the current date to the X register. In MDY mode, the date is returned as MM.DDYYYY; in DMY mode, it is returned as DD.MMYYYY; and in YMD mode, it is returned as YYYY.MMDD. In addition, when executed from the keyboard, this also displays the date formatted as 'MM/DD/YYYY DOW', 'DD.MM.YYYY DOW', or 'YYYY-MM-DD DOW', respectively.
DATE+ Takes a date from the Y register, and adds a number of days from the X register.
DDAYS Calculates the number of days between the date in the Y register and the date in the X register. If the date in the Y register is earlier, then the result will be positive.
DMY Display, return, and accept dates in day/month/year format.
DOW Calculates the day of the week for the date in the X register. Returns a number from 0 to 6, where 0 is Sunday, 1 is Monday, and so on. When this function is executed from the keyboard, the day is also displayed in a human-friendly format, i.e. MON for Monday, TUE for Tuesday, etc.
MDY Display, return, and accept dates in month/day/year format.
TIME Returns the current time in the X register. The time is returned in HH.MMSSss format, with HH from 0 to 23, regardless of the CLK12/CLK24 setting. In addition, when executed from the keyboard, it displays the time in 'HH:MM:SS AM' or 'HH:MM:SS' format, when the display format is CLK12 or CLK24, respectively.
YMD Display, return, and accept dates in year/month/day format.
Extended Functions
The HP-42S includes many of the functions that were first introduced in the HP-82180A Extended Functions & Memory Module for the HP-41, but a few functions were omitted that would have been useful. These were added in Free42 in version 2.5.21.ANUM Scans the ALPHA register for a number, and places it into the X register. If a number is found, the numeric input flag, flag 22, is set.
RCLFLAG Gets the state of all flags and returns them as a complex number. The real part of this number contains flags 0 through 49, and the imaginary part contains flags 50 through 99, encoded as binary integers with the least significant bits corresponding to the lowest-numbered flags.
Note that this format does not match the format returned by the RCLFLAG function in the original Extended Functions & Memory Module or the HP-41CX. The HP-42S has more flags than the HP-41 and the original encoding would not provide room for all of them to fit.
STOFLAG Restores the state of all flags that were retrieved using a previous RCLFLAG. Note that this does not affect the following flags: 27 (CUSTOM), 44 (Continuous On), 45 (Solving), 46 (Integrating), 47 (Variable Menu), 48 (ALPHA mode), 49 (Low Battery), 53 (INPUT), 65 (Matrix Editor), and 75 (Programmable Menu).
You can also choose to restore only a range of flags. With the saved flags in the Y register, and a number bb.ee in X, only flags numbered bb through ee are restored.
X<>F Exchanges flags 0-7 with the X register. The flags are encoded as a binary integer between 0 and 255, with the least significant bits corresponding to the lowest-numbered flags.
BASE Enhancements
The BASE application in the HP-42S has arithmetic and bitwise logic operations that work on 36-bit signed integers. This is not always what's needed, and Free42 2.4 makes BASE more flexible by offering configurable word size (up to 64 bits in Free42 Decimal; up to 53 bits in Free42 Binary), unsigned mode, and a wrapped mode.In n-bit signed mode, the numerical range is from −(2n−1) to 2n−1−1, and in n-bit unsigned mode the numerical range is from 0 to 2n−1.
Wrapped mode changes the behavior when arguments or results go beyond the aforementioned ranges. In the standard, non-wrapped mode, arguments outside of those ranges result in Invalid Data errors, and results outside of those ranges result in Out of Range errors, unless the Range Error Ignore flag (flag 24) is set, in which case the result is the closest value from within the range.
In wrapped mode, parameters and results are held within the allowable range by simply ignoring or discarding any bits to the left of bit n−1. This behavior will be natural to anyone familiar with the behavior of microprocessors, or of integer arithmetic and bitwise logic in C and related programming languages.
Free42 2.4 adds the following functions, in a new row in the MODES menu, for managing the new BASE modes:
Install App On Xcode Simulator App
WSIZE Sets the word size to the number in the X register, which must be between 1 and 64.
WSIZE? Returns the current word size.
BSIGNED Toggles signed mode. In signed mode, numbers are interpreted as two's complement signed integers, like on the real HP-42S and in earlier versions of Free42; in unsigned mode, numbers are always interpreted as non-negative, and negative numbers do not exist. You can check whether signed or unsigned mode is active by checking the MODES menu, where there will be a dot marking the BSGN menu item when signed mode is active. Alternatively, you can check flag 78.
BWRAP Toggles wrapped mode. In wrapped mode, numbers are kept within WSIZE bits by discarding any bits to the left of bit WSIZE−1; in non-wrapped mode, numbers outside of the binary range are not allowed and cause Invalid Data errors when parameters are out of range, or Out of Range errors when results are out of range. You can check whether wrapped or non-wrapped mode is active by checking the MODES menu, where there will be a dot marking the BWRP menu item when wrapped mode is active. Alternatively, you can check flag 79.
BRESET Resets all BASE modes back to their defaults, which match the behavior of the real HP-42S: WSIZE 36, signed, not wrapped.
Step Into, Step Over, and Step Out
Introduced in release 2.1, Free42 offers Step Over and Step Out. People familiar with Integrated Development Environments (IDEs) will probably know the three common types of stepping:SST↓ or Step Into: Executes one line of code, and if the line in question is a function call, the next line to be executed will be the first line of the function being called. That is, you are Stepping Into the function;
SST→ or Step Over: Executes one line of code, and if that line is a function call, it is executed in that one step. You are not Stepping Into the function; rather, you are Stepping Over it.
SST↑ or Step Out: Starts program execution, continuing until just after the end of the current function. You are Stepping Out of the function.
Step Into is the same as the original SST function in the HP-42S. Free42 2.1 adds the alias SST↓ for this function, but its behavior is the same, because it's just another name for the same function. Step Over and Step Out are new functions in 2.1. The three together can be assigned to a row in the CUSTOM menu, for example:
A note about Step Over: for most instructions, Step Over behaves the same as Step Into. In high-level language debuggers, the only difference between the two is with function or method calls. In Free42, Step Over steps over XEQ instructions, those being the keystroke-programming equivalent of function calls, but it also steps over SOLVE and INTEG, while Step Into will step into the function being solved or integrated.
Conversely, if you interrupt program execution while SOLVE or INTEG are active, Step Out will cause execution to continue until SOLVE or INTEG are done, as if SOLVE or INTEG are a kind of XEQ.
Advanced Subroutine Utilities
FUNC Prepare user-defined function. Save the contents of the stack and LASTx; when the function returns, this saved data will be used to restore the stack such that it looks as if a built-in function has executed.FUNC takes a two-digit numeric parameter. Each digit can be from 0 to 4. The first digit indicates the number of parameters consumed by the user-defined function, and the second digit indicates the number of values returned. For example, for a function that takes two parameters and returns one result, you should call FUNC 21, and when the function returns, the previous value of Z will be returned in Y, the previous value of T will be returned in Z and T, and the previous value of X will be returned in LASTx.
The stack restoration happens as described above when the function returns using RTN, END, RTNYES, or RTNNO. When the function returns using RTNERR, all four stack registers and LASTx are restored, regardless of the parameter given to FUNC.
FUNC also saves the state of flag 25 and causes it to be restored when the function returns. After saving it, flag 25 is cleared, so the function itself will always start with flag 25 in a known state.
LSTO, introduced in Free42 2.2, can be used to create local variables. These are variables that exist only for the duration of the current subroutine, and are automatically deleted when it returns. For example, the following is a recursive implementation of the factorial, using the local variable T to preserve the stack register T, and using the local variable N to keep track of the parameter across the recursive call to compute FAC(N−1): Since local variables make it possible to implement recursive algorithms that the real HP-42S can't handle, it also becomes much more useful to have a larger return stack. While the real HP-42S, and older versions of Free42, have an 8-level RTN stack, Free42 2.2 has 1024 RTN levels.
LASTO Relates to LSTO like ASTO relates to STO.
RTNERRn Return Error from a function. It raises an error based on the parameter n, as follows: Execution is halted on the XEQ that called the function, unless flag 25 was set, in which case flag 25 is cleared and execution continues.
If the stack was saved using FUNC, this restores the stack to its initial state, regardless of the argument given to FUNC.
RTNNO Return from conditional function. To be used by functions that act as conditionals. RTNNO causes the line after the calling XEQ to be skipped, or, if the function was called from the keyboard, it will display the message 'No', like a built-in conditional.
Install App On Xcode Simulator Software
RTNYES Return from conditional function. To be used by functions that act as conditionals. RTNYES is like RTN, except if the function was called from the keyboard, it will display the message 'Yes', like a built-in conditional.
X=?X≠?X<?X>?X≤?X≥? Compare X to any argument. Similar to X=Y?, X≠Y?, etc., except these functions allow you to compare X to any register or variable, not just to Y.
0=?0≠?0<?0>?0≤?0≥? Compare any argument to 0. Similar to X=0?, X≠0?, etc., except these functions allow you to compare any register or variable to 0, not just X.
Big Stack
Free42 3.0 introduces the option of using a dynamic stack, also known as Big Stack. In this mode, the stack can grow arbitrarily deep, limited only by available memory. This is similar to the stack in the HP-28/48/49/50 series calculators.Install App On Xcode Simulator Pc
Big Stack mode is quite powerful, but please be aware that existing programs will typically not work correctly in this mode, since they expect the fixed four-level stack. Use this mode only for programs you have verified to be compatible, or for programs specifically written for Big Stack mode.
In order to prevent users from unwittingly using this mode, it is initially disabled and hidden; before being able to use it, you must first select the option Allow Big Stack (NSTK) mode in the Preferences. Once this is enabled, you may switch back and forth between the classic four-level stack and the new dynamic stack using the 4STK and NSTK functions, found in the MODES menu.
When Allow Big Stack (NSTK) mode is enabled, a set of additional stack functions is added to the CATALOG, in a separate STK section. They are:
NSTK N-level Stack. Turns on big stack mode.
4STK 4-level Stack. Turns off big stack mode, returning to the TZYX stack.
LNSTK and L4STK Local N-level / 4-level Stack. These switch to N-level or 4-level stack mode, respectively, but in addition, they automatically restore the previous stack mode when the current function returns. Further, L4STK saves levels 5 and up in a hidden list, and also restores them when the previous stack mode is restored. (The non-local 4STK function simply discards levels 5 and up.) All of these functions are no-ops when the selected stack mode is already active.
DEPTH Returns the current stack depth.
DROP and DROPNn Drops level 1, or levels 1..n. In 4-level mode, the stack is replenished with zeroes from the top.
DUP and DUPNn Duplicates level 1, or levels 1..n. In 4-level mode, n must be 2 or less.
R↓Nn and R↑Nn Rolls levels 1..n down or up. Note that the standard R↓ and R↑ are equivalent to R↓N depth and R↑N depth.
PICKn and UNPICKn Gets the object from level n, or puts an object into level n. Note that UNPICK consumes the contents of level 1, unlike STO, and n refers to the stack level number after X has been dropped. The effect is that you can modify an object at level n by doing PICK n, <modify the object>, UNPICK n, without having to add 1 to the level number for UNPICK. Also note that this is similar to the behavior of PICK and UNPICK in RPL.
Other Extensions
FMA Fused Multiply-Add. Calculates Z*Y+X using the underlying platform's native FMA function, as provided by the floating-point hardware or library.
GETKEY1 This function works like the regular GETKEY, except it does not halt program execution when EXIT or Shift-EXIT are pressed, allowing programs to implement custom behaviors for those keys. GETKEY1 does halt on R/S, like GETKEY.
NOP No Operation. Can be used as a filler when ISG is used in a way where it will always skip the next instruction, like when using it as a counter with no upper limit. In raw files, this instruction is encoded as 0xF0, which corresponds to TEXT 0 in the HP-41, which is sometimes used as a synthetic NOP on that platform.
PGMMENU PGM Menu. Presents a menu of all global labels that have MVAR instructions. When the user makes a selection, the label name is placed in the ALPHA register, and program execution is resumed, similar to the way VARMENU handles a selection. This function allows programs to implement behavior similar to the top-level SOLVER and ∫f(x) menus.
PRMVAR Print MVAR variables. This prints all the variables associated with the given LBL through MVAR declarations, in other words, the contents of the VARMENU for that label.
STRACE Stack Trace mode. This turns on a new print mode, which is a variation on TRACE mode, printing the entire stack instead of just X. This can be a valuable debugging tool, but it generates large amounts of output!
Accelerometer, GPS, and Compass
Free42 for Android and iOS have three functions to query the device's hardware. They are:ACCEL Query the accelerometer. The three components of the acceleration vector are returned in the X, Y, and Z registers. Holding the device facing you, in portrait orientation, and the dock connector pointing towards the floor, positive X is acceleration toward the left, positive Y is acceleration downwards, and positive Z is acceleration away from you — or, in terms of gravity, positive X is gravity pulling to the right, positive Y is gravity pulling upwards, and positive Z is gravity pulling toward you.
Note: Accelerations are returned in units of Earth gravities, not m/s2 as you might expect. The iOS API documentation states that the unit used is 9.81 m/s2, and those values are returned unchanged by the ACCEL function. On Android, the API returns the accelerations in m/s2, and these are converted by Free42 to gravities using the 'standard gravity' of 9.80665 m/s2.
LOCAT Query GPS. The location is returned as follows: latitude in X, longitude in Y, elevation in Z, and horizontal and vertical accuracy in a two-element vector in T. The latitude and longitude are given in decimal degrees, with North and East being positive; the elevation and accuracies are given in meters. If an accuracy is −1, that means that the corresponding measurement is not valid.
HEADING Query the compass. This returns the following data: magnetic heading in X, true heading in Y, heading accuracy in Z, and the raw magnetic vector in a three-element vector in T. The headings and accuracy are given in degrees, where North is 0, East is 90, and so on; the components of the magnetic vector are given in microteslas. The components are oriented with respect to the device along the same axes as the accelerometer readouts.
HP-42S Undocumented [MIN], [MAX], and [FIND] Functions
The HP-42S has three undocumented matrix functions, [MIN], [MAX], and [FIND]. They are not mentioned in the HP-42S Owner's Manual, but they are functional.Note that the brackets are part of the function names.
[MIN] finds the lowest element of the current column, starting at the current row, of the indexed matrix, and returns the element to X and the row where it was found to Y;
[MAX] is like [MIN] except it finds the highest element; if the minimum or maximum is not unique (it is found in more than one row), the highest matching row is returned. [MIN] and [MAX] require the indexed matrix to be a real matrix, and they do not allow string elements in the column being searched.
[FIND] locates a specific value, searching the indexed matrix left to right and top to bottom. The function works as a conditional: when a program is running, the following instruction is executed if a match is found, and skipped if a match is not found; when executed interactively, the display shows 'Yes' if a match is found and 'No' if not.
Also, if a match is found, I and J are set to point to it.
The indexed matrix may be real or complex, and the search value may be real, complex, or string; real or string values are only found in real matrices, and complex values are only found in complex matrices; in other words, 5 is not considered equal to 5 + 0i -- mathematically speaking this is wrong, but on the other hand it is consistent with the behavior of the X=Y? and X≠Y? functions.
Frequently Asked Questions
This FAQ was last updated on January 8, 2021.Contents
Why does my HP-42S program not work properly in Free42?Do the Android and iOS versions have a menu?
Why does Haptic Feedback not work on my iPhone / iPad / iPod touch?
Why does OFF not work in the iOS version?
Why am I getting results that are rounded to integers?
Why am I getting Size Error when I try to access any of the numbered storage registers, or try to use any of the statistics functions?
How do I assign SST↓ (Step Into) to the CUSTOM menu?
Why is nothing showing up in the Print-Out?
Why does my HP-42S program not work properly in Free42?
There are several potential reasons why an HP-42S program might not workcorrectly in Free42. To get the most obvious out of the way first: make sure tocheck that you entered the program correctly, and that the relevant settings,such as register size, angular and display modes, etc., are all correct.Having ruled out human error, the reasons an HP-42S program may not work correctly in Free42 are:
- Different floating-point format
The HP-42S represents numbers with a 12-digit decimal mantissa, and an exponent from 10−499 to 10499; Free42 Decimal uses a 34-digit decimal mantissa, and an exponent from 10−6143 to 106144; and Free42 Binary uses native binary floating-point, which on all currently supported platforms is IEEE-754 double precision, with a 53-bit binary mantissa which is roughly equivalent to 16 decimal digits, with an exponent from 10−308 to 10308.
These differences can cause Free42 to calculate different results than the HP-42S. For example, 1 ENTER 3 1/x − LASTX − LASTX − returns 1e−12 on the HP-42S but 1e−34 on Free42 Decimal, because of the wider mantissa; 1 ENTER .2 − .2 − .2 − .2 − .2 − returns 0 on the HP-42S but 5.55111512313e−17 on Free42 Binary, because 0.2 is a repeating fraction in binary.
Most of these kinds of compatibility problems can be avoided by using Free42 Decimal, but, although they are rare, there are programs that don't work correctly even in Free42 Decimal. Mostly these are programs that specifically rely on the size of the mantissa and/or the range of the exponent, but the extra precision of Free42 Decimal can also potentially throw off straightforward numerical algorithms, for example, if they use termination conditions that aren't robust.
- Free42 defaults to decimal-point or decimal-comma mode depending on locale
If your computer / smartphone / tablet is set to a locale where the decimal is a comma, Free42 is set to RDX, (radix comma) mode on hard reset; in all other locales, it is set to RDX. (radix dot) mode on hard reset. If you're seeing incorrectly formatted data in your program's output, you may have to switch to RDX. mode (RDX. in the MODES menu, or SF 28).
Do the Android and iOS versions have a menu?
The Android and iOS versions do have a menu, which you will need to selectskins, change settings in the Preferences, etc. To activate this menu, tap onthe screen, anywhere below the status bar (orthe top of the screen if there is no status bar) down to the top half of thedisplay.Why does Haptic Feedback not work on my iPhone / iPad / iPod touch?
The hardware and OS support needed for Haptic Feedback is currently only availableon the iPhone 7 and later. Older iPhone models don't have it, and neither do anyiPad or iPod touch models.Unfortunately, iOS does not provide apps with a way to detect whether the devicesthey're running on have Haptic Feedback support or not, and so, in order to makesure that the option is available on all devices that do have thatsupport, I have no choice but to put the Haptic Feedback switch in thePreferences screen on all devices.
If Apple ever adds a way to detect Haptic Feedback support, I'll change thePreferences screen so the Haptic Feedback switch is hidden or disabled ondevices where it's of no use, but until then, the current confusing situationwill continue. My apologies!
Why does OFF not work in the iOS version?
Apple's User Interface guidelines for iOS specify that apps should not havecommands for exiting the app; exiting should only take place at theoperating system's request, which in turn will only happen when the userpresses the home button or uses the task switcher. Thus, the Free42 OFFcommand causing the app to exit was a violation of those guidelines.For the longest time, Apple didn't seem to mind, but when I submitted1.4.75a, it was rejected because of this issue. I had no choice but tocomply, and so now, OFF just beeps, and OFF in a program causes the programto stop.
For people who liked and used the original OFF functionality, I added aback door to re-enable that behavior. Follow these steps:
Enter ALPHA mode: ShiftENTER
Type YESOFF using the ALPHA menu: XEQ√xΣ+
Store the text in the X register using ASTO ST X: STO.√x
Perform OFF: ShiftEXIT
With the string YESOFF in the X register, OFF works again. You only have todo this once; executing OFF this way sets a hidden flag telling Free42 toalways perform the old-style OFF behavior from then on, regardless of thecontents of the X register.
If you ever uninstall and reinstall Free42, you will have to repeat theprocedure. You will not have to repeat the procedure when you get updates.
Why am I getting results that are rounded to integers?
You're doing, say 7 ENTER 2 ÷, in FIX 04 mode, and the result is 3.0000, while itshould of course be 3.5000.When this happens, it's because the calculator is in BASE mode. You can verifythis by pressing and holding any of the arithmetic or +/− keys: in BASE mode,they perform BASE÷, BASE×, BASE−, BASE+, and BASE+/−, respectively, and thesecommands interpret their arguments as 36-bit signed binary integers, and returnresults within those same constraints.
To get back to normal behavior, leave the BASE application by pressing EXIT untilno menu is shown in the display.
Why am I getting Size Error when I try to access any of the numbered storage registers, or try to use any of the statistics functions?
Usually, Size Error means you're trying to access a numbered register that doesn'texist, i.e. the SIZE setting (in the MODES menu) is set too low. By default, thesetting is SIZE 0025, which means you have registers numbered from 00 through 24.When even RCL 00 returns Size Error, however, that usually means that the REGSmatrix was inadvertently deleted. This also causes all statistical functions tofail, since they all use numbered registers to access the summation data.
To fix this, and restore REGS to its default size, say SIZE 0025: Shift+/−▼Σ+0025.
How do I assign SST↓ (Step Into) to the CUSTOM menu?
SST↓, also known as Step Into, introduced in Free42 2.1, is not a new function;rather, it is a new spelling of the existing SST function. Since functions arelisted in the FCN catalog by their primary spelling only, this leads to the questionof how to assign SST↓ to the CUSTOM menu, with the arrow.The answer is to spell it out using the ALPHA menu: Shift1
(Replace Σ+ with whichever key in the CUSTOM menu you want to assign SST↓ to.)