Skip to content

Commit

Permalink
Require two digits in duodecimal 0d... syntax (regardless of digit); …
Browse files Browse the repository at this point in the history
…Fix logarithmic units warning message (is => are, and make translatable); Fix case sensitivity of "dB" in Swedish translation; Update ChangeLog; Update translations; Update exchange rates; Increment version number
  • Loading branch information
hanna-kn committed Sep 18, 2023
1 parent a651bc1 commit 3e9bc1f
Show file tree
Hide file tree
Showing 22 changed files with 848 additions and 770 deletions.
16 changes: 16 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
2023-09-16 Hanna Knutsson <hanna.knutsson@protonmail.com>

* Fix display of matrices and vectors with complex number form other than rectangular

2023-09-12 Hanna Knutsson <hanna.knutsson@protonmail.com>

* Fix besselj() and bessely()

2023-09-11 Hanna Knutsson <hanna.knutsson@protonmail.com>

* Require that duodecimal number, entered using 0d... syntax, contains at least two digits, to avoid conflict with decibel units (e.g. 0dB)

2023-08-31 Hanna Knutsson <hanna.knutsson@protonmail.com>

* Fix for title, ylabel, and xlabel options with whitespace in value, in plot() function

2023-08-19 Hanna Knutsson <hanna.knutsson@protonmail.com>

* Fix and improve to Calculator::findMatchUnit() (fixes matching unit for m/s)
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dnl ----------------------
dnl | initialize autotools |---------------------------------------------------
dnl ----------------------

AC_INIT([libqalculate],[4.8.0])
AC_INIT([libqalculate],[4.8.1])
AC_CONFIG_SRCDIR(libqalculate/Calculator.cc)
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS(config.h)
Expand Down Expand Up @@ -73,7 +73,7 @@ QALCULATE_CURRENT=42

dnl increment any time the source changes; set to
dnl 0 if you increment CURRENT
QALCULATE_REVISION=0
QALCULATE_REVISION=1

