Skip to content

Commit

Permalink
Support for var=a variable assignment syntax; Remove expired code; In…
Browse files Browse the repository at this point in the history
…crement version number; Update translations; Update metainfo; Update manual
  • Loading branch information
hanna-kn committed Aug 22, 2022
1 parent 210b768 commit 8c90643
Show file tree
Hide file tree
Showing 36 changed files with 6,782 additions and 6,748 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -1,3 +1,7 @@
2022-08-13 Hanna Knutsson <hanna.knutsson@protonmail.com>

* Support for var=a syntax for variable assignment

2022-05-20 Hanna Knutsson <hanna.knutsson@protonmail.com>

* Fix scaling of result (when it does not fit)
Expand Down
2 changes: 1 addition & 1 deletion README
Expand Up @@ -12,7 +12,7 @@ Qt, and CLI).
1. Requirements

* GTK (>= 3.10)
* libqalculate (>= 4.2.0)
* libqalculate (>= 4.3.0)

2. Installation

Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -6,7 +6,7 @@ Qalculate! is a multi-purpose cross-platform desktop calculator. It is simple to

## Requirements
* GTK (>= 3.10)
* libqalculate (>= 4.2.0)
* libqalculate (>= 4.3.0)

## Installation
Instructions and download links for installers, binaries packages, and the source code of released versions of Qalculate! are available at https://qalculate.github.io/downloads.html.
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Expand Up @@ -6,7 +6,7 @@ dnl ----------------------
dnl | initialize autotools |---------------------------------------------------
dnl ----------------------

