On this page:
Default Decimal Format, Short Number Format, Apostrophe Format, Output Format Commands, Seeing Results with 18 Digits, Converting Decimal/Hexadecimal/Binary, Output Format and Result File hy.
By default, Hypatia shows integer numbers with up to 18 digits and floating point numbers with up to 15 digits.
When numbers are very small or very large, they are shown in scientific notation.
Hypatia's format commands let you chose different output formats.
All format commands begin with the letter F.
Format commands only affect how results are shown, they do not change their actual values.
In many cases seeing results with up to 15 digits can be more of a distraction than a desired feature. When such accuracy is not required, you can chose to see only a maximum of 9 digits.
FSHORT sets the maximum number of significant floating point digits to 9.
FLONG sets the maximum number of significant floating point digits back to the default of 15.
You can add the command FSHORT to the file hy.ini to make 9 digits the default.
By default Hypatia structures numbers that have more than 3 digits before the decimal point by inserting apostrophes every three digits (every 4 digits for hexadecimal numbers, every 8 digits for binary numbers).
The command F' OFF turns this feature off, F' ON turns it on, F' toggles it.
(This is different behavior from other ON/OFF commands, which display their status when used without ON or OFF.)
If you want apostrophe format disabled by default, add the line F' OFF to the file hy.ini.
You can use apostrophes in numbers that you write, they will simply be ignored.
FDEC means default decimal format, scientific notation for large or small numbers.
FDEC n means show results with n digits after the decimal point.
FDEC -n means show results with at least n digits before the decimal point (adding leading zeros if necessary).
FDEC 0 means show numbers without decimal digits (that is, rounded to integer).
FSCI means show results in scientific notation with 15 digits (9 digits with FSHORT) and exponent.
FHEX means show results in hexadecimal format (only positive integer numbers, the maximum is 12 hexadecimal digits).
FHEX n means hexadecimal format, with at least n digits (n must be 2 to 12).
FBIN means show results in binary format (only positive integer numbers, the maximum is 48 binary digits).
FBIN n means binary format, with at least n digits (n must be 2 to 48).
FMILLION means decimal format, numbers larger or equal one million are shown in million.
FLAKH means decimal format, numbers larger or equal one hundred thousand are shown in lakh, numbers larger or equal ten million in crore.
When numbers cannot be shown in the chosen format, they are shown in the default decimal format.
Independent of the currently chosen format, the command == displays the last result in decimal format with up to 18 digits.
This will not be written to to the result file hy.
Note that with floating point numbers anything beyond 15 significant digits will be unreliable.
It is very simple to convert between decimal, hexadecimal and binary numbers:
Set the format into which you want to convert by using the format commands FDEC (which is default), FHEX or FBIN, then enter the number in the format from which you want to convert, using the &h or &b prefixes for hexadecimal or binary numbers.
You can perform calculations for instance with hexadecimal numbers by choosing hexadecimal output format with FHEX, and then use hexadecimal numbers with the &h prefix in your calculations.
If you give a format command after having entered a number, it will be shown in the newly chosen format -- this is true for any calculation results.
Changing the format will not update the result file hy, though.
The command = likewise shows the recent result in the currently chosen format, but does not update hy.
Results always get written to hy in the currently chosen format, if possible.
If you give a format command after a calculation the result will be shown in the new format, but hy will still have the result in the previously chosen format.
You have to use the command $ to write the result to hy in the new format (for instance, if you want to copy it to the clipboard with the command COPY).
$ on its own, unlike any other value or variable on its own (which still are calculations) is a command, though this is a technical detail that in practical use will make little difference.
The command $ does not work in a script ($ & does, though, as will be discussed in the context of accumulation mode -- see page Result Commands in chapter "Results").