dnl increment if any interfaces have been added; set to 0
dnl if any interfaces have been removed. removal has
Expand Down
60 changes: 30 additions & 30 deletions data/eurofxref-daily.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@
<gesmes:name>European Central Bank</gesmes:name>
</gesmes:Sender>
<Cube>
<Cube time='2023-08-15'>
<Cube currency='USD' rate='1.0926'/>
<Cube currency='JPY' rate='159.04'/>
<Cube time='2023-09-11'>
<Cube currency='USD' rate='1.0724'/>
<Cube currency='JPY' rate='157.16'/>
<Cube currency='BGN' rate='1.9558'/>
<Cube currency='CZK' rate='24.138'/>
<Cube currency='DKK' rate='7.4519'/>
<Cube currency='GBP' rate='0.85955'/>
<Cube currency='HUF' rate='388.48'/>
<Cube currency='PLN' rate='4.4888'/>
<Cube currency='RON' rate='4.9395'/>
<Cube currency='SEK' rate='11.8390'/>
<Cube currency='CHF' rate='0.9586'/>
<Cube currency='ISK' rate='144.30'/>
<Cube currency='NOK' rate='11.4705'/>
<Cube currency='TRY' rate='29.5648'/>
<Cube currency='AUD' rate='1.6888'/>
<Cube currency='BRL' rate='5.4295'/>
<Cube currency='CAD' rate='1.4742'/>
<Cube currency='CNY' rate='7.9605'/>
<Cube currency='HKD' rate='8.5482'/>
<Cube currency='IDR' rate='16760.11'/>
<Cube currency='ILS' rate='4.1156'/>
<Cube currency='INR' rate='91.0615'/>
<Cube currency='KRW' rate='1460.70'/>
<Cube currency='MXN' rate='18.7129'/>
<Cube currency='MYR' rate='5.0650'/>
<Cube currency='NZD' rate='1.8305'/>
<Cube currency='PHP' rate='62.124'/>
<Cube currency='SGD' rate='1.4829'/>
<Cube currency='THB' rate='38.667'/>
<Cube currency='ZAR' rate='20.9813'/>
<Cube currency='CZK' rate='24.508'/>
<Cube currency='DKK' rate='7.4582'/>
<Cube currency='GBP' rate='0.85650'/>
<Cube currency='HUF' rate='384.10'/>
<Cube currency='PLN' rate='4.6438'/>
<Cube currency='RON' rate='4.9635'/>
<Cube currency='SEK' rate='11.8795'/>
<Cube currency='CHF' rate='0.9560'/>
<Cube currency='ISK' rate='143.70'/>
<Cube currency='NOK' rate='11.4240'/>
<Cube currency='TRY' rate='28.8196'/>
<Cube currency='AUD' rate='1.6655'/>
<Cube currency='BRL' rate='5.3205'/>
<Cube currency='CAD' rate='1.4565'/>
<Cube currency='CNY' rate='7.8230'/>
<Cube currency='HKD' rate='8.3995'/>
<Cube currency='IDR' rate='16477.43'/>
<Cube currency='ILS' rate='4.1120'/>
<Cube currency='INR' rate='88.9735'/>
<Cube currency='KRW' rate='1425.94'/>
<Cube currency='MXN' rate='18.8201'/>
<Cube currency='MYR' rate='5.0129'/>
<Cube currency='NZD' rate='1.8100'/>
<Cube currency='PHP' rate='60.837'/>
<Cube currency='SGD' rate='1.4594'/>
<Cube currency='THB' rate='38.049'/>
<Cube currency='ZAR' rate='20.2681'/>
</Cube>
</Cube>
</gesmes:Envelope>
2 changes: 1 addition & 1 deletion data/rates.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"motd":{"msg":"If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project.","url":"https://exchangerate.host/#/donate"},"success":true,"base":"EUR","date":"2023-08-15","rates":{"AED":4.005282,"AFN":92.036551,"ALL":103.933155,"AMD":423.807844,"ANG":1.972029,"AOA":900.533792,"ARS":381.497536,"AUD":1.677698,"AWG":1.962883,"AZN":1.854645,"BAM":1.955759,"BBD":2.181112,"BDT":119.743199,"BGN":1.954466,"BHD":0.41108,"BIF":3108.538799,"BMD":1.090845,"BND":1.48158,"BOB":7.559701,"BRL":5.412369,"BSD":1.091197,"BTC":0.000037,"BTN":90.74811,"BWP":14.834637,"BYN":2.761719,"BZD":2.204987,"CAD":1.467007,"CDF":2714.14633,"CHF":0.957909,"CLF":0.034225,"CLP":937.656569,"CNH":7.963774,"CNY":7.88824,"COP":4335.33265,"CRC":585.434743,"CUC":1.090767,"CUP":28.074084,"CVE":110.21544,"CZK":24.044737,"DJF":194.78399,"DKK":7.448303,"DOP":62.222929,"DZD":148.15372,"EGP":33.683519,"ERN":16.354447,"ETB":60.341683,"EUR":1,"FJD":2.461777,"FKP":0.860122,"GBP":0.860196,"GEL":2.846087,"GGP":0.860289,"GHS":12.362839,"GIP":0.860187,"GMD":66.122794,"GNF":9403.519699,"GTQ":8.59753,"GYD":228.874114,"HKD":8.527899,"HNL":26.912617,"HRK":7.530402,"HTG":149.330321,"HUF":384.131775,"IDR":16731.711559,"ILS":4.088733,"IMP":0.859962,"INR":90.784753,"IQD":1432.813873,"IRR":46116.912461,"ISK":144.009199,"JEP":0.860107,"JMD":168.964095,"JOD":0.772056,"JPY":158.595308,"KES":156.776436,"KGS":96.235188,"KHR":4533.829347,"KMF":491.287785,"KPW":981.210942,"KRW":1457.261679,"KWD":0.336065,"KYD":0.911949,"KZT":492.387466,"LAK":21284.815909,"LBP":16420.88276,"LKR":352.25071,"LRD":203.056416,"LSL":20.777942,"LYD":5.246594,"MAD":10.861165,"MDL":19.226345,"MGA":4943.778361,"MKD":61.591694,"MMK":2297.308851,"MNT":3761.309162,"MOP":8.811358,"MRU":41.626536,"MUR":49.388583,"MVR":16.736304,"MWK":1187.271279,"MXN":18.598808,"MYR":5.048376,"MZN":69.63881,"NAD":21.620223,"NGN":841.510326,"NIO":40.021409,"NOK":11.411416,"NPR":145.1971,"NZD":1.822402,"OMR":0.419892,"PAB":1.091067,"PEN":4.034745,"PGK":3.976236,"PHP":61.928225,"PKR":311.510119,"PLN":4.445954,"PYG":7948.215301,"QAR":3.989348,"RON":4.938695,"RSD":117.215513,"RUB":105.109447,"RWF":1294.208187,"SAR":4.091199,"SBD":9.124487,"SCR":14.495604,"SDG":655.231605,"SEK":11.756795,"SGD":1.478629,"SHP":0.860058,"SLL":22861.669469,"SOS":623.017689,"SRD":41.708635,"SSP":142.014651,"STD":24292.383814,"STN":24.4896,"SVC":9.572723,"SYP":2739.246465,"SZL":20.771805,"THB":38.503109,"TJS":12.006754,"TMT":3.827045,"TND":3.368043,"TOP":2.595964,"TRY":29.495496,"TTD":7.420911,"TWD":34.802008,"TZS":2740.470037,"UAH":40.405837,"UGX":4064.127635,"USD":1.090443,"UYU":41.327233,"UZS":13195.871117,"VES":32.76418,"VND":26026.125913,"VUV":129.435209,"WST":2.964437,"XAF":655.547265,"XAG":0.04853,"XAU":0.001711,"XCD":2.946371,"XDR":0.819012,"XOF":655.546871,"XPD":0.001215,"XPF":119.258016,"XPT":0.001171,"YER":272.940639,"ZAR":20.786844,"ZMW":21.112961,"ZWL":351.055859}}
{"motd":{"msg":"If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project.","url":"https://exchangerate.host/#/donate"},"success":true,"base":"EUR","date":"2023-09-12","rates":{"AED":3.945052,"AFN":83.798107,"ALL":106.948152,"AMD":413.194284,"ANG":1.93394,"AOA":887.769103,"ARS":375.829173,"AUD":1.671072,"AWG":1.93615,"AZN":1.825701,"BAM":1.954894,"BBD":2.147945,"BDT":117.731979,"BGN":1.954867,"BHD":0.405555,"BIF":3037.995134,"BMD":1.074422,"BND":1.460425,"BOB":7.41324,"BRL":5.295406,"BSD":1.074691,"BTC":0.000042,"BTN":88.968874,"BWP":14.615699,"BYN":2.707569,"BZD":2.163041,"CAD":1.459411,"CDF":2662.355251,"CHF":0.957468,"CLF":0.035952,"CLP":957.615061,"CNH":7.845952,"CNY":7.828942,"COP":4308.596558,"CRC":575.511254,"CUC":1.074729,"CUP":27.652789,"CVE":110.210472,"CZK":24.536116,"DJF":190.994115,"DKK":7.459075,"DOP":60.93006,"DZD":147.104797,"EGP":33.178437,"ERN":16.107728,"ETB":59.299707,"EUR":1,"FJD":2.43409,"FKP":0.858759,"GBP":0.85876,"GEL":2.808826,"GGP":0.858477,"GHS":12.310005,"GIP":0.858273,"GMD":64.969106,"GNF":9208.688623,"GTQ":8.448818,"GYD":224.599342,"HKD":8.410326,"HNL":26.42582,"HRK":7.534137,"HTG":144.822543,"HUF":383.822641,"IDR":16477.559107,"ILS":4.093943,"IMP":0.858525,"INR":89.102642,"IQD":1404.791677,"IRR":45386.665379,"ISK":143.693983,"JEP":0.858383,"JMD":165.577163,"JOD":0.761319,"JPY":157.591142,"KES":157.160038,"KGS":94.918461,"KHR":4434.929834,"KMF":492.096492,"KPW":966.473646,"KRW":1423.348166,"KWD":0.331408,"KYD":0.894659,"KZT":496.40119,"LAK":21277.658892,"LBP":16122.693468,"LKR":346.485777,"LRD":200.11441,"LSL":20.302466,"LYD":5.209067,"MAD":10.936473,"MDL":19.281895,"MGA":4843.609127,"MKD":61.477601,"MMK":2252.691954,"MNT":3704.814402,"MOP":8.655319,"MRU":41.142806,"MUR":48.484734,"MVR":16.603243,"MWK":1179.11936,"MXN":18.586682,"MYR":5.020056,"MZN":68.647346,"NAD":20.398217,"NGN":805.094928,"NIO":39.251586,"NOK":11.441192,"NPR":142.349794,"NZD":1.817,"OMR":0.414115,"PAB":1.074361,"PEN":3.989283,"PGK":3.927081,"PHP":60.910178,"PKR":319.180797,"PLN":4.639597,"PYG":7791.08669,"QAR":3.910974,"RON":4.961452,"RSD":117.264218,"RUB":100.9533,"RWF":1291.848756,"SAR":4.028277,"SBD":9.025403,"SCR":13.81313,"SDG":645.926949,"SEK":11.913225,"SGD":1.462176,"SHP":0.858233,"SLL":22518.294367,"SOS":611.991964,"SRD":41.311428,"SSP":139.882053,"STD":23927.519414,"STN":24.488205,"SVC":9.386623,"SYP":2698.104236,"SZL":20.297056,"THB":38.176342,"TJS":11.799758,"TMT":3.758618,"TND":3.347391,"TOP":2.568852,"TRY":28.864826,"TTD":7.280084,"TWD":34.381952,"TZS":2687.04815,"UAH":39.611057,"UGX":3991.001099,"USD":1.074362,"UYU":40.955416,"UZS":13047.42289,"VES":35.758626,"VND":25876.128681,"VUV":127.49113,"WST":2.920163,"XAF":655.812398,"XAG":0.046906,"XAU":0.001466,"XCD":2.902678,"XDR":0.813713,"XOF":655.812305,"XPD":0.001585,"XPF":119.306047,"XPT":0.001874,"YER":268.840729,"ZAR":20.304644,"ZMW":22.446868,"ZWL":345.783109}}
2 changes: 1 addition & 1 deletion docs/reference/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = libqalculate-4.8.0
PROJECT_NAME = libqalculate-4.8.1

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
Expand Down
2 changes: 1 addition & 1 deletion libqalculate/Calculator-parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2376,7 +2376,7 @@ void Calculator::parse(MathStructure *mstruct, string str, const ParseOptions &p
str.replace(str_index, name_length, stmp);
str_index += stmp.length() - 1;
}
} else if(base <= 14 && str_index + 2 < str.length() && (str[str_index + 1] == 'd' || str[str_index + 1] == 'D') && (is_in(NUMBERS, str[str_index + 2]) || (is_in(DUODECIMAL_CHARS, str[str_index + 2]) && str_index + 3 < str.length() && is_in(NUMBERS DUODECIMAL_CHARS, str[str_index + 3])))) {
} else if(base <= 14 && str_index + 3 < str.length() && (str[str_index + 1] == 'd' || str[str_index + 1] == 'D') && is_in(NUMBERS DUODECIMAL_CHARS, str[str_index + 2]) && is_in(NUMBERS DUODECIMAL_CHARS, str[str_index + 3])) {
//duodecimal number 0d...
if(po.base == BASE_DUODECIMAL) {
str.erase(str_index, 2);
Expand Down
20 changes: 10 additions & 10 deletions libqalculate/Calculator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ Calculator::Calculator() {
srand(time(NULL));

exchange_rates_time[0] = 0;
exchange_rates_time[1] = (time_t) 470016L * (time_t) 3600;
exchange_rates_time[1] = (time_t) 470688L * (time_t) 3600;
exchange_rates_time[2] = 0;
priv->exchange_rates_time2[0] = (time_t) 470016L * (time_t) 3600;
priv->exchange_rates_time2[0] = (time_t) 470688L * (time_t) 3600;
exchange_rates_check_time[0] = 0;
exchange_rates_check_time[1] = (time_t) 470016L * (time_t) 3600;
exchange_rates_check_time[1] = (time_t) 470688L * (time_t) 3600;
exchange_rates_check_time[2] = 0;
priv->exchange_rates_check_time2[0] = (time_t) 470016L * (time_t) 3600;
priv->exchange_rates_check_time2[0] = (time_t) 470688L * (time_t) 3600;
b_exchange_rates_warning_enabled = true;
b_exchange_rates_used = 0;
priv->exchange_rates_url3 = 0;
Expand Down Expand Up @@ -447,13 +447,13 @@ Calculator::Calculator(bool ignore_locale) {
srand(time(NULL));

exchange_rates_time[0] = 0;
exchange_rates_time[1] = (time_t) 470016L * (time_t) 3600;
exchange_rates_time[1] = (time_t) 470688L * (time_t) 3600;
exchange_rates_time[2] = 0;
priv->exchange_rates_time2[0] = (time_t) 470016L * (time_t) 3600;
priv->exchange_rates_time2[0] = (time_t) 470688L * (time_t) 3600;
exchange_rates_check_time[0] = 0;
exchange_rates_check_time[1] = (time_t) 470016L * (time_t) 3600;
exchange_rates_check_time[1] = (time_t) 470688L * (time_t) 3600;
exchange_rates_check_time[2] = 0;
priv->exchange_rates_check_time2[0] = (time_t) 470016L * (time_t) 3600;
priv->exchange_rates_check_time2[0] = (time_t) 470688L * (time_t) 3600;
b_exchange_rates_warning_enabled = true;
b_exchange_rates_used = 0;
priv->exchange_rates_url3 = 0;
Expand Down Expand Up @@ -1885,11 +1885,11 @@ void Calculator::addBuiltinFunctions() {
}
void Calculator::addBuiltinUnits() {
u_euro = addUnit(new Unit(_("Currency"), "EUR", "euros", "euro", "European Euros", false, true, true));
u_btc = addUnit(new AliasUnit(_("Currency"), "BTC", "bitcoins", "bitcoin", "Bitcoins", u_euro, "26865.37", 1, "", false, true, true));
u_btc = addUnit(new AliasUnit(_("Currency"), "BTC", "bitcoins", "bitcoin", "Bitcoins", u_euro, "26127.56", 1, "", false, true, true));
u_btc->setApproximate();
u_btc->setPrecision(-2);
u_btc->setChanged(false);
priv->u_byn = addUnit(new AliasUnit(_("Currency"), "BYN", "", "", "Belarusian Ruble", u_euro, "1/2.72728", 1, "", false, true, true));
priv->u_byn = addUnit(new AliasUnit(_("Currency"), "BYN", "", "", "Belarusian Ruble", u_euro, "1/2.68918", 1, "", false, true, true));
priv->u_byn->setHidden(true);
priv->u_byn->setApproximate();
priv->u_byn->setPrecision(-2);
Expand Down
2 changes: 1 addition & 1 deletion libqalculate/MathStructure-eval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,7 @@ void convert_temperature_units(MathStructure &m, const EvaluationOptions &eo) {

bool warn_ratio_units(MathStructure &m, bool top_level = true) {
if(!top_level && m.isUnit() && ((m.unit()->subtype() == SUBTYPE_BASE_UNIT && m.unit()->referenceName() == "Np") || (m.unit()->subtype() == SUBTYPE_ALIAS_UNIT && ((AliasUnit*) m.unit())->baseUnit()->referenceName() == "Np"))) {
CALCULATOR->error(true, "Logarithmic ratio units is treated as other units and the result might not be as expected.", NULL);
CALCULATOR->error(true, _("Logarithmic ratio units are treated as other units and the result might not be as expected."), NULL);
return true;
}
if(m.isMultiplication() && top_level && m.last().isUnit()) {
Expand Down
2 changes: 1 addition & 1 deletion libqalculate/includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#define QALCULATE_MAJOR_VERSION (4)
#define QALCULATE_MINOR_VERSION (8)
#define QALCULATE_MICRO_VERSION (0)
#define QALCULATE_MICRO_VERSION (1)

static std::string empty_string;

Expand Down
4 changes: 3 additions & 1 deletion man/qalc.1
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ The evaluation of \fIshort/implicit multiplication\fP without any multiplication
.PP
In \fIchain mode\fP, 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).
.PP
The \fI"to"-operator\fP is used for unit conversion and manipulation of how the result is presented. Place " to " or a right arrow (e.g. "->") followed by one of expressions/commands the below, at the end of an expression.
The \fI"to"-operator\fP is used for unit conversion and manipulation of how the result is presented. Place " to " or a right arrow (e.g. "->") followed by one of expressions/commands listed below, at the end of an expression.
.PP
.TP 8
.B Unit conversion
Expand Down Expand Up @@ -773,6 +773,8 @@ prepend with + or - to force/disable use of mixed units
- factors (factorize result)
.PP
Similarly \fIwhere\fP (or alternatively "/.") can be used at the end (but before "to"), for variable assignments, function replacements, etc. (e.g. "x+y where x=1 and y=2", "x^2=4 where x>0", and "sin(5) where sin()=cos()").
.PP
Note that \fIto\fP and \fIwhere\fP can only be applied to the whole expression. Everything before the operator is always treated as the expression to convert (or apply replacement to), and everything after as the conversion/replacement expression, regardless of any parentheses.
.SH EXAMPLES
Note that semicolon can be replaced with comma, if comma is not used as decimal or thousands separator.
.PP
Expand Down
2 changes: 1 addition & 1 deletion po-defs/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -11064,7 +11064,7 @@ msgstr ""

#: ../data/units.xml.in.h:594
msgid "ar:dB,decibel,p:decibels"
msgstr "dB,decibel"
msgstr "a:dB,decibel"

#: ../data/units.xml.in.h:595
msgid "Information"
Expand Down
Loading

0 comments on commit 3e9bc1f

Please sign in to comment.