AC_INIT([Qalculate! (GTK UI)],[4.2.0],[],[qalculate-gtk])
AC_INIT([Qalculate! (GTK UI)],[4.3.0],[],[qalculate-gtk])
AC_CONFIG_SRCDIR([src/callbacks.cc])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS(config.h)
Expand Down Expand Up @@ -111,7 +111,7 @@ AS_IF([test "x$with_local_help" != "xno"], [
AM_CONDITIONAL(ENABLE_LOCAL_HELP, [test "x$with_local_help" != "xno"])

PKG_CHECK_MODULES(QALCULATE, [
libqalculate >= 4.2.0
libqalculate >= 4.3.0
])
AC_SUBST(QALCULATE_CFLAGS)
AC_SUBST(QALCULATE_LIBS)
Expand Down
Binary file modified data/flags/RUB.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions data/qalculate-gtk.appdata.xml.in
Expand Up @@ -48,6 +48,32 @@
</provides>
<translation type="gettext">qalculate-gtk</translation>
<releases>
<release version="4.3.0" date="2022-08-22">
<description>
<p>Changes:</p>
<ul>
<li>Fix handling of Unicode powers for units in denominator, with adaptive parsing enabled (e.g. parse 10m/s² the same as 10m/s^2)</li>
<li>Fix "+" ignored after "E" in number bases where "E" is a digit</li>
<li>Fix scientific E notation with sign in argument when function is used without parentheses</li>
<li>Fix lambertw() for values very close to zero</li>
<li>Fix a*b^x+cx=d when a and c have different signs and d is non-zero</li>
<li>Fix a^x+b^x=c when a and b is negative, and c is positive</li>
<li>Fix segfaults in some corner cases</li>
<li>Fix potential issues in handling of leap seconds (e.g. during subtraction of seconds from date)</li>
<li>var=a syntax for variable assignment with calculated expression</li>
<li>Replace ounce with fluid ounce during conversion to volume unit</li>
<li>Solve a^x+b^x+...=c in more cases</li>
<li>Improve remainder/modulus for numerators with large exponents</li>
<li>Truncate number in output of parsed expression and end with ellipsis if unable to display all decimals</li>
<li>Improved floating point calculation and output speed, particularly for simple expressions with very high precision</li>
<li>New functions: clip(), qFormat(), qError()</li>
<li>Replace selection (instead of wrap in parentheses) on operator input if selection ends with operator</li>
<li>Act as if two arguments are required when applying base-N logarithm to expression</li>
<li>When applying function to expression, exclude to/where expression and place cursor before closing parenthesis if operator is last in selection</li>
<li>Minor bug fixes and feature enhancements</li>
</ul>
</description>
</release>
<release version="4.2.0" date="2022-05-25">
<description>
<p>Changes:</p>
Expand Down
4 changes: 2 additions & 2 deletions doc/C/qalculate-gtk-C.omf
Expand Up @@ -8,9 +8,9 @@
Qalculate! Manual
</title>
<date>
2022-04-04
2022-08-22
</date>
<version identifier="4.2.0" date="2022-05-25" description=""/>
<version identifier="4.3.0" date="2022-08-22" description=""/>
<subject category="GNOME|Applications|Accessories"/>
<description>
This is the Qalculate! manual
Expand Down
14 changes: 7 additions & 7 deletions doc/C/qalculate-gtk.xml
Expand Up @@ -2,9 +2,9 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY legal SYSTEM "legal.xml">
<!ENTITY appversion "4.2.0">
<!ENTITY manrevision "4.2.0">
<!ENTITY date "May 2022">
<!ENTITY appversion "4.3.0">
<!ENTITY manrevision "4.3.0">
<!ENTITY date "August 2022">
<!ENTITY app "Qalculate!">
<!ENTITY appendixa SYSTEM "appendixa.xml">
<!ENTITY appendixb SYSTEM "appendixb.xml">
Expand Down Expand Up @@ -1656,9 +1656,9 @@ The following operators are defined in &app; and may be used in expressions. Wor
</row>
<row valign="top">
<entry><para>Save as Variable/Function</para></entry>
<entry align="center"><para>:=</para></entry>
<entry><para>Saves the value or expression to the right of the operator as a variable or function (as <command>save</command>.</para></entry>
<entry align="center"><para>var1:=5</para><para>func1()=x+y</para></entry>
<entry align="center"><para>:=, =</para></entry>
<entry><para>Saves the value or expression to the right of the operator as a variable or function (as <command>save()</command> function). If colon is omitted, the expression is calculated before it is assigned to the variable.</para></entry>
<entry align="center"><para>var1:=5</para><para>func1():=x+y</para><para>var1=ln(5)+2</para></entry>
<entry align="right"><para></para></entry>
</row>
</tbody>
Expand Down Expand Up @@ -2119,7 +2119,7 @@ Known variables can also be created from scratch by selecting <menuchoice><guime
</screenshot>
</figure>
<para>
Alternatively values can be stored in variables using the <command>save()</command> function or the associated <quote>:=</quote> operator (e.g. <quote>save(v1, 5)</quote> or <quote>v1:=5</quote>).
Alternatively values can be stored in variables using the <command>save()</command> function, or the associated <quote>:=</quote>/<quote>=</quote> operators (e.g. <quote>save(v1, 5)</quote> or <quote>v1:=5</quote>, <quote>save(v1, ln(5)+2,,,1)</quote> or <quote>v1=ln(5)+2</quote>).
</para>
<para>
The dialog for creation of unknown variables are accessed by selecting <menuchoice><guimenu>File</guimenu><guisubmenu>New</guisubmenu><guimenuitem>Unknown Variable</guimenuitem></menuchoice>. Instead of a value, an assumed type and sign can then be selected.
Expand Down
2 changes: 1 addition & 1 deletion doc/html/index.html

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions doc/html/qalc.html
Expand Up @@ -83,7 +83,8 @@ <h1>QALC man page</h1>
<div class="level0"><span Class="bold">approximate</span> Equivalent to set approximation try exact. <p/></div>
<div class="level0"><span Class="bold">assume assumptions</span> Set default assumptions for unknown variables (unknown, non-zero, positive, negative, non-positive, non-negative + number, real, rational, integer, boolean). <p/></div>
<div class="level0"><span Class="bold">base base</span> Sets the result number base (equivalent to set base). <p/></div>
<div class="level0"><span Class="bold">clear</span> Clear the screen <p/></div>
<div class="level0"><span Class="bold">clear</span> Clears the screen <p/></div>
<div class="level0"><span Class="bold">clear history</span> Clears the expression history <p/></div>
<div class="level0"><span Class="bold">delete name</span> Removes the user-defined variable or function with the specified name. <br>Example: delete var1. <p/></div>
<div class="level0"><span Class="bold">exact</span> Equivalent to set approximation exact. <p/></div>
<div class="level0"><span Class="bold">expand</span> Expands the current result. <p/></div>
Expand Down Expand Up @@ -185,6 +186,7 @@ <h1>QALC man page</h1>
<div class="level0"><span Class="bold">sync units, sync (on*, off)</span> <p/></div>
<div class="level0"><span Class="bold">temperature units, temp (hybrid*, absolute, relative)</span> Determines how expressions with temperature units are calculated (hybrid acts as absolute if the expression contains different temperature units, otherwise as relative). <p/></div>
<div class="level0"><span Class="bold">update exchange rates, upxrates (-1 = ask*, 0 = never, &gt; 0 = days)</span> <p/>Other: <p/></div>
<div class="level0"><span Class="bold">clear history (yes, no*)</span> Do not save expression history on exit. <p/></div>
<div class="level0"><span Class="bold">ignore locale (yes, no*)</span> Ignore system language and use English (requires restart). <p/></div>
<div class="level0"><span Class="bold">rpn (on, off*)</span> Activates the Reverse Polish Notation stack. <p/></div>
<div class="level0"><span Class="bold">save definitions (yes*, no)</span> Save functions, units, and variables on exit. <p/></div>
Expand All @@ -193,7 +195,7 @@ <h1>QALC man page</h1>
<div class="level0">Mathematical entities: </div>
<div class="level1"><p/><span Class="bold">Numbers</span> <br>These are the regular numbers composed by digits 0-9 and a decimal sign — a dot, or a comma if it is the default decimal point in the locale/language used. If comma is used as decimal sign, the dot is still kept as an alternative decimal sign, if not explicitly deactivated. Numbers include integers, real numbers, and complex numbers. The imaginary part of complex numbers are written with as regular number followed by the special variable "i" (can be changed to a "j"), which represents the square root of -1. Spaces between digits are ignored ("5 5 = 55"). "E" (or "e") can be considered as a shortcut for writing many zeroes and is equivalent to multiplication by 10 raised to the power of the right-hand value (e.g. "5E3 = 5000"). Sexagesimal numbers (and time) can be entered directly using colons (e.g. "5:30 = 5.5"). A number immediately preceded "0b", "0o", "0d" or "0x" are interpreted as a number with base 2, 8, 12 or 16, respectively (e.g. "0x3f = 63"). <p/><span Class="bold">Intervals</span> <br>A number interval can be entered using the interval() function, the uncertainty() function, or using "±" or "+/-" (e.g. 5±1 = uncertainty(5, 0.2) = interval(4, 6)). If the read precision option is activated, decimal numbers are interpreted as an interval between the numbers that are normally rounded to the entered number (e.g. 1.1 = 1.1±0.05). If interval calculation using variance formula is activated (default), the interval represents the standard uncertainty (deviation) of the value. <p/><span Class="bold">Vectors and Matrices</span> <br>A matrix is a two-dimensional rectangular array of mathematical objects. Vectors are matrices with only one row or column, and thus one-dimensional sequences of objects. Vectors and matrices are generated by various functions, or using syntax in the form of [1 2 3 4] and [1 2; 3 4], with columns separated by space or comma and rows separated by semi-colon, or (1, 2, 3, 4) and ((1, 2), (3, 4)). <p/><span Class="bold">Variables/Constants</span> <br>See the list of variables in the GUI manual or using the command .I list variables <p/><span Class="bold">Functions</span> <br>See the list of functions in the GUI manual or using the command .I list functions <p/><span Class="bold">Units and Prefixes</span> <br>See the list of units and prefixes in the GUI manual or using the command .I list units. Abbreviated, plural and singular forms of unit names and prefixes are generally allowed. Prefixes must be put immediately before the unit to be interpreted as prefixes (eg. 5 mm = 0.005 m, but 5 m m = 5 m^2). For convenience units allow the power operator to be left out (e.g. 5 m2 = 5 m^2), with currencies excluded. <p/><span Class="bold">Unknowns</span> <br>Unknowns are text strings without any associated value. These are temporary unknown variables with default assumptions. Unknowns can also be explicitly entered by placing a backslash (\) before a single character (e.g. 5\a + 2\b) or using quotation mark before and after a text string (e.g. 5 "apples" + 2 "bananas"). If unknowns are activated characters without any associated variable, function or unit in an expression, will be regarded as an unknown variable. <p/><span Class="bold">Date and Time</span> <br>Date/time values are specified using quoted text string (quotation marks are not needed for function arguments), using standard date and time format (YYYY-MM-DDTHH:MM:SS). Some local formats are also supported, but not recommended. The local time zone are used, unless a time zone is specified at the end of the time string (Z/UTC/GMT or +/-HH:MM). Date/time supports a small subset of arithmetic operations. The time units represents calendar time, instead of average values, when added or subtracted to a date. <p/><span Class="bold">Text</span> <br>This category represent a number of different function argument types, such as regular text and file names. They can, but do not need to be put in quotes except when containing the argument separator. <p/><span Class="bold">Comments</span> <br>All text after a hashtag (e.g. (5*2)/2 #calculating triangle area) is treated as a comment. </div>
<div class="level0"><p/>Operations and operators (word operators such as AND must be surrounded by space): </div>
<div class="level1"><p/><span Class="bold">Addition (+)</span> <p/><span Class="bold">Subtraction (-)</span> <p/><span Class="bold">Multiplication (*)</span> <p/><span Class="bold">Division (/)</span> <p/><span Class="bold">Remainder (%, rem) and modulo (%%, mod)</span> <br>Returns the remainder after division. <p/><span Class="bold">Integer division (//, div)</span> <br>Rounds the result of division towards zero. <p/><span Class="bold">Exponentiation (^, **)</span> <br>Note that x^y^z equals x^(y^z), and not (x^y)^z. Note also that for non-integer exponents with negative bases, the principal root is returned and not the real root ((-8)^(1/3) equals 1 + 1.73i, and not -2). To calculate the real root for negative values, use the cbrt() and root() functions. <p/><span Class="bold">10^x (E)</span> <p/><span Class="bold">Parenthesis ((, ))</span> <p/><span Class="bold">Parellel sum (∥, ||)</span> <br>Returns the the reciprocal value of a sum of reciprocal values. || is interpreted as parallel if units are used, otherwise as logical OR. <p/><span Class="bold">Logical operators (!, NOT, ||, OR, &&, AND, XOR, NOR, NAND)</span> <p/><span Class="bold">Bitwise operators (~, |, &, &lt;&lt;, &gt;&gt;, XOR)</span> <p/><span Class="bold">Comparison operators (=, !=, &lt;, &lt;=, &gt;, &gt;=)</span> <br>Returns 1 if expression is true and 0 if false. The x variable is isolated if the expression does not evaluate as true or false. Primarily used for equations and inequalities. <p/><span Class="bold">Dot product (.)</span> <p/><span Class="bold">Element-wise operators (.*, ./, .^)</span> <p/><span Class="bold">Save operator (:=)</span> <br>Saves the expression to the right of the operator as a variable or function (e.g. var1:=5, func1():=x+y). </div>
<div class="level1"><p/><span Class="bold">Addition (+)</span> <p/><span Class="bold">Subtraction (-)</span> <p/><span Class="bold">Multiplication (*)</span> <p/><span Class="bold">Division (/)</span> <p/><span Class="bold">Remainder (%, rem) and modulo (%%, mod)</span> <br>Returns the remainder after division. <p/><span Class="bold">Integer division (//, div)</span> <br>Rounds the result of division towards zero. <p/><span Class="bold">Exponentiation (^, **)</span> <br>Note that x^y^z equals x^(y^z), and not (x^y)^z. Note also that for non-integer exponents with negative bases, the principal root is returned and not the real root ((-8)^(1/3) equals 1 + 1.73i, and not -2). To calculate the real root for negative values, use the cbrt() and root() functions. <p/><span Class="bold">10^x (E)</span> <p/><span Class="bold">Parenthesis ((, ))</span> <p/><span Class="bold">Parellel sum (∥, ||)</span> <br>Returns the the reciprocal value of a sum of reciprocal values. || is interpreted as parallel if units are used, otherwise as logical OR. <p/><span Class="bold">Logical operators (!, NOT, ||, OR, &&, AND, XOR, NOR, NAND)</span> <p/><span Class="bold">Bitwise operators (~, |, &, &lt;&lt;, &gt;&gt;, XOR)</span> <p/><span Class="bold">Comparison operators (=, !=, &lt;, &lt;=, &gt;, &gt;=)</span> <br>Returns 1 if expression is true and 0 if false. The x variable is isolated if the expression does not evaluate as true or false. Primarily used for equations and inequalities. <p/><span Class="bold">Dot product (.)</span> <p/><span Class="bold">Element-wise operators (.*, ./, .^)</span> <p/><span Class="bold">Save operator (:=, =)</span> <br>Saves the expression to the right of the operator as a variable or function (e.g. var1:=5, func1():=x+y, var1=ln(5)+2). If the colon is omitted the expression is calculated before it is assigned to the variable. </div>
<div class="level0"><p/><span Class="bold">Evaluation priority order:</span> parenthesis, 10^x, exponentiation, functions, bitwise NOT, logical NOT, multiplication/division/remainder, parallel sum, addition/subtraction, bitwise NOT, bitwise shift, comparisons, bitwise AND, bitwise XOR, bitwise OR, logical AND, logical OR. <p/>The evaluation of short/implicit multiplication without any multiplication sign (e.g. 5x, 5(2+3)), differs depending on the parsing mode. In the conventional mode implicit multiplication does not differ from explicit multiplication (12/2(1+2) = 12/2*3 = 18, 5x/5y = 5 * x/5 * y = xy). In the parse implicit multiplication first mode, implicit multiplication is parsed before explicit multiplication (12/2(1+2) = 12/(2 * 3) = 2, 5x/5y = (5 * x)/(5 * y) = x/y). The default adaptive mode works as the parse implicit multiplication first mode, unless spaces are found (1/5x = 1/(5 * x), but 1/5 x = (1/5) * x). In the adaptive mode unit expressions are parsed separately (5 m/5 m/s = (5 * m)/(5 * (m/s)) = 1 s). Function arguments without parentheses are an exception, where implicit multiplication in front of variables and units is parsed first regardless of mode (sqrt 2x = sqrt(2x)). <p/>In chain mode, expressions are calculated from left to right, ignoring standard order of operations, like the immediate execution mode of a traditional calculator (1+2*3 = (1+2)*3 = 9). <p/>The "to"-operator is used for unit conversion and manipulation of how the result is presented. Place " to " or a right arrow (e.g. "-&gt;") followed by one of expressions/commands the below, at the end of an expression. <p/></div>
<div class="level0"><span Class="bold">Unit conversion</span> - a unit or unit expression (e.g. meter or km/h) <br>prepend with ? to request the optimal prefix <br>prepend with b? to request the optimal binary prefix <br>prepend with + or - to force/disable use of mixed units <br>- a variable or physical constant (e.g. c) <br>- base (convert to base units) <br>- optimal (convert to optimal unit) <br>- mixed (convert to mixed units, e.g. hours + minutes) <p/></div>
<div class="level0"><span Class="bold">Number base conversion</span> - bin, binary (show as binary number) <br>- bin# (show as binary number with specified number of bits) <br>- oct, octal (show as octal number) <br>- duo, duodecimal (show as duodecimal number) <br>- hex, hexadecimal (show as hexadecimal number) <br>- hex# (show as hexadecimal number with specified number of bits) <br>- sex, sexa2, sexa3, sexagesimal (show as sexagesimal number; sexa2 hides and sexa3 rounds arcseconds) <br>- latitude, latitude2, longitude, longitude2 (show as sexagesimal latitude/longitude; latitude2 and longitude2 hide arcseconds) <br>- bijective (shown in bijective base-26) <br>- fp16, fp32, fp64, fp80, fp128 (show in binary floating-point format) <br>- bcd (show as binary-coded decimal) <br>- roman (show as roman numerals) <br>- time (show in time format) <br>- unicode <br>- base # (show in specified number base) <br>- bases (show as binary, octal, decimal and hexadecimal number) <br><p/></div>
Expand Down

0 comments on commit 8c90643

Please sign in to comment.