summaryrefslogtreecommitdiff
path: root/math.c
AgeCommit message (Collapse)Author
2019-02-18Add bitwise ops and base conversion (DEC/OCT/HEX) in TI modeTim Hentenaar
These operations implicitly truncate their parameters, and result to integers: * not * and * or * xor * shl * shr * mod * trunc Base 2 was left out of the base conversion code intentionally as it would require making the UI at least one third wider. Attempts to change base with negative values will simply display "error." Note that with larger numbers, the result may be inaccurate due to rounding. I've also bound the Return key to the equal() action. Signed-off-by: Tim Hentenaar <tim@hentenaar.com>
2019-01-06Reduce scope of i (cppcheck --verbose --enable=all)Stéphane Aulery
Signed-off-by: Stéphane Aulery <lkppo@free.fr> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-01-06Reduce scope of cell (cppcheck --verbose --enable=all)Stéphane Aulery
Signed-off-by: Stéphane Aulery <lkppo@free.fr> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-05-05Reword fall through comments to appease gcc -Wimplicit-fallthroughAlan Coopersmith
Gets rid of these warnings: math.c:707:24: warning: this statement may fall through [-Wimplicit-fallthrough=] case kSQR: flagINV = !flagINV; /* fall through to */ ~~~~~~~~^~~~~~~~~~ math.c:708:3: note: here case kSQRT: if (flagINV) dnum=dnum*dnum; ^~~~ math.c:711:24: warning: this statement may fall through [-Wimplicit-fallthrough=] case k10X: flagINV = !flagINV; /* fall through to */ ~~~~~~~~^~~~~~~~~~ math.c:712:3: note: here case kLOG: if (flagINV) dnum=pow(10.0,dnum); ^~~~ math.c:715:24: warning: this statement may fall through [-Wimplicit-fallthrough=] case kEXP: flagINV = !flagINV; /* fall through to */ ~~~~~~~~^~~~~~~~~~ math.c:716:3: note: here case kLN: if (flagINV) dnum=exp(dnum); ^~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-05-05Fix misleading indentation in math.cAlan Coopersmith
math.c: In function ‘numeric’: math.c:267:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentat ion] if ((int) strlen(dispstr) >= MAXDISP) ^~ math.c:270:5: note: ...this statement, but the latter is misleadingly indented a s if it were guarded by the ‘if’ switch (keynum){ ^~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-08-07Replace index() call with strchr()Alan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-12-18Replace signal_t with voidGaetan Nadon
Now that Imake SIGNALRETURNSINT has been removed, the signal handler function return type can only be void. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2013-07-09Replace sprintf & strcpy calls with snprintf & strlcpyAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-07-06Remove unused min & max macros from math.cAlan Coopersmith
Flagged by clang: math.c:33:9: warning: macro is not used [-Wunused-macros] #define min(a,b) ((a) < (b) ? (a) : (b)) ^ math.c:34:9: warning: macro is not used [-Wunused-macros] #define max(a,b) ((a) > (b) ? (a) : (b)) ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-07-06Use the new M_E symbol from math.hStéphane Aulery
Use the new M_E symbol from math.h and fix and a value of the same accuracy if it's necessary to redefine M_E. Signed-off-by: Stéphane Aulery <lkppo@free.fr> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-07-06Use the new M_PI symbol from math.hStéphane Aulery
Use the new M_PI symbol from math.h and fix and a value of the same accuracy if it's necessary to redefine M_PI. Signed-off-by: Stéphane Aulery <lkppo@free.fr> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-07-06Drop CRAY supportStéphane Aulery
Signed-off-by: Stéphane Aulery <lkppo@free.fr> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-28Strip trailing whitespaceAlan Coopersmith
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-28Add const to parse_double() args to fix gcc -Wwrite-strings warningsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-11-20Purge RCS/CVS version tagsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2009-01-12Ansification and compile warning fixes.Paulo Cesar Pereira de Andrade
This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings.
2004-07-06Bugzilla #665: bugs in xcalc -rpn mode decimal_point is a const char* notxprint_packagertest_20041217_basexprint_packagertest_20041125_basesco_port_update-baserel-0-6-1lg3d-rel-0-7-0lg3d-rel-0-6-2lg3d-baseXORG-6_8_99_903XORG-6_8_99_902XORG-6_8_99_901XORG-6_8_99_900XORG-6_8_99_9XORG-6_8_99_8XORG-6_8_99_7XORG-6_8_99_6XORG-6_8_99_5XORG-6_8_99_4XORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_16XORG-6_8_99_15XORG-6_8_99_14XORG-6_8_99_13XORG-6_8_99_12XORG-6_8_99_11XORG-6_8_99_10XORG-6_8_99_1XORG-6_8_2XORG-6_8_1_904XORG-6_8_1_903XORG-6_8_1_902XORG-6_8_1_901XORG-6_8_1XORG-6_8_0XORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1xprint_packagertest_20041217xprint_packagertest_20041125sco_port_updatelg3d-masterlg3d-eventlg3d-dev-0-7-1lg3d-dev-0-7-0lg3d-dev-0-6-latestlg3d-dev-0-6-2lg3d-dev-0-6-1-latestlg3d-dev-0-6-1-currentlg3d-dev-0-6-1-1lg3d-dev-0-6-1lg3dXORG-6_8-branchCOMPOSITEWRAPAlexander Gottwald
char. the patch uses strcmp instead of plain char == char operator and allows decimal_point to be of any length. localeconv() is only called if X_LOCALE is _not_ defined
2004-05-23xc/programs/xcalc/math.cAlan Coopersmith
xcalc -rpn mode errors (Geoffery Coram)
2004-04-23Merging XORG-CURRENT into trunkXACE-SELINUX-MERGEEgbert Eich
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0STSF-CURRENTEgbert Eich
2004-02-26readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich
2003-11-25XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_903_specialxf86-4_3_99_902xf86-4_3_99_901xf86-4_3_99_16xf86-012804-2330Kaleb Keithley
2003-11-14Initial revisionXORG-STABLEKaleb Keithley