From 1757e0bcf197e3fc7b76521447f253d34be419a2 Mon Sep 17 00:00:00 2001 From: Carsten Larsen Date: Sat, 11 Mar 2017 23:37:45 +0100 Subject: [PATCH] Release 1.7.0 --- .gitignore | 1 + HISTORY | 2 +- LICENSE | 6 - Makefile | 36 +- build/debian/README => README | 0 amath.1 | 173 + amath.doxygen | 4 +- build/debian/control-amd64 | 17 - build/debian/control-i386 | 17 - build/flexcat/Makefile | 62 + build/flexcat/configure | 147 - builddeb | 228 +- builddist | 71 +- buildwin | 13 +- catalog/dansk/amath-help.ct | 9 +- catalog/dansk/amath-ident.ct | 110 +- catalog/dansk/amath-keyword.ct | 9 + catalog/dansk/amath-text.ct | 40 + catalog/english/amath-help.ct | 20 +- catalog/english/amath-ident.ct | 42 +- catalog/english/amath-text.ct | 46 +- configure | 440 ++- src/amath.h | 13 +- src/amath.sln | 28 + src/amath.vcxproj | 146 + src/amath.vcxproj.filters | 17 + src/clib/Makefile | 57 +- src/clib/alloccpy.c | 2 +- src/clib/amathc.3 | 519 +++ src/clib/amathc.pc | 10 + src/clib/amathc.vcxproj | 113 + src/clib/amathc.vcxproj.filters | 40 + src/clib/mem.c | 2 +- src/clib/memcpy.c | 18 +- src/clib/memset.c | 6 +- src/clib/strcmp.c | 2 +- src/cplex/Makefile | 53 +- src/cplex/amathi.3 | 1857 +++++++++ src/cplex/amathi.pc | 10 + src/cplex/amathi.vcxproj | 142 + src/cplex/amathi.vcxproj.filters | 123 + src/cplex/cacosh.c | 2 +- src/cplex/ccot.c | 9 +- src/cplex/ccsc.c | 7 +- src/cplex/cpow.c | 6 +- src/cplex/csec.c | 7 +- src/cplex/csgn.c | 11 +- src/cplex/csinh.c | 2 +- src/cplex/csqrt.c | 44 +- src/cplex/ctan.c | 7 +- src/cplex/prim.h | 2 +- src/lib/Makefile | 62 +- src/lib/amatha.pc | 10 + src/lib/amatha.vcxproj | 124 + src/lib/amatha.vcxproj.filters | 69 + src/lib/charval.h | 8 +- src/lib/cplex.cpp | 3 +- src/lib/cplex.h | 6 +- src/lib/integer.cpp | 1 - src/lib/integer.h | 6 +- src/lib/nnumb.h | 6 +- src/lib/ntext.cpp | 2 +- src/lib/numb.h | 6 +- src/lib/real.cpp | 34 +- src/lib/real.h | 4 +- src/localize/help.h | 72 +- src/localize/ialias.h | 14 + src/localize/ident.h | 94 +- src/localize/kword.h | 101 +- src/localize/lex.h | 3 +- src/localize/text.h | 180 +- src/main.h | 135 +- src/main/Makefile | 9 +- src/main/evaluator.cpp | 1 - src/main/fgrid.cpp | 1 - src/main/function/Makefile | 66 +- src/main/function/aexcosecant.cpp | 2 +- src/main/function/aexcosecant.h | 2 +- src/main/function/aexsecant.cpp | 6 +- src/main/function/aexsecant.h | 2 +- src/main/function/arccovercosine.cpp | 46 + .../function/arccovercosine.h} | 40 +- src/main/function/arccoversine.cpp | 46 + src/main/function/arccoversine.h | 50 + src/main/function/archacovercosine.cpp | 46 + src/main/function/archacovercosine.h | 50 + src/main/function/archacoversine.cpp | 46 + .../function/archacoversine.h} | 49 +- src/main/function/archavercosine.cpp | 46 + src/main/function/archavercosine.h | 50 + src/main/function/archaversine.cpp | 46 + src/main/function/archaversine.h | 50 + src/main/function/arcvercosine.cpp | 46 + src/main/function/arcvercosine.h | 50 + .../function/arcversine.cpp} | 33 +- src/main/function/arcversine.h | 50 + src/main/function/cosecant.cpp | 1 - src/main/function/defs.h | 33 +- src/main/function/excosecant.cpp | 5 +- src/main/function/functions.vcxproj | 224 ++ src/main/function/functions.vcxproj.filters | 366 ++ src/main/function/hyparccosecant.cpp | 46 + src/main/function/hyparccosecant.h | 50 + src/main/function/hyparccosine.cpp | 46 + src/main/function/hyparccosine.h | 50 + src/main/function/hyparccotangent.cpp | 46 + src/main/function/hyparccotangent.h | 50 + src/main/function/hyparcsecant.cpp | 46 + src/main/function/hyparcsecant.h | 50 + src/main/function/hyparcsine.cpp | 46 + src/main/function/hyparcsine.h | 50 + src/main/function/hyparctangent.cpp | 46 + src/main/function/hyparctangent.h | 50 + src/main/function/hypcosecant.cpp | 46 + src/main/function/hypcosecant.h | 50 + src/main/function/hypcosine.cpp | 46 + src/main/function/hypcosine.h | 50 + src/main/function/hypcotangent.cpp | 46 + src/main/function/hypcotangent.h | 50 + src/main/function/hypsecant.cpp | 46 + src/main/function/hypsecant.h | 50 + .../graph.cpp => main/function/hypsine.cpp} | 29 +- src/main/function/hypsine.h | 50 + src/main/function/hyptangent.cpp | 46 + src/main/function/hyptangent.h | 50 + src/main/function/log10.cpp | 1 - src/main/function/node.cpp | 17 +- src/main/function/trunc.cpp | 1 - src/main/function/user.cpp | 2 +- src/main/function/user.h | 4 +- src/main/functionlist.cpp | 4 +- src/main/functionlist.h | 6 +- src/main/functions.cpp | 232 -- src/main/functions.h | 135 - src/main/lexer.cpp | 1 - src/main/main.vcxproj | 134 + src/main/main.vcxproj.filters | 96 + src/main/operators.cpp | 1 - src/main/optimizer.cpp | 13 +- src/main/optimizer.h | 12 +- src/main/parser.cpp | 2 +- src/main/statement/about.cpp | 7 +- src/main/statement/delete.h | 2 +- src/main/statement/digits.h | 2 +- src/main/statement/draw.h | 2 +- src/main/statement/empty.cpp | 1 - src/main/statement/eval.h | 4 +- src/main/statement/execute.h | 2 +- src/main/statement/help.cpp | 56 +- src/main/statement/help.h | 4 +- src/main/statement/input.h | 2 +- src/main/statement/license.cpp | 70 +- src/main/statement/list.h | 2 +- src/main/statement/load.cpp | 1 - src/main/statement/load.h | 2 +- src/main/statement/memory.cpp | 4 +- src/main/statement/node.cpp | 1 - src/main/statement/node.h | 10 +- src/main/statement/plot.h | 2 +- src/main/statement/prefs.cpp | 10 +- src/main/statement/prefs.h | 2 +- src/main/statement/prompt.h | 2 +- src/main/statement/save.cpp | 1 - src/main/statement/save.h | 2 +- src/main/statement/show.h | 2 +- src/main/statement/silent.cpp | 1 - src/main/statement/silent.h | 4 +- src/main/statement/statements.vcxproj | 161 + src/main/statement/statements.vcxproj.filters | 177 + src/main/token.cpp | 1 - src/main/userfunction.h | 8 +- src/real/Makefile | 50 +- src/real/amathr.3 | 3517 +++++++++++++++++ src/real/amathr.pc | 10 + src/real/atan2.c | 2 +- src/real/atanh.c | 2 +- src/real/erf.c | 348 -- src/real/fmod.c | 2 +- src/real/frexp.c | 87 - src/real/ksin.c | 1 + src/real/kstandard.c | 765 ---- src/real/ktan.c | 1 + src/real/modf.c | 111 - src/real/nextafter.c | 112 - src/real/prim.h | 2 +- src/real/rint.c | 114 - src/real/sqrt.c | 1 - src/system/Makefile | 15 +- src/system/console.cpp | 5 +- src/system/console.h | 2 +- src/system/console_amiga.cpp | 2 +- src/system/console_amiga.h | 2 +- src/system/console_stdc.cpp | 4 +- src/system/console_stdc.h | 2 +- src/system/filesystem_amiga.cpp | 4 +- src/system/filesystem_amiga.h | 2 +- src/system/filesystem_stdc.cpp | 6 +- src/system/filesystem_stdc.h | 2 +- src/system/graph_amiga.cpp | 150 - src/system/graph_amiga.h | 83 - src/system/graph_gtk.cpp | 215 - src/system/language.cpp | 4 +- src/system/language_amiga.cpp | 5 +- src/system/language_amiga.h | 2 +- src/system/language_posix.cpp | 6 +- src/system/language_posix.h | 2 +- src/system/language_stdc.cpp | 8 +- src/system/language_stdc.h | 2 +- src/system/preferences.cpp | 2 +- src/system/preferences_amiga.cpp | 4 +- src/system/preferences_amiga.h | 2 +- src/system/preferences_stdc.cpp | 9 +- src/system/preferences_stdc.h | 2 +- src/system/proc_amiga.cpp | 24 +- src/system/program.cpp | 22 +- src/system/program.h | 8 +- src/system/program_amiga.cpp | 18 +- src/system/program_amiga.h | 2 +- src/system/program_stdc.cpp | 10 +- src/system/program_stdc.h | 2 +- src/system/program_test.cpp | 8 +- src/system/program_test.h | 2 +- src/system/system.vcxproj | 158 + src/system/system.vcxproj.filters | 168 + src/system/task.h | 2 +- src/system/task_amiga.cpp | 4 +- src/system/task_amiga.h | 4 +- src/system/task_stdc.cpp | 4 +- src/system/task_stdc.h | 6 +- src/system/window_amiga.cpp | 2 +- src/system/window_amiga.h | 2 +- text/help.cd | 77 +- text/help.sd | 17 +- text/ident.cd | 115 +- text/ident.sd | 18 +- text/keyword.cd | 5 +- text/keyword.sd | 14 +- text/text.cd | 42 +- text/text.sd | 21 +- utext/dk-help.dict | 111 - utext/dk-ident.dict | 81 - utext/dk-keyword.dict | 155 - utext/dk-text.dict | 96 - 243 files changed, 12160 insertions(+), 4196 deletions(-) rename build/debian/README => README (100%) create mode 100644 amath.1 delete mode 100644 build/debian/control-amd64 delete mode 100644 build/debian/control-i386 create mode 100644 build/flexcat/Makefile delete mode 100755 build/flexcat/configure create mode 100644 src/amath.sln create mode 100644 src/amath.vcxproj create mode 100644 src/amath.vcxproj.filters create mode 100644 src/clib/amathc.3 create mode 100644 src/clib/amathc.pc create mode 100644 src/clib/amathc.vcxproj create mode 100644 src/clib/amathc.vcxproj.filters create mode 100644 src/cplex/amathi.3 create mode 100644 src/cplex/amathi.pc create mode 100644 src/cplex/amathi.vcxproj create mode 100644 src/cplex/amathi.vcxproj.filters create mode 100644 src/lib/amatha.pc create mode 100644 src/lib/amatha.vcxproj create mode 100644 src/lib/amatha.vcxproj.filters create mode 100644 src/main/function/arccovercosine.cpp rename src/{system/graph.h => main/function/arccovercosine.h} (71%) create mode 100644 src/main/function/arccoversine.cpp create mode 100644 src/main/function/arccoversine.h create mode 100644 src/main/function/archacovercosine.cpp create mode 100644 src/main/function/archacovercosine.h create mode 100644 src/main/function/archacoversine.cpp rename src/{real/matherr.c => main/function/archacoversine.h} (65%) create mode 100644 src/main/function/archavercosine.cpp create mode 100644 src/main/function/archavercosine.h create mode 100644 src/main/function/archaversine.cpp create mode 100644 src/main/function/archaversine.h create mode 100644 src/main/function/arcvercosine.cpp create mode 100644 src/main/function/arcvercosine.h rename src/{system/graph_gtk.h => main/function/arcversine.cpp} (76%) create mode 100644 src/main/function/arcversine.h create mode 100644 src/main/function/functions.vcxproj create mode 100644 src/main/function/functions.vcxproj.filters create mode 100644 src/main/function/hyparccosecant.cpp create mode 100644 src/main/function/hyparccosecant.h create mode 100644 src/main/function/hyparccosine.cpp create mode 100644 src/main/function/hyparccosine.h create mode 100644 src/main/function/hyparccotangent.cpp create mode 100644 src/main/function/hyparccotangent.h create mode 100644 src/main/function/hyparcsecant.cpp create mode 100644 src/main/function/hyparcsecant.h create mode 100644 src/main/function/hyparcsine.cpp create mode 100644 src/main/function/hyparcsine.h create mode 100644 src/main/function/hyparctangent.cpp create mode 100644 src/main/function/hyparctangent.h create mode 100644 src/main/function/hypcosecant.cpp create mode 100644 src/main/function/hypcosecant.h create mode 100644 src/main/function/hypcosine.cpp create mode 100644 src/main/function/hypcosine.h create mode 100644 src/main/function/hypcotangent.cpp create mode 100644 src/main/function/hypcotangent.h create mode 100644 src/main/function/hypsecant.cpp create mode 100644 src/main/function/hypsecant.h rename src/{system/graph.cpp => main/function/hypsine.cpp} (77%) create mode 100644 src/main/function/hypsine.h create mode 100644 src/main/function/hyptangent.cpp create mode 100644 src/main/function/hyptangent.h delete mode 100644 src/main/functions.cpp delete mode 100644 src/main/functions.h create mode 100644 src/main/main.vcxproj create mode 100644 src/main/main.vcxproj.filters create mode 100644 src/main/statement/statements.vcxproj create mode 100644 src/main/statement/statements.vcxproj.filters create mode 100644 src/real/amathr.3 create mode 100644 src/real/amathr.pc delete mode 100644 src/real/erf.c delete mode 100644 src/real/frexp.c delete mode 100644 src/real/kstandard.c delete mode 100644 src/real/modf.c delete mode 100644 src/real/nextafter.c delete mode 100644 src/real/rint.c delete mode 100644 src/system/graph_amiga.cpp delete mode 100644 src/system/graph_amiga.h delete mode 100644 src/system/graph_gtk.cpp create mode 100644 src/system/system.vcxproj create mode 100644 src/system/system.vcxproj.filters delete mode 100644 utext/dk-help.dict delete mode 100644 utext/dk-ident.dict delete mode 100644 utext/dk-keyword.dict delete mode 100644 utext/dk-text.dict diff --git a/.gitignore b/.gitignore index 4edf3990..06d6eb79 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.kdev4 *.vcxproj.user *Debug/* +*x64/* *.o *.obj *.a diff --git a/HISTORY b/HISTORY index 9192b606..4a811e3f 100644 --- a/HISTORY +++ b/HISTORY @@ -2,7 +2,7 @@ --- amath change history --- ------------------------------------------------------------------------------- -v1.7.0 February 28 2017 +v1.7.0 March 12 2017 - Introduce scientific notation. - Introduce Not a Number (NaN). - Fixed bugs related to infinity (Inf). diff --git a/LICENSE b/LICENSE index d4cf75d5..5fe26daf 100644 --- a/LICENSE +++ b/LICENSE @@ -4,12 +4,6 @@ Copyright (c) 2007 The NetBSD Foundation, Inc. Copyright (c) 1990, 1993 The Regents of the University of California. All rights reserved. -This code is derived from software written by Stephen L. Moshier. -It is redistributed by the NetBSD Foundation by permission of the author. - -This code is derived from software contributed to Berkeley by -Mike Hibler and Chris Torek. - Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/Makefile b/Makefile index 0e49912b..1030ba62 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,11 @@ LPATHS = -Lsrc/lib/static -Lsrc/clib/static -Lsrc/real/static -Lsrc/cplex/stat FLXCAT = build/flexcat/flexcat MKDIR = mkdir -p DEL = rm -f -INSTALL = install -m 0755 +INSTALLP = install -m 0755 +INSTALLM = install -m 0644 PREFIX = /usr +INSTDIRP = ${DESTDIR}${PREFIX}/bin +INSTDIRM = ${DESTDIR}${PREFIX}/share/man/man1 all: shared-app app: appmain functions statement appsystem @@ -48,25 +51,15 @@ amathc: amathcplex: cd src/cplex && ${MAKE} -catalogsa: +localize: + cd build/flexcat && ${MAKE} ${FLXCAT} text/keyword.cd src/localize/kword.h=text/keyword.sd ${FLXCAT} text/help.cd src/localize/help.h=text/help.sd ${FLXCAT} text/ident.cd src/localize/ident.h=text/ident.sd ${FLXCAT} text/text.cd src/localize/text.h=text/text.sd -catalogsu: - iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-help.ct >utext/dk-help.dict - iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-ident.ct >utext/dk-ident.dict - iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-text.ct >utext/dk-text.dict - iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-keyword.ct >utext/dk-keyword.dict - -catalogsw: - iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-help.ct >utext/dk-help.dict - iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-ident.ct >utext/dk-ident.dict - iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-text.ct >utext/dk-text.dict - iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-keyword.ct >utext/dk-keyword.dict - -amigacatalogs: +catalogs: + cd build/flexcat && ${MAKE} ${MKDIR} dist/catalog/english ${FLXCAT} text/help.cd catalog/english/amath-help.ct CATALOG dist/catalog/english/amath-help.catalog ${FLXCAT} text/ident.cd catalog/english/amath-ident.ct CATALOG dist/catalog/english/amath-ident.catalog @@ -92,16 +85,18 @@ static-app: src/main.o ${CC} ${CFLAGS} -s src/main.o -o amath ${LPATHS} ${LFLAGS} .PHONY: test -test: static-app +test: amath + LD_LIBRARY_PATH=src/clib/:src/lib:src/cplex:scr/real ./amath test .PHONY: install -install: amath +install: shared-app cd src/lib && ${MAKE} install cd src/clib && ${MAKE} install cd src/real && ${MAKE} install cd src/cplex && ${MAKE} install - ${INSTALL} amath ${DESTDIR}${PREFIX}/bin + ${INSTALLP} amath ${INSTDIRP}/amath + ${INSTALLM} amath.1 ${INSTDIRM}/amath.1 .PHONY: uninstall uninstall: @@ -109,8 +104,10 @@ uninstall: cd src/clib && ${MAKE} uninstall cd src/real && ${MAKE} uninstall cd src/cplex && ${MAKE} uninstall - ${DEL} ${DESTDIR}${PREFIX}/bin/amath + ${DEL} ${INSTDIRP}/amath + ${DEL} ${INSTDIRM}/amath.1 +.PHONY: clean clean: cd src/lib && ${MAKE} clean cd src/clib && ${MAKE} clean @@ -120,5 +117,6 @@ clean: cd src/system && ${MAKE} clean cd src/main/function && ${MAKE} clean cd src/main/statement && ${MAKE} clean + cd build/flexcat && ${MAKE} clean ${DEL} src/main.o amath diff --git a/build/debian/README b/README similarity index 100% rename from build/debian/README rename to README diff --git a/amath.1 b/amath.1 new file mode 100644 index 00000000..3847678e --- /dev/null +++ b/amath.1 @@ -0,0 +1,173 @@ +.TH "amath" 1 "Wed Mar 1 2017" "Version 1.7.0" "amath" \" -*- nroff -*- +.ad l +.nh +.SH NAME +amath \- Statements and functions + +.SH SYNOPSIS +\fCamath [expression]\fP + +.SH Description +amath(1) features a case sensitive command line interface, internal +IEEE 754 calculations with 15 significant digits, calculations with +real and complex numbers, variables and user defined functions, +logarithmic and exponential functions, trigonometric and hyperbolic +function and selected mathematical constants and rounding functions. + +.SH "Statements" +.PP +.nf +clear Clear console window +def Define function +delete Delete variable or function +digits Set number of significant digits +eval Evaluate arithmetic expression +execute Execute statements in a file +functions Show list of user defined functions +input Change numeral input system +help Show basic help text +output Change numeral output system +list Show content of a directory +show Show content of a file +load Load variable and functions from file +save Save variable and functions to file +variables Show list of variables +version Show version string +memory Show internal memory usage +exit Exit program +.fi +.PP + +.SH "Operators" +.PP +.nf ++ Mathematical addition. +- Mathematical subtraction. +* Mathematical multiplication. +/ Mathematical division. +^ Mathematical exponentiation. += Assignment of variable values. +| Absolute value of number. + +.SH "Variables and constant" +.PP +.nf +pi Trigonometric constant +e Euler's number +i Imaginary unit +ins Result of last calculation +.fi +.PP + +.SH "Base functions" +.PP +.nf +abs Absolute value of number +sgn Mathematical signum function +round Round to nearest integer number +trunc Discard fraction part of number +floor Mathematical floor function +ceil Mathematical ceiling function +sqrt Square root function (exp 1/2) +cbrt Cube root function (exp 1/3) +lb Binary logarithm function (base 2) +ln Natural logarithm function (base e) +lg Common logarithm function (base 10) +.fi +.PP + +.SH "Trigonometric functions" +.PP +.nf +sin Trigonometric sine function +cos Trigonometric cosine function +tan Trigonometric tangent function +cot Trigonometric cotangent function +sec Trigonometric secant function +csc Trigonometric cosecant function +arcsin Inverse trigonometric sine function +arccos Inverse trigonometric cosine function +arctan Inverse trigonometric tangent function +arccot Inverse trigonometric cotangent function +arcsec Inverse trigonometric secant function +arccsc Inverse trigonometric cosecant function +.fi +.PP + +.SH "Hyperbolic functions" +.PP +.nf +sinh Hyperbolic sine function +cosh Hyperbolic cosine function +tanh Hyperbolic tangent function +coth Hyperbolic cotangent function +sech Hyperbolic secant function +csch Hyperbolic cosecant function +arcsinh Inverse hyperbolic sine function +arccosh Inverse hyperbolic cosine function +arctanh Inverse hyperbolic tangent function +arccoth Inverse hyperbolic cotangent function +arcsech Inverse hyperbolic secant function +arccsch Inverse hyperbolic cosecant function +.fi +.PP + +.SH "Early trigonometric functions" +.PP +.nf +ver Versed sine function +vcs Versed cosine function +cvs Coversed sine function +cvc Coversed cosine function +hv Haversed sine function +hvc Haversed cosine function +hcv Hacoversed sine function +hcc Hacoversed cosine function +arcver Inverse versed sine function +arcvcs Inverse versed cosine function +arccvs Inverse coversed sine function +arccvc Inverse coversed cosine function +archv Inverse haversed sine function +archvc Inverse haversed cosine function +archcv Inverse hacoversed sine function +archcc Inverse hacoversed cosine function +.fi +.PP + +.SH "Example script" +.PP +.nf +round(1.5461);round(-1.5461); +ceil(43.5461);ceil(-43.5461); +floor(39.9531);floor(-39.9531); +trunc(23.827);trunc(-23.827); +sqrt(100);sqrt(52.23); +.fi +.PP + +.SH "Example script with functions" +.PP +.nf +f(x)=x*2+1; +g(y)=y^2+y*1.5+2; +a=2;b=3;c=a+b; +vars;funcs; +f(2.2);c+1.1; +.fi +.PP + +.SH "Example script with complex numbers" +.PP +.nf +cos(1+2i); +sin(1+2i); +tan(1+2i); +coth(1+2i); +sech(1+2i); +csch(1+2i); +.fi +.PP + +.SH "See also" +.PP +amathc(3), amathr(3), amathi(3) diff --git a/amath.doxygen b/amath.doxygen index 9b8d8248..4ac695f6 100644 --- a/amath.doxygen +++ b/amath.doxygen @@ -771,7 +771,7 @@ WARN_LOGFILE = doxygen.warn # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = app lib +INPUT = src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -2376,7 +2376,7 @@ PLANTUML_INCLUDE_PATH = # Minimum value: 0, maximum value: 10000, default value: 50. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_GRAPH_MAX_NODES = 100 +DOT_GRAPH_MAX_NODES = 200 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs # generated by dot. A depth value of 3 means that only nodes reachable from the diff --git a/build/debian/control-amd64 b/build/debian/control-amd64 deleted file mode 100644 index 8752a9dc..00000000 --- a/build/debian/control-amd64 +++ /dev/null @@ -1,17 +0,0 @@ -Package: amath -Version: 1.7.0 -Architecture: amd64 -Maintainer: Carsten Larsen -Installed-Size: 259 -Depends: libc6 -Section: math -Essential: no -Priority: optional -Homepage: http://amath.innolan.net -Built-Using: gcc-5.4 -Description: Simple command line calculator - Features a case sensitive command line interface, internal IEEE 754 - calculations with 15 significant digits, calculations with real and - complex numbers, variables and user defined functions, logarithmic - and exponential functions, trigonometric and hyperbolic function - and selected mathematical constants and rounding functions. diff --git a/build/debian/control-i386 b/build/debian/control-i386 deleted file mode 100644 index 9126b92f..00000000 --- a/build/debian/control-i386 +++ /dev/null @@ -1,17 +0,0 @@ -Package: amath -Version: 1.7.0 -Architecture: i386 -Maintainer: Carsten Larsen -Installed-Size: 262 -Depends: libc6 -Section: math -Essential: no -Priority: optional -Homepage: http://amath.innolan.net -Built-Using: gcc-5.4 -Description: Simple command line calculator - Features a case sensitive command line interface, internal IEEE 754 - calculations with 15 significant digits, calculations with real and - complex numbers, variables and user defined functions, logarithmic - and exponential functions, trigonometric and hyperbolic function - and selected mathematical constants and rounding functions. diff --git a/build/flexcat/Makefile b/build/flexcat/Makefile new file mode 100644 index 00000000..4a1461fa --- /dev/null +++ b/build/flexcat/Makefile @@ -0,0 +1,62 @@ +all: flexcat + +CFLAGS += -I. -Wall + +asprintf.o: asprintf.c + ${CC} ${CFLAGS} -c asprintf.c + +createcat.o: createcat.c + ${CC} ${CFLAGS} -c createcat.c + +createcatsrc.o: createcatsrc.c + ${CC} ${CFLAGS} -c createcatsrc.c + +createct.o: createct.c + ${CC} ${CFLAGS} -c createct.c + +globals.o: globals.c + ${CC} ${CFLAGS} -c globals.c + +locale_other.o: locale_other.c + ${CC} ${CFLAGS} -c locale_other.c + +main.o: main.c + ${CC} ${CFLAGS} -c main.c + +openlibs.o: openlibs.c + ${CC} ${CFLAGS} -c openlibs.c + +readprefs.o: readprefs.c + ${CC} ${CFLAGS} -c readprefs.c + +scancd.o: scancd.c + ${CC} ${CFLAGS} -c scancd.c + +scanct.o: scanct.c + ${CC} ${CFLAGS} -c scanct.c + +scanpo.o: scanpo.c + ${CC} ${CFLAGS} -c scanpo.c + +showfuncs.o: showfuncs.c + ${CC} ${CFLAGS} -c showfuncs.c + +strptime.o: strptime.c + ${CC} ${CFLAGS} -c strptime.c + +swapfuncs.o: swapfuncs.c + ${CC} ${CFLAGS} -c swapfuncs.c + +utils.o: utils.c + ${CC} ${CFLAGS} -c utils.c + +vastubs.o: vastubs.c + ${CC} ${CFLAGS} -c vastubs.c + + +flexcat: asprintf.o createcat.o createcatsrc.o createct.o globals.o locale_other.o main.o openlibs.o readprefs.o scancd.o scanct.o scanpo.o showfuncs.o strptime.o swapfuncs.o utils.o vastubs.o + ${CC} ${CFLAGS} -o flexcat asprintf.o createcat.o createcatsrc.o createct.o globals.o locale_other.o main.o openlibs.o readprefs.o scancd.o scanct.o scanpo.o showfuncs.o strptime.o swapfuncs.o utils.o vastubs.o -lm + +clean: + rm -f asprintf.o createcat.o createcatsrc.o createct.o globals.o locale_other.o main.o openlibs.o readprefs.o scancd.o scanct.o scanpo.o showfuncs.o strptime.o swapfuncs.o utils.o vastubs.o flexcat + diff --git a/build/flexcat/configure b/build/flexcat/configure deleted file mode 100755 index f01ab1e6..00000000 --- a/build/flexcat/configure +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2014-2017 Carsten Sonne Larsen -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# - -set -e - -HDRS=' - createcat.h - createcatsrc.h - createct.h - FlexCat_cat.h - FlexCat_cat_other.h - flexcat.h - globals.h - openlibs.h - readprefs.h - scancd.h - scanct.h - scanpo.h - SDI_compiler.h - showfuncs.h - swapfuncs.h - utils.h - version.h -' - -SRCS=' - asprintf.c - createcat.c - createcatsrc.c - createct.c - globals.c - locale_other.c - main.c - openlibs.c - readprefs.c - scancd.c - scanct.c - scanpo.c - showfuncs.c - strptime.c - swapfuncs.c - utils.c - vastubs.c -' - -if make -v 2>&1 | grep GNU > /dev/null 2>&1 ; then - echo "make(1) is GNU make." - BSD=false -elif [ -f /usr/share/mk/bsd.prog.mk ] ; then - echo "Found bsd.prog.mk, will use it." - BSD=true -else - echo "Defaulting to plain makefile" - BSD=false -fi - -if $BSD ; then - ( - echo '# BSD-style Makefile generated by configure' - echo 'PROG = flexcat' - for f in ${SRCS} - do - echo "SRCS += ${f}" - done - - echo 'NO_MAN = not_yet' - echo 'LDADD += -lm' - echo 'WARNS ?= 6' - echo '.include ' - ) > Makefile - - msg=", remember to run 'make depend'" -else - ( - echo '# Portable Makefile generated by configure' - echo '' - echo 'all: flexcat' - echo '' - echo "CFLAGS += -I. -Wall" - echo '' - - for f in ${HDRS} - do - b=`basename $f .h` - i=`sed -n -e '/#include.*"/{ - s/"$// - s/.*"// - p - }' $f | sort -u` - if [ "x${i}" != "x" ] ; then - echo "${b}.h: " ${i} - echo " touch ${b}.h" - echo - fi - done - - l="" - for f in ${SRCS} - do - b=`basename $f .c` - i=`sed -n -e '/#include.*"/{ - s/"$// - s/.*"// - p - }' $f | sort -u` - echo "${b}.o: ${b}.c" ${i} - echo - l="${l} ${b}.o" - done - - echo - echo "flexcat: ${l}" - echo " \${CC} \${CFLAGS} -o flexcat ${l} -lm" - echo - echo "clean:" - echo " rm -f ${l} flexcat" - echo - echo "depend:" - echo " @echo Dependencies already done" - ) > Makefile -fi - -echo "Makefile generated${msg}" diff --git a/builddeb b/builddeb index b31296ef..73be8f8a 100755 --- a/builddeb +++ b/builddeb @@ -1,75 +1,199 @@ #!/bin/sh -# Build a debian package for amd64 +set -e version="1.7.0" -echo "Building amath ${version} for Debian ..." -rm -Rf amath +build_package () { -# Build -sh configure +rm -Rf amath +rm -f amath-${version}_$1.deb +sh configure CFLAGS=$2 make clean + +echo "Building $3 bit package of amath ${version} for Debian ..." make mv amath amath.tmp -make clean # Create filesystem layout -rm -Rf amath - -mkdir -p amath/DEBIAN -mkdir -p amath/usr/bin -mkdir -p amath/usr/share/doc/amath -mkdir -p amath/usr/local/share/amath +mkdir -m 755 amath +mkdir -m 755 amath/DEBIAN +mkdir -m 755 amath/usr/ +mkdir -m 755 amath/usr/bin +mkdir -m 755 amath/usr/lib +mkdir -m 755 amath/usr/lib/pkgconfig +mkdir -m 755 amath/usr/include +mkdir -m 755 amath/usr/share +mkdir -m 755 amath/usr/share/amath +mkdir -m 755 amath/usr/share/man +mkdir -m 755 amath/usr/share/man/man1 +mkdir -m 755 amath/usr/share/man/man3 +mkdir -m 755 amath/usr/share/doc +mkdir -m 755 amath/usr/share/doc/amath +# Copy binaries mv amath.tmp amath/usr/bin/amath +chmod 0755 amath/usr/bin/amath +mv src/lib/static/libamathapp.a amath/usr/lib/libamathapp.a +chmod 0644 amath/usr/lib/libamathapp.a +mv src/lib/libamathapp.so amath/usr/lib/libamathapp.so.${version} +chmod 0644 amath/usr/lib/libamathapp.so.${version} +mv src/clib/static/libamathc.a amath/usr/lib/libamathc.a +chmod 0644 amath/usr/lib/libamathc.a +mv src/clib/libamathc.so amath/usr/lib/libamathc.so.${version} +chmod 0644 amath/usr/lib/libamathc.so.${version} +mv src/real/static/libamath.a amath/usr/lib/libamath.a +chmod 0644 amath/usr/lib/libamath.a +mv src/real/libamath.so amath/usr/lib/libamath.so.${version} +chmod 0644 amath/usr/lib/libamath.so.${version} +mv src/cplex/static/libamathcplex.a amath/usr/lib/libamathcplex.a +chmod 0644 amath/usr/lib/libamathcplex.a +mv src/cplex/libamathcplex.so amath/usr/lib/libamathcplex.so.${version} +chmod 0644 amath/usr/lib/libamathcplex.so.${version} + +# Copy pkg-config files +cp src/lib/amatha.pc amath/usr/lib/pkgconfig/amatha.pc +cp src/clib/amathc.pc amath/usr/lib/pkgconfig/amathc.pc +cp src/real/amathr.pc amath/usr/lib/pkgconfig/amathr.pc +cp src/cplex/amathi.pc amath/usr/lib/pkgconfig/amathi.pc +chmod 644 amath/usr/lib/pkgconfig/* + +# Copy includes +cp src/amath.h amath/usr/include/amath.h +cp src/amathc.h amath/usr/include/amathc.h +cp src/amatht.h amath/usr/include/amatht.h +cp src/complex.h amath/usr/include/amathi.h +chmod 644 amath/usr/include/* # Copy documentation -cp LICENSE amath/usr/share/doc/amath/ cp HISTORY amath/usr/share/doc/amath/ -cp build/debian/README amath/usr/share/doc/amath/ +gzip --best -n amath/usr/share/doc/amath/HISTORY +cp README amath/usr/share/doc/amath/ +gzip --best -n amath/usr/share/doc/amath/README +chmod 644 amath/usr/share/doc/amath/* + +# Copy man pages +cp amath.1 amath/usr/share/man/man1/amath.1 +cp src/clib/amathc.3 amath/usr/share/man/man3/amathc.3 +cp src/real/amathr.3 amath/usr/share/man/man3/amathr.3 +cp src/cplex/amathi.3 amath/usr/share/man/man3/amathi.3 + +gzip --best -n amath/usr/share/man/man1/amath.1 +gzip --best -n amath/usr/share/man/man3/amathc.3 +gzip --best -n amath/usr/share/man/man3/amathr.3 +gzip --best -n amath/usr/share/man/man3/amathi.3 +chmod 644 amath/usr/share/man/man1/* +chmod 644 amath/usr/share/man/man3/* # Copy scripts -cp script/* amath/usr/local/share/amath/ +cp script/* amath/usr/share/amath/ +chmod 644 amath/usr/share/amath/* -# Make the package -cp build/debian/control-amd64 amath/DEBIAN/control -dpkg-deb --build amath -mv amath.deb amath-${version}_amd64.deb +# Create control file +{ +echo "Package: amath" +echo "Version: ${version}" +echo "Architecture: $1" +echo "Maintainer: Carsten Larsen " +echo "Installed-Size: $4" +echo "Depends: libc6" +echo "Section: math" +echo "Priority: optional" +echo "Homepage: http://amath.innolan.net" +echo "Built-Using: gcc-5.4" +echo "Description: Simple command line calculator" +echo " Features a case sensitive command line interface, internal IEEE 754" +echo " calculations with 15 significant digits, calculations with real and" +echo " complex numbers, variables and user defined functions, logarithmic" +echo " and exponential functions, trigonometric and hyperbolic function" +echo " and selected mathematical constants and rounding functions." +} >amath/DEBIAN/control +chmod 0755 amath/DEBIAN/control -# Build a debian package for i386 +# Create license file +{ +echo "Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/" +echo "Upstream-Name: amath" +echo "Source: http://amath.innolan.net" +echo +echo "Files: *" +echo "Copyright: 2014-2017 Carsten Sonne Larsen " +echo " 2007 The NetBSD Foundation, Inc." +echo " 1990, 1993 The Regents of the University of California." +echo "License: BSD-2-Clause" +echo " Redistribution and use in source and binary forms, with or without" +echo " modification, are permitted provided that the following conditions are met:" +echo " ." +echo " Redistributions of source code must retain the above copyright notice, this" +echo " list of conditions and the following disclaimer." +echo " ." +echo " Redistributions in binary form must reproduce the above copyright notice," +echo " this list of conditions and the following disclaimer in the documentation" +echo " and/or other materials provided with the distribution." +echo " ." +echo " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"" +echo " AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE" +echo " IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE" +echo " DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE" +echo " FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL" +echo " DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR" +echo " SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER" +echo " CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY," +echo " OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE" +echo " OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +} >amath/DEBIAN/copyright +gzip --best -n amath/DEBIAN/copyright +chmod 0755 amath/DEBIAN/copyright.gz +# Create change log +{ +echo "amath (${version}) unstable; urgency=low" +echo +echo " * Initial Debian Release." +echo +echo " -- Carsten Larsen Sat, 04 Mar 2017 19:49:07 +0100" +} >amath/DEBIAN/changelog.Debian +gzip --best -n amath/DEBIAN/changelog.Debian +chmod 0755 amath/DEBIAN/changelog.Debian.gz + +{ +echo "libamath ${version}" +echo "libamathc ${version}" +echo "libamathcplex ${version}" +echo "libamathapp ${version}" +} >amath/DEBIAN/shlibs +chmod 0644 amath/DEBIAN/shlibs + +# Create post install script +{ +echo "#!/bin/sh" +echo "set -e" +echo "ln -s /usr/lib/libamathapp.so.${version} /usr/lib/libamathapp.so" +echo "ln -s /usr/lib/libamathc.so.${version} /usr/lib/libamathc.so" +echo "ln -s /usr/lib/libamath.so.${version} /usr/lib/libamath.so" +echo "ln -s /usr/lib/libamathcplex.so.${version} /usr/lib/libamathcplex.so" +echo "ldconfig" +} >amath/DEBIAN/postinst +chmod 0755 amath/DEBIAN/postinst + +# Create post remove script +{ +echo "#!/bin/sh" +echo "set -e" +echo "if [ "\$1" = "remove" ]; then" +echo "ldconfig" +echo "fi" +echo "rm -f /usr/lib/libamathapp.so.${version}" +echo "rm -f /usr/lib/libamathc.so.${version}" +echo "rm -f /usr/lib/libamath.so.${version}" +echo "rm -f /usr/lib/libamathcplex.so.${version}" +} >amath/DEBIAN/postrm +chmod 0755 amath/DEBIAN/postrm + +fakeroot dpkg-deb --build amath +mv amath.deb amath-${version}_$1.deb rm -Rf amath +} -# Build -sh configure cflags="-m32" -make clean -make -mv amath amath.tmp -make clean - -# Create filesystem layout -rm -Rf amath - -mkdir -p amath/DEBIAN -mkdir -p amath/usr/bin -mkdir -p amath/usr/share/doc/amath -mkdir -p amath/usr/local/share/amath - -mv amath.tmp amath/usr/bin/amath - -# Copy documentation -cp LICENSE amath/usr/share/doc/amath/ -cp HISTORY amath/usr/share/doc/amath/ -cp build/debian/README amath/usr/share/doc/amath/ - -# Copy scripts -cp script/* amath/usr/local/share/amath/ - -# Make the package -cp build/debian/control-i386 amath/DEBIAN/control -dpkg-deb --build amath -mv amath.deb amath-${version}_i386.deb - -# Cleanup -#rm -Rf amath +build_package 'amd64' '' 64 980 +build_package 'i386' '-m32' 32 980 diff --git a/builddist b/builddist index 5ff589cb..eb486eea 100755 --- a/builddist +++ b/builddist @@ -1,109 +1,56 @@ #!/bin/sh +set -e + rm -f amath.lha rm -Rf amath rm -Rf dist mkdir dist -cd build/flexcat -./configure -make clean -make -cd ../.. - -./configure --disable-test --cflags="-m68000 -noixemul" --cross-compile="m68k-amigaos" +./configure --disable-test --cross-compile="m68k-amigaos" CFLAGS="-m68000 -noixemul" make clean make static mv amath dist/amath.000 make clean -./configure --disable-test --cflags="-m68020 -noixemul" --cross-compile="m68k-amigaos" +./configure --disable-test --cross-compile="m68k-amigaos" CFLAGS="-m68020 -noixemul" make static mv amath dist/amath.020 make clean -./configure --disable-test --cflags="-m68030 -noixemul" --cross-compile="m68k-amigaos" +./configure --disable-test --cross-compile="m68k-amigaos" CFLAGS="-m68030 -noixemul" make static mv amath dist/amath.030 make clean -#./configure --disable-test --cflags="-m68040 -noixemul" --cross-compile="m68k-amigaos" -#make static -#mv amath dist/amath.040 -#make clean -#./configure --disable-test --cflags="-m68060 -noixemul" --cross-compile="m68k-amigaos" -#make static -#mv amath dist/amath.060 -#make clean -#./configure --disable-test --cflags="-m68020 -m68881 -noixemul" --cross-compile="m68k-amigaos" -#make static -#mv amath dist/amath.020f -#make clean -#./configure --disable-test --cflags="-m68030 -m68881 -noixemul" --cross-compile="m68k-amigaos" -#make static -#mv amath dist/amath.030f -#make clean -./configure --enable-test --cflags="-m68000 -noixemul" --cross-compile="m68k-amigaos" +./configure --enable-test --cross-compile="m68k-amigaos" CFLAGS="-m68000 -noixemul" make static mv amath dist/amath-test.000 make clean -./configure --enable-test --cflags="-m68020 -noixemul" --cross-compile="m68k-amigaos" +./configure --enable-test --cross-compile="m68k-amigaos" CFLAGS="-m68020 -noixemul" make static mv amath dist/amath-test.020 make clean -./configure --enable-test --cflags="-m68030 -noixemul" --cross-compile="m68k-amigaos" +./configure --enable-test --cross-compile="m68k-amigaos" CFLAGS="-m68030 -noixemul" make static mv amath dist/amath-test.030 make clean -#./configure --enable-test --cflags="-m68040 -noixemul" --cross-compile="m68k-amigaos" -#make static -#mv amath dist/amath-test.040 -#make clean -#./configure --enable-test --cflags="-m68060 -noixemul" --cross-compile="m68k-amigaos" -#make static -#mv amath dist/amath-test.060 -#make clean -#./configure --enable-test --cflags="-m68020 -m68881 -noixemul" --cross-compile="m68k-amigaos" -#make static -#mv amath dist/amath-test.020f -#make clean -#./configure --enable-test --cflags="-m68030 -m68881 -noixemul" --cross-compile="m68k-amigaos" -#make static -#mv amath dist/amath-test.030f -#make clean cd dist touch hashkeys sha1sum amath.000 >>hashkeys sha1sum amath.020 >>hashkeys sha1sum amath.030 >>hashkeys -#sha1sum amath.040 >>hashkeys -#sha1sum amath.060 >>hashkeys -#sha1sum amath.020f >>hashkeys -#sha1sum amath.030f >>hashkeys sha1sum amath-test.000 >>hashkeys sha1sum amath-test.020 >>hashkeys sha1sum amath-test.030 >>hashkeys -#sha1sum amath-test.040 >>hashkeys -#sha1sum amath-test.060 >>hashkeys -#sha1sum amath-test.020f >>hashkeys -#sha1sum amath-test.030f >>hashkeys sha256sum amath.000 >>hashkeys sha256sum amath.020 >>hashkeys sha256sum amath.030 >>hashkeys -#sha256sum amath.040 >>hashkeys -#sha256sum amath.060 >>hashkeys -#sha256sum amath.020f >>hashkeys -#sha256sum amath.030f >>hashkeys sha256sum amath-test.000 >>hashkeys sha256sum amath-test.020 >>hashkeys sha256sum amath-test.030 >>hashkeys -#sha256sum amath-test.040 >>hashkeys -#sha256sum amath-test.060 >>hashkeys -#sha256sum amath-test.020f >>hashkeys -#sha256sum amath-test.030f >>hashkeys cd .. -make amigacatalogs - +make catalogs cp LICENSE dist/ cp HISTORY dist/ diff --git a/buildwin b/buildwin index aafd9c9d..93c7bb25 100755 --- a/buildwin +++ b/buildwin @@ -1,30 +1,33 @@ #!/bin/sh +set -e + version="1.7.0" echo "Building amath ${version} for Windows ..." -touch hashkeys +rm -f amath-${version}.zip rm -Rf amath rm -Rf dist mkdir dist -./configure --enable-test --cross-compile="i686-w64-mingw32" --cflags="-D_WIN32" --ldflags="-static -static-libgcc -static-libstdc++" +./configure --enable-test --cross-compile="i686-w64-mingw32" CFLAGS="-D_WIN32" LDFLAGS="-static -static-libgcc -static-libstdc++" +make clean make static mv amath dist/amath-${version}-x86.exe make clean -./configure --enable-test --cross-compile="x86_64-w64-mingw32" --cflags="-D_WIN32" --ldflags="-static -static-libgcc -static-libstdc++" +./configure --enable-test --cross-compile="x86_64-w64-mingw32" CFLAGS="-D_WIN32" LDFLAGS="-static -static-libgcc -static-libstdc++" make static mv amath dist/amath-${version}-x64.exe make clean -./configure --enable-test --cross-compile="i686-w64-mingw32" --cflags="-D_WIN32 -DANSICONSOLE" --ldflags="-static -static-libgcc -static-libstdc++" +./configure --enable-test --cross-compile="i686-w64-mingw32" CFLAGS="-D_WIN32 -DANSICONSOLE" LDFLAGS="-static -static-libgcc -static-libstdc++" make static mv amath dist/amath-${version}-ansi-x86.exe make clean -./configure --enable-test --cross-compile="x86_64-w64-mingw32" --cflags="-D_WIN32 -DANSICONSOLE" --ldflags="-static -static-libgcc -static-libstdc++" +./configure --enable-test --cross-compile="x86_64-w64-mingw32" CFLAGS="-D_WIN32 -DANSICONSOLE" LDFLAGS="-static -static-libgcc -static-libstdc++" make static mv amath dist/amath-${version}-ansi-x64.exe make clean diff --git a/catalog/dansk/amath-help.ct b/catalog/dansk/amath-help.ct index 9052fadd..15001343 100644 --- a/catalog/dansk/amath-help.ct +++ b/catalog/dansk/amath-help.ct @@ -39,9 +39,8 @@ symtrigon -------------------------------------------------#NEWLINE#sin Trigonometrisk sinus funktion.#NEWLINE#cos Trigonometrisk cosinus funktion.#NEWLINE#tan Trigonometrisk tangent funktion.#NEWLINE#cot Trigonometrisk cotangent funktion.#NEWLINE#sec Trigonometrisk secant funktion.#NEWLINE#csc Trigonometrisk cosecant funktion.#NEWLINE#asin Invers trigonometrisk sinus funktion.#NEWLINE#acos Invers trigonometrisk cosinus funktion.#NEWLINE#atan Invers trigonometrisk tangent funktion.#NEWLINE#acot Invers trigonometrisk cotangent funktion.#NEWLINE#asec Invers trigonometrisk secant funktion.#NEWLINE#acsc Invers trigonometrisk cosecant funktion.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse funktioner kan prefixes med ar eller arc #NEWLINE#i stedet for a.#NEWLINE# symhyper -------------------------------------------------#NEWLINE#sinh Hyperbolsk sinus funktion.#NEWLINE#cosh Hyperbolsk cosinus funktion.#NEWLINE#tanh Hyperbolsk tangent funktion.#NEWLINE#coth Hyperbolsk cotangent funktion.#NEWLINE#sech Hyperbolsk secant funktion.#NEWLINE#csch Hyperbolsk cosecant funktion. #NEWLINE#asinh Invers hyperbolsk sinus funktion.#NEWLINE#acosh Invers hyperbolsk cosinus funktion.#NEWLINE#atanh Invers hyperbolsk tangent funktion.#NEWLINE#acoth Invers hyperbolsk cotangent funktion.#NEWLINE#asech Invers hyperbolsk secant funktion.#NEWLINE#acsch Invers hyperbolsk cosecant funktion.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse funktioner kan prefixes med ar eller arc #NEWLINE#i stedet for a.#NEWLINE# -; Table of statements -symstatement -----------------------------------------------------------------------#NEWLINE#ryd Ryd konsol vindue.#NEWLINE#definer Definer funktion.#NEWLINE#slet Slet variabler og funktioner.#NEWLINE#cifre Angiv antal betydende cifre.#NEWLINE#beregn Beregn aritmetiske udtryk.#NEWLINE#k�r Afvikel kommondoer i en fil.#NEWLINE#funktioner Vis liste med brugerdefinerede funktioner.#NEWLINE#ind Skift numerisk talsystem ved l�sning (eksperimentelt).#NEWLINE#hj�lp Vis grundl�ggende hj�lpetekst.#NEWLINE#ud Skift numerisk talsystem ved skrivning (eksperimentelt).#NEWLINE#list Vis indholdet af en mappe.#NEWLINE#vis Vis indholdet af en fil.#NEWLINE#hent Hent variabler og funktioner fra en fil.#NEWLINE#gem Gem variabler og funktioner til en fil.#NEWLINE#variabler Vis variabler i hukommelsen.#NEWLINE#version Vis infomation om denne version.#NEWLINE#hukommelse Vis internt hukommelsesforbrug.#NEWLINE#afslut Afslut program.#NEWLINE#----------------------------------------------------------------------#NEWLINE#Det er valgfrit at angive definer og beregn kommandoerne. Kommandoerne#NEWLINE#funktioner og variabler kan forkortes til funk og var.#NEWLINE# +symearly +TODO-------------------------------------------------#NEWLINE#ver Versed sine function.#NEWLINE#vcs Versed cosine function.#NEWLINE#cvs Coversed sine function.#NEWLINE#cvc Coversed cosine function.#NEWLINE#hv Haversed sine function.#NEWLINE#hvc Haversed cosine function.#NEWLINE#hcv Hacoversed sine function.#NEWLINE#hcc Hacoversed cosine function.#NEWLINE#aver Inverse versed sine function.#NEWLINE#avcs Inverse versed cosine function.#NEWLINE#acvs Inverse coversed sine function.#NEWLINE#acvc Inverse coversed cosine function.#NEWLINE#ahv Inverse haversed sine function.#NEWLINE#ahvc Inverse haversed cosine function.#NEWLINE#ahcv Inverse hacoversed sine function.#NEWLINE#ahcc Inverse hacoversed cosine function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE# symcomplex Udtryk med komplekse tal skrives ved at angive i#NEWLINE#sammen med den imagin�re talv�rdi. Komplekse tal#NEWLINE#kan blandes med reelle tal.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: 2+3i#NEWLINE#Eksempel: 2+3.2i*cos(-1i)+5/7#NEWLINE# symclear @@ -82,6 +81,10 @@ symsave Med gem kommando kan variabler og funktioner i hukommelsen gemmes til en fil.#NEWLINE#Gemte variabler og funktion kan indl�stet igen med #SYNTAXHIGHLIGHT#hent#NORMAL# kommandoen.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: gem "mitarbejde"#NEWLINE# symversion Viser hvilken version af amath der k�rer.#NEWLINE# +symabout +TODOShow various information about the running version of amath.#NEWLINE# +symlicense +TODOShow license details.#NEWLINE# symmem Viser internt hukommelsesforbrug. Programkoden er ikke medregnet.#NEWLINE# ; Help for prefs statement diff --git a/catalog/dansk/amath-ident.ct b/catalog/dansk/amath-ident.ct index 58a31c4b..ec54132f 100644 --- a/catalog/dansk/amath-ident.ct +++ b/catalog/dansk/amath-ident.ct @@ -10,72 +10,112 @@ ; ## Parts of the content came from wikipedia.org ; ############################################################################# abs -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# sgn -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# round -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# trunc -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# floor -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# ceil -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# sqr -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# cbr -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# lb -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# ln -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# lg -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# sin -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# cos -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# tan -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# cot -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# sec -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# csc -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# asin -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# acos -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# atan -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# acot -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# asec -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# acsc -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# sinh -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# cosh -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# tanh -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# coth -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# sech -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# csch -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# asinh -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# acosh -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# atanh -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# acoth -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# asech -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# acsch -Der er ikke nogen hjælp tilgængelig om den funktion.#NEWLINE# +Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# +ver +The versed sine is an early appearing trigonometric function.#NEWLINE#It is equal to one minus the cosine.#NEWLINE#ver(x) = 1 - cos(x)#NEWLINE# +vcs +The versed cosine is an early appearing trigonometric function.#NEWLINE#It is equal to one plus the cosine.#NEWLINE#ver(x) = 1 + cos(x)#NEWLINE# +cvs +The coversed sine is an early appearing trigonometric function.#NEWLINE#It is equal to one minus the sine.#NEWLINE#ver(x) = 1 - sin(x)#NEWLINE# +cvc +The coversed cosine is an early appearing trigonometric function.#NEWLINE#It is equal to one plus the sine.#NEWLINE#cvc(x) = 1 + sin(x)#NEWLINE# +hv +No help is available for the haversed sine function.#NEWLINE# +hvc +No help is available for the haversed cosine function.#NEWLINE# +hcv +No help is available for the hacoversed sine function.#NEWLINE# +hcc +No help is available for the hacoversed cosine function.#NEWLINE# +aver +No help is available for this function.#NEWLINE# +avcs +No help is available for this function.#NEWLINE# +acvs +No help is available for this function.#NEWLINE# +acvc +No help is available for this function.#NEWLINE# +ahv +No help is available for this function.#NEWLINE# +ahvc +No help is available for this function.#NEWLINE# +ahcv +No help is available for this function.#NEWLINE# +ahcc +No help is available for this function.#NEWLINE# +exsec +No help is available for this function.#NEWLINE# +excsc +No help is available for this function.#NEWLINE# +aexsec +No help is available for this function.#NEWLINE# +aexcsc +No help is available for this function.#NEWLINE# \ No newline at end of file diff --git a/catalog/dansk/amath-keyword.ct b/catalog/dansk/amath-keyword.ct index 25459fba..15e41134 100644 --- a/catalog/dansk/amath-keyword.ct +++ b/catalog/dansk/amath-keyword.ct @@ -88,6 +88,9 @@ hyper hyper hyperbolic hyperbolsk +;######### Early keyword +early +tidlig ;######### HelpStatement help hj�lp @@ -153,3 +156,9 @@ hex hex hexadecimal hexadecimal +;######### AboutStatement and keyword +about +om +;######### LicenseStatement and keyword +license +lisens \ No newline at end of file diff --git a/catalog/dansk/amath-text.ct b/catalog/dansk/amath-text.ct index b0ef4800..99c76200 100644 --- a/catalog/dansk/amath-text.ct +++ b/catalog/dansk/amath-text.ct @@ -28,6 +28,46 @@ ; ############################################################################# INTROMSG #NORMALTEXT##BOLD##STARTMSG##NEWLINE##NORMALTEXT##COLOR02#Skriv hj�lp for at f� vist uddybende information.#NEWLINE# +STATEMENTLINE +---------------------------------------------------------#NEWLINE# +STATEMENTCLEAR +clear Clear console window.#NEWLINE# +STATEMENTDEF +def Define function.#NEWLINE# +STATEMENTDELETE +delete Delete variable or function.#NEWLINE# +STATEMENTDIGITS +digits Set number of significant digits.#NEWLINE# +STATEMENTEVAL +eval Evaluate arithmetic expression.#NEWLINE# +STATEMENTEXECUTE +execute Execute statements in a file.#NEWLINE# +STATEMENTFUNCS +functions Show list of user defined functions.#NEWLINE# +STATEMENTINPUT +input Change numeral input system.#NEWLINE# +STATEMENTHELP +help Show basic help text.#NEWLINE# +STATEMENTOUTPUT +output Change numeral output system.#NEWLINE# +STATEMENTLIST +list Show content of a directory.#NEWLINE# +STATEMENTSHOW +show Show content of a file.#NEWLINE# +STATEMENTLOAD +load Load variable and functions from file.#NEWLINE# +STATEMENTSAVE +save Save variable and functions to file.#NEWLINE# +STATEMENTVARS +variables Show list of variables.#NEWLINE# +STATEMENTVERSION +version Show version string.#NEWLINE# +STATEMENTMEMORY +memory Show internal memory usage.#NEWLINE# +STATEMENTEXIT +exit Exit program.#NEWLINE# +STATEMENTFOOTER +The def and eval statements are optional. Functions and#NEWLINE#variables statements can be shorten to funcs and vars.#NEWLINE# TXTLISTDIRHEADER Type Navn#NEWLINE#-----------------------------------------------#NEWLINE# TXTLISTDIRTFILE diff --git a/catalog/english/amath-help.ct b/catalog/english/amath-help.ct index 8eb94b25..4db1684a 100644 --- a/catalog/english/amath-help.ct +++ b/catalog/english/amath-help.ct @@ -1,4 +1,4 @@ -## version $VER: amath-help.catalog 1.60 (08.04.2015) English +## version $VER: amath-help.catalog 1.70 (28.02.2017) English ## language english ## codeset 0 ; ############################################################################# @@ -31,7 +31,7 @@ ; ############################################################################# ; Introduction table - Symbol(0) symzero -Enter command or expression to evaluate.#NEWLINE##SYNTAXHIGHLIGHT#Example: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#More help is available for designated topics.#NEWLINE#-------------------------------------------------#NEWLINE#functions Base functions.#NEWLINE#trigon Trigonometric functions.#NEWLINE#hyper Hyperbolic functions.#NEWLINE#complex Syntax for complex numbers.#NEWLINE#statements Available statements.#NEWLINE#operators Supported operators.#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: help trigon#NEWLINE# +Enter command or expression to evaluate.#NEWLINE##SYNTAXHIGHLIGHT#Example: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#More help is available for designated topics.#NEWLINE#-------------------------------------------------#NEWLINE#functions Base functions.#NEWLINE#trigon Trigonometric functions.#NEWLINE#hyper Hyperbolic functions.#NEWLINE#early Early trigonometric functions.#NEWLINE#complex Syntax for complex numbers.#NEWLINE#statements Available statements.#NEWLINE#operators Supported operators.#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: help trigon#NEWLINE# ; Table of operators symoperator -------------------------------------------------#NEWLINE# + Mathematical addition.#NEWLINE# - Mathematical subtraction.#NEWLINE# * Mathematical multiplication.#NEWLINE# / Mathematical division.#NEWLINE# ^ Mathematical exponentiation.#NEWLINE# = Assignment of variable values.#NEWLINE# | Absolute value of number. #NEWLINE#-------------------------------------------------#NEWLINE# @@ -40,13 +40,13 @@ symfunction -------------------------------------------------#NEWLINE#abs Absolute value of number.#NEWLINE#sgn Mathematical signum function.#NEWLINE#round Round to nearest integer number.#NEWLINE#trunc Discard fraction part of number.#NEWLINE#floor Mathematical floor function.#NEWLINE#ceil Mathematical ceiling function.#NEWLINE#sqrt Square root function (exp 1/2).#NEWLINE#cbrt Cube root function (exp 1/3).#NEWLINE#lb Binary logarithm function (base 2).#NEWLINE#ln Natural logarithm function (base e).#NEWLINE#lg Common logarithm function (base 10).#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: round(1.55)#NORMALTEXT##NEWLINE# ; Table of trigonometric functions symtrigon --------------------------------------------------#NEWLINE#sin Trigonometric sine function.#NEWLINE#cos Trigonometric cosine function.#NEWLINE#tan Trigonometric tangent function.#NEWLINE#cot Trigonometric cotangent function.#NEWLINE#sec Trigonometric secant function.#NEWLINE#csc Trigonometric cosecant function.#NEWLINE#asin Inverse trigonometric sine function.#NEWLINE#acos Inverse trigonometric cosine function.#NEWLINE#atan Inverse trigonometric tangent function.#NEWLINE#acot Inverse trigonometric cotangent function.#NEWLINE#asec Inverse trigonometric secant function.#NEWLINE#acsc Inverse trigonometric cosecant function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE# +-------------------------------------------------#NEWLINE#sin Trigonometric sine function.#NEWLINE#cos Trigonometric cosine function.#NEWLINE#tan Trigonometric tangent function.#NEWLINE#cot Trigonometric cotangent function.#NEWLINE#sec Trigonometric secant function.#NEWLINE#csc Trigonometric cosecant function.#NEWLINE#exsec Trigonometric exsecant function.#NEWLINE#excsc Trigonometric excosecant function.#NEWLINE#asin Inverse trigonometric sine function.#NEWLINE#acos Inverse trigonometric cosine function.#NEWLINE#atan Inverse trigonometric tangent function.#NEWLINE#acot Inverse trigonometric cotangent function.#NEWLINE#asec Inverse trigonometric secant function.#NEWLINE#acsc Inverse trigonometric cosecant function.#NEWLINE#exsec Inverse trigonometric exsecant function.#NEWLINE#excsc Inverse trigonometric excosecant function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE# ; Table of hyperbolic functions symhyper -------------------------------------------------#NEWLINE#sinh Hyperbolic sine function.#NEWLINE#cosh Hyperbolic cosine function.#NEWLINE#tanh Hyperbolic tangent function.#NEWLINE#coth Hyperbolic cotangent function.#NEWLINE#sech Hyperbolic secant function.#NEWLINE#csch Hyperbolic cosecant function. #NEWLINE#asinh Inverse hyperbolic sine function.#NEWLINE#acosh Inverse hyperbolic cosine function.#NEWLINE#atanh Inverse hyperbolic tangent function.#NEWLINE#acoth Inverse hyperbolic cotangent function.#NEWLINE#asech Inverse hyperbolic secant function.#NEWLINE#acsch Inverse hyperbolic cosecant function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE# -; Table of statements -symstatement ----------------------------------------------------------#NEWLINE#clear Clear console window.#NEWLINE#def Define function.#NEWLINE#delete Delete variable or function.#NEWLINE#digits Set number of significant digits.#NEWLINE#eval Evaluate arithmetic expression.#NEWLINE#execute Execute statements in a file.#NEWLINE#functions Show list of user defined functions.#NEWLINE#input Change numeral input system.#NEWLINE#help Show basic help text.#NEWLINE#output Change numeral output system.#NEWLINE#list Show content of a directory.#NEWLINE#show Show content of a file.#NEWLINE#load Load variable and functions from file.#NEWLINE#save Save variable and functions to file.#NEWLINE#variables Show list of variables.#NEWLINE#version Show version string.#NEWLINE#memory Show internal memory usage.#NEWLINE#exit Exit program.#NEWLINE#---------------------------------------------------------#NEWLINE#The def and eval statements are optional. Functions and#NEWLINE#variables statements can be shorten to funcs and vars.#NEWLINE# +; Table of early trigonometric functions +symearly +-------------------------------------------------#NEWLINE#ver Versed sine function.#NEWLINE#vcs Versed cosine function.#NEWLINE#cvs Coversed sine function.#NEWLINE#cvc Coversed cosine function.#NEWLINE#hv Haversed sine function.#NEWLINE#hvc Haversed cosine function.#NEWLINE#hcv Hacoversed sine function.#NEWLINE#hcc Hacoversed cosine function.#NEWLINE#aver Inverse versed sine function.#NEWLINE#avcs Inverse versed cosine function.#NEWLINE#acvs Inverse coversed sine function.#NEWLINE#acvc Inverse coversed cosine function.#NEWLINE#ahv Inverse haversed sine function.#NEWLINE#ahvc Inverse haversed cosine function.#NEWLINE#ahcv Inverse hacoversed sine function.#NEWLINE#ahcc Inverse hacoversed cosine function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE# ; Help for complex numbers symcomplex Expressions with complex numbers are written using an i to denote#NEWLINE#the imaginary value. Complex numbers can seamlessly be mixed with#NEWLINE#real numbers.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: 2+3i#NEWLINE#Example: 2+3.2i*cos(-1i)+5/7#NEWLINE# @@ -92,6 +92,12 @@ The save statement saves defined variables and functions to a file in a#NEWLINE# ; Help for version statement symversion Show which version of amath is running.#NEWLINE# +; Help for about statement +symabout +Show various information about the running version of amath.#NEWLINE# +; Help for license statement +symlicense +Show license details.#NEWLINE# ; Help for memory statement symmem Show internal memory usage together with maximum usage.#NEWLINE# @@ -127,4 +133,4 @@ symdec No help is available for the decimal keyword#NEWLINE ; Help for hexadecimal keyword symhex -No help is available for the hexadecimal keyword#NEWLINE +No help is available for the hexadecimal keyword#NEWLINE \ No newline at end of file diff --git a/catalog/english/amath-ident.ct b/catalog/english/amath-ident.ct index 36e9452a..a33a2c92 100644 --- a/catalog/english/amath-ident.ct +++ b/catalog/english/amath-ident.ct @@ -1,4 +1,4 @@ -## version $VER: amath-ident.catalog 1.60 (08.04.2015) English +## version $VER: amath-ident.catalog 1.70 (28.02.2017) English ## language english ## codeset 0 ;############################################################################# @@ -87,3 +87,43 @@ asech No help is available for this function.#NEWLINE# acsch No help is available for this function.#NEWLINE# +ver +The versed sine is an early appearing trigonometric function.#NEWLINE#It is equal to one minus the cosine.#NEWLINE#ver(x) = 1 - cos(x)#NEWLINE# +vcs +The versed cosine is an early appearing trigonometric function.#NEWLINE#It is equal to one plus the cosine.#NEWLINE#ver(x) = 1 + cos(x)#NEWLINE# +cvs +The coversed sine is an early appearing trigonometric function.#NEWLINE#It is equal to one minus the sine.#NEWLINE#ver(x) = 1 - sin(x)#NEWLINE# +cvc +The coversed cosine is an early appearing trigonometric function.#NEWLINE#It is equal to one plus the sine.#NEWLINE#cvc(x) = 1 + sin(x)#NEWLINE# +hv +No help is available for the haversed sine function.#NEWLINE# +hvc +No help is available for the haversed cosine function.#NEWLINE# +hcv +No help is available for the hacoversed sine function.#NEWLINE# +hcc +No help is available for the hacoversed cosine function.#NEWLINE# +aver +No help is available for this function.#NEWLINE# +avcs +No help is available for this function.#NEWLINE# +acvs +No help is available for this function.#NEWLINE# +acvc +No help is available for this function.#NEWLINE# +ahv +No help is available for this function.#NEWLINE# +ahvc +No help is available for this function.#NEWLINE# +ahcv +No help is available for this function.#NEWLINE# +ahcc +No help is available for this function.#NEWLINE# +exsec +No help is available for this function.#NEWLINE# +excsc +No help is available for this function.#NEWLINE# +aexsec +No help is available for this function.#NEWLINE# +aexcsc +No help is available for this function.#NEWLINE# \ No newline at end of file diff --git a/catalog/english/amath-text.ct b/catalog/english/amath-text.ct index ea579251..e5b33aea 100644 --- a/catalog/english/amath-text.ct +++ b/catalog/english/amath-text.ct @@ -1,4 +1,4 @@ -## version $VER: amath-text.catalog 1.60 (08.04.2015) English +## version $VER: amath-text.catalog 1.70 (28.02.2017) English ## language english ## codeset 0 ; ############################################################################# @@ -31,6 +31,46 @@ ; ############################################################################# INTROMSG #NORMALTEXT##BOLD##STARTMSG##NEWLINE##NORMALTEXT##COLOR02#Type help to show info.#NEWLINE# +STATEMENTLINE +---------------------------------------------------------#NEWLINE# +STATEMENTCLEAR +clear Clear console window.#NEWLINE# +STATEMENTDEF +def Define function.#NEWLINE# +STATEMENTDELETE +delete Delete variable or function.#NEWLINE# +STATEMENTDIGITS +digits Set number of significant digits.#NEWLINE# +STATEMENTEVAL +eval Evaluate arithmetic expression.#NEWLINE# +STATEMENTEXECUTE +execute Execute statements in a file.#NEWLINE# +STATEMENTFUNCS +functions Show list of user defined functions.#NEWLINE# +STATEMENTINPUT +input Change numeral input system.#NEWLINE# +STATEMENTHELP +help Show basic help text.#NEWLINE# +STATEMENTOUTPUT +output Change numeral output system.#NEWLINE# +STATEMENTLIST +list Show content of a directory.#NEWLINE# +STATEMENTSHOW +show Show content of a file.#NEWLINE# +STATEMENTLOAD +load Load variable and functions from file.#NEWLINE# +STATEMENTSAVE +save Save variable and functions to file.#NEWLINE# +STATEMENTVARS +variables Show list of variables.#NEWLINE# +STATEMENTVERSION +version Show version string.#NEWLINE# +STATEMENTMEMORY +memory Show internal memory usage.#NEWLINE# +STATEMENTEXIT +exit Exit program.#NEWLINE# +STATEMENTFOOTER +The def and eval statements are optional. Functions and#NEWLINE#variables statements can be shorten to funcs and vars.#NEWLINE# TXTLISTDIRHEADER Type Name#NEWLINE#-----------------------------------------------#NEWLINE# TXTLISTDIRTFILE @@ -60,7 +100,7 @@ Function cannot be redefined:#SPACE# HELPPNUMERA Base value must be between 2 and 32:#SPACE# HELPPDIGITS -Number of digits must be between 0 and 15:#SPACE# +Number of digist must be between 0 and 15:#SPACE# HELPINPUSHOW Numeral input system is#SPACE# HELPOUTPSHOW @@ -96,4 +136,4 @@ Preferences could not be saved.#NEWLINE# MSGNODIR Could not open directory:#SPACE# MSGNOFILE -Cannot open file.#NEWLINE# +Cannot open file.#NEWLINE# \ No newline at end of file diff --git a/configure b/configure index c3910a8e..49d4b5e1 100755 --- a/configure +++ b/configure @@ -27,75 +27,94 @@ set -e +version="1.7.0" + clang=false debugsym=false regtest=true prefix="/usr" +pkgconfigdir="lib/pkgconfig" cflags="" cxxflags="" ldflags="" gcclib="-lstdc++" for arg in "$@"; do - case "$arg" in - --prefix=*) - prefix=`echo $arg | sed 's/--prefix=//'` - ;; + case "$arg" in + --prefix=*) + prefix=`echo $arg | sed 's/--prefix=//'` + ;; - --cross-compile=*) - crosscompile=`echo $arg | sed 's/--cross-compile=//'` + --pkgconfig=*) + pkgconfigdir=`echo $arg | sed 's/--pkgconfig=//'` + ;; + + --cross-compile=*) + crosscompile=`echo $arg | sed 's/--cross-compile=//'` crosscompile="${crosscompile}-" - ;; + ;; - --cflags=*) - cflags=`echo $arg | sed 's/--cflags=//'` + CFLAGS=*) + cflags=`echo $arg | sed 's/CFLAGS=//'` cflags="${cflags} " - ;; + ;; - --cxxflags=*) - cxxflags=`echo $arg | sed 's/--cxxflags=//'` + CXXFLAGS=*) + cxxflags=`echo $arg | sed 's/CXXFLAGS=//'` cxxflags="${cxxflags} " - ;; + ;; - --ldflags=*) - ldflags=`echo $arg | sed 's/--ldflags=//'` + LDFLAGS=*) + ldflags=`echo $arg | sed 's/LDFLAGS=//'` ldflags="${ldflags} " - ;; - + ;; + --enable-clang) - clang=true;; - --disable-clang) - clang=false;; + clang=true;; + --disable-clang) + clang=false;; - --enable-debug) - debugsym=true;; - --disable-debug) - debugsym=false;; + --enable-debug) + debugsym=true;; + --disable-debug) + debugsym=false;; - --enable-test) - regtest=true;; - --disable-test) - regtest=false;; + --enable-test) + regtest=true;; + --disable-test) + regtest=false;; - --help) - echo 'usage: ./configure [options]' - echo 'options:' - echo ' --prefix=: installation prefix' - echo ' --cflag=: additional compiler flags' - echo ' --cxxflag=: additional compiler flags' - echo ' --ldflag=: additional linker flags' - echo ' --cross-compile=: cross compiler prefix' - echo ' --enable-debug: include debug symbols' - echo ' --disable-debug: do not include debug symbols' - echo ' --enable-test: build code with regression tests' - echo ' --disable-test: do not include regression test' - echo ' --enable-clang: build with clang compiler' - echo ' --disable-clang: do not build with clang compiler' - echo 'all invalid options are silently ignored' - exit 0 - ;; - esac + --enable-stdc++) + gcclib="-lstdc++";; + --disable-stdc++) + gcclib="";; + + --help) + echo "amath configure script ${version}" + echo + echo 'usage: ./configure [options]' + echo 'options:' + echo ' --prefix=: installation prefix' + echo ' --pkgconfig=: pkg-config path (without prefix)' + echo ' --cross-compile=: cross compiler prefix' + echo ' --enable-debug: include debug symbols' + echo ' --disable-debug: do not include debug symbols' + echo ' --enable-test: build code with regression tests' + echo ' --disable-test: do not include regression test' + echo ' --enable-clang: build with clang compiler' + echo ' --disable-clang: do not build with clang compiler' + echo ' --enable-stdc++: link with stdc++ library' + echo ' --disable-stdc++: do not link with stdc++ library' + echo + echo ' CFLAGS=: additional compiler flags' + echo ' CXXFLAGS=: additional compiler flags' + echo ' LDFLAGS=: additional linker flags' + echo + echo 'all invalid options are silently ignored' + exit 0 + ;; + esac done if $clang; then @@ -127,7 +146,6 @@ cxxflags="${cflags} ${cxxflags}" APPSRCS=' evaluator.cpp functionlist.cpp -functions.cpp fgrid.cpp lexer.cpp nodes.cpp @@ -145,9 +163,6 @@ console_amiga.cpp console_stdc.cpp filesystem_amiga.cpp filesystem_stdc.cpp -graph.cpp -graph_amiga.cpp -graph_gtk.cpp language.cpp language_amiga.cpp language_posix.cpp @@ -174,6 +189,14 @@ arctan.cpp arccosecant.cpp arccotangent.cpp arcsecant.cpp +arccovercosine.cpp +arccoversine.cpp +archacovercosine.cpp +archacoversine.cpp +archavercosine.cpp +archaversine.cpp +arcvercosine.cpp +arcversine.cpp ceil.cpp cosecant.cpp cosine.cpp @@ -188,6 +211,18 @@ hacovercos.cpp hacoversin.cpp havercos.cpp haversin.cpp +hyparccosecant.cpp +hyparccosine.cpp +hyparccotangent.cpp +hyparcsecant.cpp +hyparcsine.cpp +hyparctangent.cpp +hypcosecant.cpp +hypcosine.cpp +hypcotangent.cpp +hypsecant.cpp +hypsine.cpp +hyptangent.cpp ln.cpp log10.cpp log2.cpp @@ -327,6 +362,25 @@ strcmp.c strlen.c untag.c ' +FLXSRCS=' +asprintf.c +createcat.c +createcatsrc.c +createct.c +globals.c +locale_other.c +main.c +openlibs.c +readprefs.c +scancd.c +scanct.c +scanpo.c +showfuncs.c +strptime.c +swapfuncs.c +utils.c +vastubs.c +' amathc="amathc" amath="amath" @@ -469,17 +523,21 @@ echo ########################## Application Library ########################## { -echo "CXX = ${crosscompile}${cxxcompiler}" -echo "CXXFLAGS = ${libop}${options} ${cxxflags}-I. -I.. -Wall" -echo "AR = ${crosscompile}ar" -echo "RANLIB = ${crosscompile}ranlib" -echo "MKDIR = mkdir -p" -echo "DEL = rm -f" -echo "INSTALL = install -m 0644" -echo "PREFIX = ${prefix}" -echo -echo "alib = lib${amathapp}.a" -echo "solib = lib${amathapp}.so" +echo "CXX = ${crosscompile}${cxxcompiler}" +echo "CXXFLAGS = ${libop}${options} ${cxxflags}-I. -I.. -Wall" +echo "AR = ${crosscompile}ar" +echo "RANLIB = ${crosscompile}ranlib" +echo "MKDIR = mkdir -p" +echo "DEL = rm -f" +echo "INSTALL = install -m 0644" +echo "LDCONFIG = ldconfig" +echo "PREFIX = ${prefix}" +echo "INSTDIR = \${DESTDIR}\${PREFIX}/lib/amath" +echo "INSTDIRI = \${DESTDIR}\${PREFIX}/include/amath" +echo "INSTDIRPC = \${DESTDIR}\${PREFIX}/${pkgconfigdir}" +echo "alib = lib${amathapp}.a" +echo "solib = lib${amathapp}.so" +echo "pkgconfig = amatha.pc" echo echo "all: static shared" echo @@ -509,20 +567,44 @@ echo " \${MKDIR} static" echo " \${MKDIR} shared" echo echo "\${solib}: build ${files2}" -echo " \${CC} -shared -fPIC -Wl,-soname,\${solib} -o \${solib} ${files2}" +echo " \${CXX} \${CXXFLAGS} -shared ${exestrip} -fPIC -Wl,-soname,\${solib}.${version} -o \${solib} ${files2}" echo echo "\${alib}: build ${files}" echo " \${AR} rcs static/\${alib} ${files}" echo " \${RANLIB} static/\${alib}" echo -echo ".PHONY: install" -echo "install: \${solib}" -echo " \${MKDIR} \${DESTDIR}\${PREFIX}/lib" -echo " \${INSTALL} \${solib} \${DESTDIR}\${PREFIX}/lib/\${solib}" +echo ".PHONY: install" +echo "install: \${alib} \${solib}" +echo " \${MKDIR} \${INSTDIR}" +echo " \${MKDIR} \${INSTDIRPC}" +echo " \${MKDIR} \${INSTDIRI}" +echo " \${INSTALL} static/\${alib} \${INSTDIR}/\${alib}" +echo " \${INSTALL} \${solib} \${INSTDIR}/\${solib}" +echo " \${INSTALL} \${pkgconfig} \${INSTDIRPC}/\${pkgconfig}" +echo " \${INSTALL} aengine.h \${INSTDIRI}/aengine.h" +echo " \${INSTALL} charbuf.h \${INSTDIRI}/charbuf.h" +echo " \${INSTALL} cplex.h \${INSTDIRI}/cplex.h" +echo " \${INSTALL} integer.h \${INSTDIRI}/integer.h" +echo " \${INSTALL} nnumb.h \${INSTDIRI}/nnumb.h" +echo " \${INSTALL} ntext.h \${INSTDIRI}/ntext.h" +echo " \${INSTALL} numb.h \${INSTDIRI}/numb.h" +echo " \${INSTALL} real.h \${INSTDIRI}/real.h" +echo " \${LDCONFIG} \${INSTDIR}" echo echo ".PHONY: uninstall" echo "uninstall:" -echo " \${DEL} \${DESTDIR}\${PREFIX}/lib/\${solib}" +echo " \${DEL} \${INSTDIR}/\${alib}" +echo " \${DEL} \${INSTDIR}/\${solib}" +echo " \${DEL} \${INSTDIRPC}/\${pkgconfig}" +echo " \${DEL} \${INSTDIRI}/aengine.h" +echo " \${DEL} \${INSTDIRI}/charbuf.h" +echo " \${DEL} \${INSTDIRI}/cplex.h" +echo " \${DEL} \${INSTDIRI}/integer.h" +echo " \${DEL} \${INSTDIRI}/nnumb.h" +echo " \${DEL} \${INSTDIRI}/ntext.h" +echo " \${DEL} \${INSTDIRI}/numb.h" +echo " \${DEL} \${INSTDIRI}/real.h" +echo " \${LDCONFIG}" echo echo "clean:" echo " \${DEL} static/\${alib} \${solib} ${files} ${files2}" @@ -532,17 +614,23 @@ echo ############################### C Library ############################### { -echo "CC = ${crosscompile}${ccompiler}" -echo "CFLAGS = -std=c9x ${libop}${options} ${cflags}-I. -I.. -Wall" -echo "AR = ${crosscompile}ar" -echo "RANLIB = ${crosscompile}ranlib" -echo "MKDIR = mkdir -p" -echo "DEL = rm -f" -echo "INSTALL = install -m 0644" -echo "PREFIX = ${prefix}" -echo -echo "alib = lib${amathc}.a" -echo "solib = lib${amathc}.so" +echo "CC = ${crosscompile}${ccompiler}" +echo "CFLAGS = -std=c9x ${libop}${options} ${cflags}-I. -I.. -Wall" +echo "AR = ${crosscompile}ar" +echo "RANLIB = ${crosscompile}ranlib" +echo "MKDIR = mkdir -p" +echo "DEL = rm -f" +echo "INSTALL = install -m 0644" +echo "LDCONFIG = ldconfig" +echo "PREFIX = ${prefix}" +echo "INSTDIR = \${DESTDIR}\${PREFIX}/lib/amath" +echo "INSTDIRI = \${DESTDIR}\${PREFIX}/include/amath" +echo "INSTDIRPC = \${DESTDIR}\${PREFIX}/${pkgconfigdir}" +echo "INSTDIRM = \${DESTDIR}\${PREFIX}/share/man/man3" +echo "alib = lib${amathc}.a" +echo "solib = lib${amathc}.so" +echo "pkgconfig = amathc.pc" +echo "manpage = amathc.3" echo echo "all: static shared" echo @@ -572,7 +660,7 @@ echo " \${MKDIR} static" echo " \${MKDIR} shared" echo echo "\${solib}: build ${libcs}" -echo " \${CC} -shared -fPIC -Wl,-soname,\${solib} -o \${solib} ${libcs} -lc" +echo " \${CC} \${CFLAGS} -shared ${exestrip} -fPIC -Wl,-soname,\${solib}.${version} -o \${solib} ${libcs} -lc" echo echo "\${alib}: build ${libc}" echo " \${AR} rcs static/\${alib} ${libc}" @@ -580,19 +668,26 @@ echo " \${RANLIB} static/\${alib}" echo echo ".PHONY: install" echo "install: \${alib} \${solib}" -echo " \${MKDIR} \${DESTDIR}\${PREFIX}/lib" -echo " \${MKDIR} \${DESTDIR}\${PREFIX}/include" -echo " \${INSTALL} static/\${alib} \${DESTDIR}\${PREFIX}/lib/\${alib}" -echo " \${INSTALL} \${solib} \${DESTDIR}\${PREFIX}/lib/\${solib}" -echo " \${INSTALL} ../amath.h \${DESTDIR}\${PREFIX}/include" -echo " \${INSTALL} ../amathc.h \${DESTDIR}\${PREFIX}/include" +echo " \${MKDIR} \${INSTDIR}" +echo " \${MKDIR} \${INSTDIRPC}" +echo " \${MKDIR} \${INSTDIRI}" +echo " \${INSTALL} static/\${alib} \${INSTDIR}/\${alib}" +echo " \${INSTALL} \${solib} \${INSTDIR}/\${solib}" +echo " \${INSTALL} \${pkgconfig} \${INSTDIRPC}/\${pkgconfig}" +echo " \${INSTALL} \${manpage} \${INSTDIRM}/\${manpage}" +echo " \${INSTALL} ../amath.h \${INSTDIRI}" +echo " \${INSTALL} ../amathc.h \${INSTDIRI}" +echo " \${LDCONFIG} \${INSTDIR}" echo echo ".PHONY: uninstall" echo "uninstall:" -echo " \${DEL} \${DESTDIR}\${PREFIX}/lib/\${alib}" -echo " \${DEL} \${DESTDIR}\${PREFIX}/lib/\${solib}" -echo " \${DEL} \${DESTDIR}\${PREFIX}/include/amath.h" -echo " \${DEL} \${DESTDIR}\${PREFIX}/include/amathc.h" +echo " \${DEL} \${INSTDIR}/\${alib}" +echo " \${DEL} \${INSTDIR}/\${solib}" +echo " \${DEL} \${INSTDIRPC}/\${pkgconfig}" +echo " \${DEL} \${INSTDIRM}/\${manpage}" +echo " \${DEL} \${INSTDIRI}/amath.h" +echo " \${DEL} \${INSTDIRI}/amathc.h" +echo " \${LDCONFIG}" echo echo "clean:" echo " \${DEL} static/\${alib} \${solib} ${libc} ${libcs}" @@ -603,17 +698,23 @@ echo ############################# Real Numbers ############################## { -echo "CC = ${crosscompile}${ccompiler}" -echo "CFLAGS = -std=c9x ${libop}${options} ${cflags}-I. -I.. -Wall" -echo "AR = ${crosscompile}ar" -echo "RANLIB = ${crosscompile}ranlib" -echo "MKDIR = mkdir -p" -echo "DEL = rm -f" -echo "INSTALL = install -m 0644" -echo "PREFIX = ${prefix}" -echo -echo "alib = lib${amath}.a" -echo "solib = lib${amath}.so" +echo "CC = ${crosscompile}${ccompiler}" +echo "CFLAGS = -std=c9x ${libop}${options} ${cflags}-I. -I.. -Wall" +echo "AR = ${crosscompile}ar" +echo "RANLIB = ${crosscompile}ranlib" +echo "MKDIR = mkdir -p" +echo "DEL = rm -f" +echo "INSTALL = install -m 0644" +echo "LDCONFIG = ldconfig" +echo "PREFIX = ${prefix}" +echo "INSTDIR = \${DESTDIR}\${PREFIX}/lib/amath" +echo "INSTDIRI = \${DESTDIR}\${PREFIX}/include/amath" +echo "INSTDIRPC = \${DESTDIR}\${PREFIX}/${pkgconfigdir}" +echo "INSTDIRM = \${DESTDIR}\${PREFIX}/share/man/man3" +echo "alib = lib${amath}.a" +echo "solib = lib${amath}.so" +echo "pkgconfig = amathr.pc" +echo "manpage = amathr.3" echo echo "all: static shared" echo @@ -643,7 +744,7 @@ echo " \${MKDIR} static" echo " \${MKDIR} shared" echo echo "\${solib}: build ${libamaths}" -echo " \${CC} -shared -fPIC -Wl,-soname,\${solib} -o \${solib} ${libamaths}" +echo " \${CC} \${CFLAGS} -shared ${exestrip} -fPIC -Wl,-soname,\${solib}.${version} -o \${solib} ${libamaths}" echo echo "\${alib}: build ${libamath}" echo " \${AR} rcs static/\${alib} ${libamath}" @@ -651,14 +752,24 @@ echo " \${RANLIB} static/\${alib}" echo echo ".PHONY: install" echo "install: \${alib} \${solib}" -echo " \${MKDIR} \${DESTDIR}\${PREFIX}/lib" -echo " \${INSTALL} static/\${alib} \${DESTDIR}\${PREFIX}/lib/\${alib}" -echo " \${INSTALL} \${solib} \${DESTDIR}\${PREFIX}/lib/\${solib}" +echo " \${MKDIR} \${INSTDIR}" +echo " \${MKDIR} \${INSTDIRPC}" +echo " \${MKDIR} \${INSTDIRI}" +echo " \${INSTALL} static/\${alib} \${INSTDIR}/\${alib}" +echo " \${INSTALL} \${solib} \${INSTDIR}/\${solib}" +echo " \${INSTALL} \${pkgconfig} \${INSTDIRPC}/\${pkgconfig}" +echo " \${INSTALL} \${manpage} \${INSTDIRM}/\${manpage}" +echo " \${INSTALL} ../math.h \${INSTDIRI}/amathr.h" +echo " \${LDCONFIG} \${INSTDIR}" echo echo ".PHONY: uninstall" echo "uninstall:" -echo " \${DEL} \${DESTDIR}\${PREFIX}/lib/\${alib}" -echo " \${DEL} \${DESTDIR}\${PREFIX}/lib/\${solib}" +echo " \${DEL} \${INSTDIR}/\${alib}" +echo " \${DEL} \${INSTDIR}/\${solib}" +echo " \${DEL} \${INSTDIRPC}/\${pkgconfig}" +echo " \${DEL} \${INSTDIRM}/\${manpage}" +echo " \${DEL} \${INSTDIRI}/amathr.h" +echo " \${LDCONFIG}" echo echo "clean:" echo " \${DEL} static/\${alib} \${solib} ${libamath} ${libamaths}" @@ -668,17 +779,23 @@ echo ############################ Complex Numbers ############################ { -echo "CC = ${crosscompile}${ccompiler}" -echo "CFLAGS = -std=c9x ${libop}${options} ${cxxflags}-I. -I.. -Wall" -echo "AR = ${crosscompile}ar" -echo "RANLIB = ${crosscompile}ranlib" -echo "MKDIR = mkdir -p" -echo "DEL = rm -f" -echo "INSTALL = install -m 0644" -echo "PREFIX = ${prefix}" -echo -echo "alib = lib${amathcplex}.a" -echo "solib = lib${amathcplex}.so" +echo "CC = ${crosscompile}${ccompiler}" +echo "CFLAGS = -std=c9x ${libop}${options} ${cxxflags}-I. -I.. -Wall" +echo "AR = ${crosscompile}ar" +echo "RANLIB = ${crosscompile}ranlib" +echo "MKDIR = mkdir -p" +echo "DEL = rm -f" +echo "INSTALL = install -m 0644" +echo "LDCONFIG = ldconfig" +echo "PREFIX = ${prefix}" +echo "INSTDIR = \${DESTDIR}\${PREFIX}/lib/amath" +echo "INSTDIRI = \${DESTDIR}\${PREFIX}/include/amath" +echo "INSTDIRPC = \${DESTDIR}\${PREFIX}/${pkgconfigdir}" +echo "INSTDIRM = \${DESTDIR}\${PREFIX}/share/man/man3" +echo "alib = lib${amathcplex}.a" +echo "solib = lib${amathcplex}.so" +echo "pkgconfig = amathi.pc" +echo "manpage = amathi.3" echo echo "all: static shared" echo @@ -708,7 +825,7 @@ echo " \${MKDIR} static" echo " \${MKDIR} shared" echo echo "\${solib}: build ${libcomplexs}" -echo " \${CC} -shared -fPIC -Wl,-soname,\${solib} -o \${solib} ${libcomplexs}" +echo " \${CC} \${CFLAGS} -shared ${exestrip} -fPIC -Wl,-soname,\${solib}.${version} -o \${solib} ${libcomplexs}" echo echo "\${alib}: build ${libcomplex}" echo " \${AR} rcs static/\${alib} ${libcomplex}" @@ -716,16 +833,25 @@ echo " \${RANLIB} static/\${alib}" echo echo ".PHONY: install" echo "install: \${alib} \${solib}" -echo " \${MKDIR} \${DESTDIR}\${PREFIX}/lib" -echo " \${INSTALL} static/\${alib} \${DESTDIR}\${PREFIX}/lib/\${alib}" -echo " \${INSTALL} \${solib} \${DESTDIR}\${PREFIX}/lib/\${solib}" -echo " \${INSTALL} ../complex.h \${DESTDIR}\${PREFIX}/include" +echo " \${MKDIR} \${INSTDIR}" +echo " \${MKDIR} \${INSTDIRPC}" +echo " \${MKDIR} \${INSTDIRI}" +echo " \${INSTALL} static/\${alib} \${INSTDIR}/\${alib}" +echo " \${INSTALL} \${solib} \${INSTDIR}/\${solib}" +echo " \${INSTALL} \${pkgconfig} \${INSTDIRPC}/\${pkgconfig}" +echo " \${INSTALL} \${manpage} \${INSTDIRM}/\${manpage}" +echo " \${INSTALL} ../complex.h \${INSTDIRI}/amathi.h" +echo " \${LDCONFIG} \${INSTDIR}" echo echo ".PHONY: uninstall" echo "uninstall:" -echo " \${DEL} \${DESTDIR}\${PREFIX}/lib/\${alib}" -echo " \${DEL} \${DESTDIR}\${PREFIX}/lib/\${solib}" -echo " \${DEL} \${DESTDIR}\${PREFIX}/include/complex.h" +echo " \${DEL} \${INSTDIR}/\${alib}" +echo " \${DEL} \${INSTDIR}/\${solib}" +echo " \${DEL} \${INSTDIRPC}/\${pkgconfig}" +echo " \${DEL} \${INSTDIRM}/\${manpage}" +echo " \${DEL} \${INSTDIRPC}/amathi.pc" +echo " \${DEL} \${INSTDIRI}/amathi.h" +echo " \${LDCONFIG}" echo echo "clean:" echo " \${DEL} static/\${alib} \${solib} ${libcomplex} ${libcomplexs}" @@ -748,8 +874,11 @@ echo "LPATHS = -Lsrc/lib/static -Lsrc/clib/static -Lsrc/real/static -Lsrc/cple echo "FLXCAT = build/flexcat/flexcat" echo "MKDIR = mkdir -p" echo "DEL = rm -f" -echo "INSTALL = install -m 0755" +echo "INSTALLP = install -m 0755" +echo "INSTALLM = install -m 0644" echo "PREFIX = ${prefix}" +echo "INSTDIRP = \${DESTDIR}\${PREFIX}/bin" +echo "INSTDIRM = \${DESTDIR}\${PREFIX}/share/man/man1" echo echo "all: shared-app" echo "app: ${appmain} ${appfunction} ${appstatement} ${appsystem}" @@ -785,25 +914,15 @@ echo echo "${amathcplex}:" echo " cd src/cplex && \${MAKE}" echo -echo "catalogsa:" # Application catalogs +echo "localize:" +echo " cd build/flexcat && \${MAKE}" echo " \${FLXCAT} text/keyword.cd src/localize/kword.h=text/keyword.sd" echo " \${FLXCAT} text/help.cd src/localize/help.h=text/help.sd" echo " \${FLXCAT} text/ident.cd src/localize/ident.h=text/ident.sd" echo " \${FLXCAT} text/text.cd src/localize/text.h=text/text.sd" echo -echo "catalogsu:" # Unix catalogs -echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-help.ct >utext/dk-help.dict" -echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-ident.ct >utext/dk-ident.dict" -echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-text.ct >utext/dk-text.dict" -echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-keyword.ct >utext/dk-keyword.dict" -echo -echo "catalogsw:" # Windows catalogs -echo " iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-help.ct >utext/dk-help.dict" -echo " iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-ident.ct >utext/dk-ident.dict" -echo " iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-text.ct >utext/dk-text.dict" -echo " iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-keyword.ct >utext/dk-keyword.dict" -echo -echo "amigacatalogs:" +echo "catalogs:" +echo " cd build/flexcat && \${MAKE}" echo " \${MKDIR} dist/catalog/english" echo " \${FLXCAT} text/help.cd catalog/english/amath-help.ct CATALOG dist/catalog/english/amath-help.catalog" echo " \${FLXCAT} text/ident.cd catalog/english/amath-ident.ct CATALOG dist/catalog/english/amath-ident.catalog" @@ -829,16 +948,18 @@ echo " cd src/main/statement && \${MAKE} static" echo " \${CC} \${CFLAGS} ${exestrip} ${program}.o -o amath \${LPATHS} \${LFLAGS}" echo echo ".PHONY: test" -echo "test: static-app" +echo "test: amath" +echo " LD_LIBRARY_PATH=src/clib/:src/lib:src/cplex:scr/real" echo " ./amath test" echo echo ".PHONY: install" -echo "install: amath" +echo "install: shared-app" echo " cd src/lib && \${MAKE} install" echo " cd src/clib && \${MAKE} install" echo " cd src/real && \${MAKE} install" echo " cd src/cplex && \${MAKE} install" -echo " \${INSTALL} amath \${DESTDIR}\${PREFIX}/bin" +echo " \${INSTALLP} amath \${INSTDIRP}/amath" +echo " \${INSTALLM} amath.1 \${INSTDIRM}/amath.1" echo echo ".PHONY: uninstall" echo "uninstall:" @@ -846,8 +967,10 @@ echo " cd src/lib && \${MAKE} uninstall" echo " cd src/clib && \${MAKE} uninstall" echo " cd src/real && \${MAKE} uninstall" echo " cd src/cplex && \${MAKE} uninstall" -echo " \${DEL} \${DESTDIR}\${PREFIX}/bin/amath" +echo " \${DEL} \${INSTDIRP}/amath" +echo " \${DEL} \${INSTDIRM}/amath.1" echo +echo ".PHONY: clean" echo "clean:" echo " cd src/lib && \${MAKE} clean" echo " cd src/clib && \${MAKE} clean" @@ -857,8 +980,37 @@ echo " cd src/main && \${MAKE} clean" echo " cd src/system && \${MAKE} clean" echo " cd src/main/function && \${MAKE} clean" echo " cd src/main/statement && \${MAKE} clean" +echo " cd build/flexcat && \${MAKE} clean" echo " \${DEL} ${program}.o amath" echo } > Makefile ######################################################################### + +################################ Flexcat ################################ +{ +echo 'all: flexcat' +echo '' +echo "CFLAGS += -I. -Wall" +echo '' + +l="" +for f in ${FLXSRCS} +do + b=`basename $f .c` + echo "${b}.o: ${f}" + echo " \${CC} \${CFLAGS} -c ${f}" + echo + l="${l} ${b}.o" +done + +echo +echo "flexcat: ${l}" +echo " \${CC} \${CFLAGS} -o flexcat ${l} -lm" +echo +echo "clean:" +echo " rm -f ${l} flexcat" +echo +} > build/flexcat/Makefile +######################################################################### + echo "Makefile generated" diff --git a/src/amath.h b/src/amath.h index 4bf2dfdc..d86ff0ea 100644 --- a/src/amath.h +++ b/src/amath.h @@ -97,11 +97,12 @@ /******************************************************************************/ #ifdef AOS3 # include -# define IPTR LONG* -typedef u_int8_t uint8_t; -typedef u_int16_t uint16_t; -typedef u_int32_t uint32_t; -typedef u_int64_t uint64_t; +# define IPTR LONG* +# define uintptr_t uint32_t +typedef u_int8_t uint8_t; +typedef u_int16_t uint16_t; +typedef u_int32_t uint32_t; +typedef u_int64_t uint64_t; #endif /******************************************************************************/ #if defined(AROS) || defined(MORPHOS) || defined(AOS4) @@ -287,7 +288,7 @@ typedef int bool; #endif /******************************************************************************/ #define TXTARCH TXTCPU TXTFPU -#define RELDATESTAMP "(28-02-2017)" +#define RELDATESTAMP "(12-03-2017)" #define TXTDOSVERSION "\0$VER: amath 1.70" SPACE RELDATESTAMP SPACE TXTARCH #define TXTTITLE "amath version 1.7.0" #define TXTCOPYRIGHT "(c) 2017 Carsten Sonne Larsen" diff --git a/src/amath.sln b/src/amath.sln new file mode 100644 index 00000000..5d2db161 --- /dev/null +++ b/src/amath.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26228.4 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amath", "amath.vcxproj", "{834DBB3E-042B-41E5-9400-EEC16CF003C7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Debug|x64.ActiveCfg = Debug|x64 + {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Debug|x64.Build.0 = Debug|x64 + {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Debug|x86.ActiveCfg = Debug|Win32 + {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Debug|x86.Build.0 = Debug|Win32 + {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Release|x64.ActiveCfg = Release|x64 + {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Release|x64.Build.0 = Release|x64 + {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Release|x86.ActiveCfg = Release|Win32 + {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/amath.vcxproj b/src/amath.vcxproj new file mode 100644 index 00000000..9b729b60 --- /dev/null +++ b/src/amath.vcxproj @@ -0,0 +1,146 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {834DBB3E-042B-41E5-9400-EEC16CF003C7} + Win32Proj + amath + 10.0.14393.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + + + + + + + + \ No newline at end of file diff --git a/src/amath.vcxproj.filters b/src/amath.vcxproj.filters new file mode 100644 index 00000000..6a1782f7 --- /dev/null +++ b/src/amath.vcxproj.filters @@ -0,0 +1,17 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + \ No newline at end of file diff --git a/src/clib/Makefile b/src/clib/Makefile index c3ddfcff..36a2d0ff 100644 --- a/src/clib/Makefile +++ b/src/clib/Makefile @@ -1,14 +1,20 @@ -CC = gcc -CFLAGS = -std=c9x -O3 -DWITHTEST -I. -I.. -Wall -AR = ar -RANLIB = ranlib -MKDIR = mkdir -p -DEL = rm -f -INSTALL = install -m 0644 -PREFIX = /usr - -alib = libamathc.a -solib = libamathc.so +CC = gcc +CFLAGS = -std=c9x -O3 -DWITHTEST -I. -I.. -Wall +AR = ar +RANLIB = ranlib +MKDIR = mkdir -p +DEL = rm -f +INSTALL = install -m 0644 +LDCONFIG = ldconfig +PREFIX = /usr +INSTDIR = ${DESTDIR}${PREFIX}/lib/amath +INSTDIRI = ${DESTDIR}${PREFIX}/include/amath +INSTDIRPC = ${DESTDIR}${PREFIX}/lib/pkgconfig +INSTDIRM = ${DESTDIR}${PREFIX}/share/man/man3 +alib = libamathc.a +solib = libamathc.so +pkgconfig = amathc.pc +manpage = amathc.3 all: static shared @@ -64,7 +70,7 @@ build: ${MKDIR} shared ${solib}: build shared/alloccpy.o shared/mem.o shared/memcpy.o shared/memset.o shared/strcmp.o shared/strlen.o shared/untag.o - ${CC} -shared -fPIC -Wl,-soname,${solib} -o ${solib} shared/alloccpy.o shared/mem.o shared/memcpy.o shared/memset.o shared/strcmp.o shared/strlen.o shared/untag.o -lc + ${CC} ${CFLAGS} -shared -s -fPIC -Wl,-soname,${solib}.1.7.0 -o ${solib} shared/alloccpy.o shared/mem.o shared/memcpy.o shared/memset.o shared/strcmp.o shared/strlen.o shared/untag.o -lc ${alib}: build static/alloccpy.o static/mem.o static/memcpy.o static/memset.o static/strcmp.o static/strlen.o static/untag.o ${AR} rcs static/${alib} static/alloccpy.o static/mem.o static/memcpy.o static/memset.o static/strcmp.o static/strlen.o static/untag.o @@ -72,19 +78,26 @@ ${alib}: build static/alloccpy.o static/mem.o static/memcpy.o static/memset.o s .PHONY: install install: ${alib} ${solib} - ${MKDIR} ${DESTDIR}${PREFIX}/lib - ${MKDIR} ${DESTDIR}${PREFIX}/include - ${INSTALL} static/${alib} ${DESTDIR}${PREFIX}/lib/${alib} - ${INSTALL} ${solib} ${DESTDIR}${PREFIX}/lib/${solib} - ${INSTALL} ../amath.h ${DESTDIR}${PREFIX}/include - ${INSTALL} ../amathc.h ${DESTDIR}${PREFIX}/include + ${MKDIR} ${INSTDIR} + ${MKDIR} ${INSTDIRPC} + ${MKDIR} ${INSTDIRI} + ${INSTALL} static/${alib} ${INSTDIR}/${alib} + ${INSTALL} ${solib} ${INSTDIR}/${solib} + ${INSTALL} ${pkgconfig} ${INSTDIRPC}/${pkgconfig} + ${INSTALL} ${manpage} ${INSTDIRM}/${manpage} + ${INSTALL} ../amath.h ${INSTDIRI} + ${INSTALL} ../amathc.h ${INSTDIRI} + ${LDCONFIG} ${INSTDIR} .PHONY: uninstall uninstall: - ${DEL} ${DESTDIR}${PREFIX}/lib/${alib} - ${DEL} ${DESTDIR}${PREFIX}/lib/${solib} - ${DEL} ${DESTDIR}${PREFIX}/include/amath.h - ${DEL} ${DESTDIR}${PREFIX}/include/amathc.h + ${DEL} ${INSTDIR}/${alib} + ${DEL} ${INSTDIR}/${solib} + ${DEL} ${INSTDIRPC}/${pkgconfig} + ${DEL} ${INSTDIRM}/${manpage} + ${DEL} ${INSTDIRI}/amath.h + ${DEL} ${INSTDIRI}/amathc.h + ${LDCONFIG} clean: ${DEL} static/${alib} ${solib} static/alloccpy.o static/mem.o static/memcpy.o static/memset.o static/strcmp.o static/strlen.o static/untag.o shared/alloccpy.o shared/mem.o shared/memcpy.o shared/memset.o shared/strcmp.o shared/strlen.o shared/untag.o diff --git a/src/clib/alloccpy.c b/src/clib/alloccpy.c index ff082232..6384aa59 100644 --- a/src/clib/alloccpy.c +++ b/src/clib/alloccpy.c @@ -29,7 +29,7 @@ #include "amathc.h" -#ifdef AMIGA +#ifdef AMIGA #include #endif diff --git a/src/clib/amathc.3 b/src/clib/amathc.3 new file mode 100644 index 00000000..08bcfe1d --- /dev/null +++ b/src/clib/amathc.3 @@ -0,0 +1,519 @@ +.TH "amath/amathc.h" 3 "Wed Mar 1 2017" "Version 1.7.0" "amath" \" -*- nroff -*- +.ad l +.nh +.SH NAME +amathc.h \- C functions for manipulating strings and memory + +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br +\fC#include 'amath\&.h'\fP +.br + +.SS "Classes" + +.in +1c +.ti -1c +.RI "struct \fBtexttag\fP" +.br +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "void * \fBAllocMemSafe\fP (size_t)" +.br +.RI "\fIAllocate memory and add it to the global memory list\&. \fP" +.ti -1c +.RI "void \fBFreeMemSafe\fP (void *)" +.br +.RI "\fIDeallocate memory from the global memory list\&. \fP" +.ti -1c +.RI "void \fBFreeAllSafe\fP ()" +.br +.RI "\fIDeallocate all memory in the global memory list\&. \fP" +.ti -1c +.RI "void \fBMemUsage\fP (long *, long *, long *)" +.br +.RI "\fIGet memory usage in the global memory list\&. \fP" +.ti -1c +.RI "int \fBStrLen\fP (const char *string)" +.br +.RI "\fIGet the length of a null terminated string\&. \fP" +.ti -1c +.RI "\fBbool\fP \fBStrIsEqual\fP (const char *s1, const char *s2)" +.br +.RI "\fICompare two null terminated strings to each other\&. \fP" +.ti -1c +.RI "void \fBMemSet\fP (void *destination, int c0, unsigned int length)" +.br +.RI "\fIFill block of memory with a constant value\&. \fP" +.ti -1c +.RI "void \fBMemCopy\fP (void *destination, const void *source, unsigned int length)" +.br +.RI "\fICopy a block of memory, handling overlap\&. \fP" +.ti -1c +.RI "unsigned int \fBAllocAndCopy\fP (char **destination, const char *source)" +.br +.RI "\fIAllocate memory and copy a string into the array\&. \fP" +.ti -1c +.RI "void \fBUntag\fP (char *destination, const char *source, \fBtexttag\fP tags[], unsigned int tagcount)" +.br +.in -1c +.SH "Detailed Description" +.PP +C functions for manipulating strings and memory\&. + + +.PP +Definition in file \fBamathc\&.h\fP\&. +.SH "Function Documentation" +.br +.PP +.SS "unsigned int AllocAndCopy (char ** destination, const char * source)" +.br +.PP +Allocate memory and copy a string into the array\&. +.PP +Definition at line 40 of file alloccpy\&.c\&. +.PP +.nf +41 { +42 char *i, *s, *d; +43 unsigned int n, size; +44 +45 if (source == nullptr) +46 { +47 *destination = nullptr; +48 return 0; +49 } +50 +51 i = (char*)source; +52 s = (char*)source; +53 while (*i) +54 i++; +55 +56 n = (unsigned int)(i - s + 1); +57 size = n; +58 *destination = AllocMemSafe(size); +59 d = *destination; +60 +61 #ifdef AMIGA // Take advantage of exec +62 CopyMem(s, d, n); +63 #else +64 while (n--) +65 *d++ = *s++; +66 #endif +67 +68 return size; +69 } +.fi +.SS "void* AllocMemSafe (size_t)" + +.PP +Allocate memory and add it to the global memory list\&. +.PP +Definition at line 86 of file mem\&.c\&. +.PP +.nf +87 { +88 struct MemoryBlock* newblock; +89 size_t allocsize; +90 +91 if (list == NULL) +92 { +93 list = (struct MemoryList*)ALLOC_MEM(sizeof(struct MemoryList)); +94 if (!list) +95 { +96 alloc_error("list", sizeof(struct MemoryList)); +97 return 0; +98 } +99 +100 list->first = NULL; +101 list->peak = 0; +102 list->size = 0; +103 list->count = 0; +104 } +105 +106 #ifdef P64BIT +107 // Align to bytes of 8 +108 allocsize = (size + 7) & ~0x07; +109 #else +110 // Align to bytes of 4 +111 allocsize = (size + 3) & ~0x03; +112 #endif +113 +114 newblock = (struct MemoryBlock*)ALLOC_MEM(sizeof(struct MemoryBlock)); +115 if (!newblock) +116 { +117 alloc_error("block", sizeof(struct MemoryBlock)); +118 return 0; +119 } +120 +121 newblock->address = (struct MemoryBlock*)ALLOC_MEM(allocsize); +122 if (!newblock->address) +123 { +124 FREE_MEM(newblock); +125 alloc_error("memory", allocsize); +126 return 0; +127 } +128 +129 newblock->size = allocsize; +130 newblock->next = list->first; +131 list->first = newblock; +132 list->size += allocsize; +133 list->count++; +134 +135 if (list->size > list->peak) +136 { +137 list->peak = list->size; +138 } +139 +140 // Memory allocated +141 return newblock->address; +142 } +.fi +.SS "void FreeAllSafe ()" + +.PP +Deallocate all memory in the global memory list\&. +.PP +Definition at line 199 of file mem\&.c\&. +.PP +.nf +200 { +201 struct MemoryBlock *current, *next; +202 +203 if (list == NULL) +204 { +205 return; +206 } +207 +208 current = list->first; +209 while (current != NULL) +210 { +211 next = current->next; +212 FREE_MEM(current->address); +213 FREE_MEM(current); +214 current = next; +215 } +216 +217 FREE_MEM(list); +218 list = NULL; +219 } +.fi +.SS "void FreeMemSafe (void *)" + +.PP +Deallocate memory from the global memory list\&. +.PP +Definition at line 147 of file mem\&.c\&. +.PP +.nf +148 { +149 struct MemoryBlock *current, *previous; +150 +151 if (list == NULL || block == NULL) +152 { +153 dealloc_error("list", 0); +154 return; +155 } +156 +157 if (block == NULL) +158 { +159 dealloc_error("memory", 0); +160 return; +161 } +162 +163 previous = NULL; +164 current = list->first; +165 while (current != NULL && current->address != block) +166 { +167 previous = current; +168 current = current->next; +169 } +170 +171 if (current == NULL) +172 { +173 dealloc_error("address not found", block); +174 return; +175 } +176 +177 if (previous == NULL) +178 { +179 list->first = current->next; +180 } +181 else +182 { +183 previous->next = current->next; +184 } +185 +186 list->size -= current->size; +187 list->count--; +188 +189 FREE_MEM(current->address); +190 current->address = NULL; +191 current->next = NULL; +192 current->size = 0; +193 FREE_MEM(current); +194 } +.fi +.SS "void MemCopy (void * destination, const void * source, unsigned int length)" + +.PP +Copy a block of memory, handling overlap\&. +.PP +Definition at line 77 of file memcpy\&.c\&. +.PP +.nf +78 { +79 char* dst = (char*) destination; +80 const char* src = (const char*) source; +81 unsigned int t; +82 +83 if (length == 0 || dst == src) // nothing to do +84 return; +85 +86 if ((mem_ptr)dst < (mem_ptr)src) +87 { +88 // Copy forward +89 #ifdef AMIGA // Take advantage of exec +90 CopyMem((void*)source, destination, length); +91 #else +92 t = (mem_ptr)src; // only need low bits +93 if ((t | (mem_ptr)dst) & wmask) +94 { +95 // Try to align operands\&. This cannot be done unless the low bits match\&. +96 if ((t ^ (mem_ptr)dst) & wmask || length < wsize) +97 t = length; +98 else +99 t = wsize - (t & wmask); +100 length -= t; +101 +102 TLOOP1(*dst++ = *src++); +103 } +104 +105 // Copy whole words, then mop up any trailing bytes\&. +106 t = length / wsize; +107 TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); +108 +109 t = length & wmask; +110 TLOOP(*dst++ = *src++); +111 #endif +112 } +113 else +114 { +115 // Copy backwards\&. Otherwise essentially the same\&. +116 // Alignment works as before, except that it takes +117 // (t&wmask) bytes to align, not wsize-(t&wmask)\&. +118 src += length; +119 dst += length; +120 t = (mem_ptr)src; +121 if ((t | (mem_ptr)dst) & wmask) +122 { +123 if ((t ^ (mem_ptr)dst) & wmask || length <= wsize) +124 t = length; +125 else +126 t &= wmask; +127 length -= t; +128 +129 TLOOP1(*--dst = *--src); +130 } +131 +132 t = length / wsize; +133 TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); +134 +135 t = length & wmask; +136 TLOOP(*--dst = *--src); +137 } +138 } +.fi +.SS "void MemSet (void * destination, int c0, unsigned int length)" + +.PP +Fill block of memory with a constant value\&. +.PP +Definition at line 60 of file memset\&.c\&. +.PP +.nf +61 { +62 unsigned char* dst = (unsigned char*) dst0; +63 unsigned int t; +64 unsigned int c; +65 +66 /* +67 * If not enough words, just fill bytes\&. A length >= 2 words +68 * guarantees that at least one of them is `complete' after +69 * any necessary alignment\&. For instance: +70 * +71 * |-----------|-----------|-----------| +72 * |00|01|02|03|04|05|06|07|08|09|0A|00| +73 * ^---------------------^ +74 * dst dst+length-1 +75 * +76 * but we use a minimum of 3 here since the overhead of the code +77 * to do word writes is substantial\&. +78 */ +79 if (length < 3 * wsize) +80 { +81 while (length != 0) +82 { +83 *dst++ = c0; +84 --length; +85 } +86 } +87 +88 if ((c = (unsigned char)c0) != 0) +89 { /* Fill the word\&. */ +90 c = (c << 8) | c; /* u_int is 16 bits\&. */ +91 #if UINT_MAX > 0xffff +92 c = (c << 16) | c; /* u_int is 32 bits\&. */ +93 #endif +94 #if UINT_MAX > 0xffffffff +95 c = (c << 32) | c; /* u_int is 64 bits\&. */ +96 #endif +97 } +98 +99 /* Align destination by filling in bytes\&. */ +100 if ((t = (mem_ptr)dst & wmask) != 0) +101 { +102 t = wsize - t; +103 length -= t; +104 do +105 { +106 *dst++ = c0; +107 } +108 while (--t != 0); +109 } +110 +111 /* Fill words\&. Length was >= 2*words so we know t >= 1 here\&. */ +112 t = length / wsize; +113 do +114 { +115 *(unsigned int*)dst = c; +116 dst += wsize; +117 } +118 while (--t != 0); +119 +120 /* Mop up trailing bytes, if any\&. */ +121 t = length & wmask; +122 if (t != 0) +123 do +124 { +125 *dst++ = c0; +126 } +127 while (--t != 0); +128 } +.fi +.SS "void MemUsage (long *, long *, long *)" + +.PP +Get memory usage in the global memory list\&. +.PP +Definition at line 224 of file mem\&.c\&. +.PP +.nf +225 { +226 *blocks = list->count; +227 *size = (long)list->size; +228 *peak = (long)list->peak;; +229 } +.fi +.SS "\fBbool\fP StrIsEqual (const char * s1, const char * s2)" + +.PP +Compare two null terminated strings to each other\&. +.PP +Definition at line 50 of file strcmp\&.c\&. +.PP +.nf +51 { +52 int r; +53 +54 while (*s1 == *s2++) +55 if (*s1++ == '\0') +56 return true; +57 +58 r = (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1)); +59 +60 return r == 0; +61 } +.fi +.SS "int StrLen (const char * string)" + +.PP +Get the length of a null terminated string\&. +.PP +Definition at line 34 of file strlen\&.c\&. +.PP +.nf +35 { +36 char* i = (char*)string; +37 char* s = i; +38 while (*i) +39 i++; +40 return (int)(i - s); +41 } +.fi +.SS "void Untag (char * destination, const char * source, \fBtexttag\fP tags[], unsigned int tagcount)" + +.PP +Definition at line 32 of file untag\&.c\&. +.PP +.nf +33 { +34 const char *pos, *tmp, *tag; +35 char* dest; +36 int unsigned i, j, found; +37 +38 pos = source; +39 dest = destination; +40 +41 while (*pos != '\0') +42 { +43 if (*pos != '#') +44 { +45 (*dest++ = *pos++); +46 } +47 else +48 { +49 // Try to replace tag +50 found = 0; +51 for (i = 0; i < tagcount; i++) +52 { +53 tag = tags[i]\&.tag; +54 tmp = pos; +55 j = 0; +56 while (*tmp != '\0' && *tag != '\0' && *tmp == *tag) +57 { +58 tmp++; +59 tag++; +60 j++; +61 } +62 +63 if (j > 1 && *(--tag) == '#') +64 { +65 // Tag found\&. Now replace\&. +66 tag = tags[i]\&.text; +67 while ((*dest++ = *tag++)); +68 dest--; +69 pos = tmp; +70 found = 1; +71 break; +72 } +73 } +74 +75 if (!found) +76 { +77 (*dest++ = *pos++); +78 } +79 } +80 } +81 *dest = '\0'; +82 } +.fi +.SH "See also" +.PP +amath(1), amathr(3), amathi(3) diff --git a/src/clib/amathc.pc b/src/clib/amathc.pc new file mode 100644 index 00000000..21efe36b --- /dev/null +++ b/src/clib/amathc.pc @@ -0,0 +1,10 @@ +prefix=/usr +exec_prefix=${prefix} +includedir=${prefix}/include/amath +libdir=${exec_prefix}/lib + +Name: amath C library +Description: C functions for manipulating strings and memory +Version: 1.7.0 +Cflags: -I${includedir} +Libs: -L${libdir} -lamathc diff --git a/src/clib/amathc.vcxproj b/src/clib/amathc.vcxproj new file mode 100644 index 00000000..73c99ca7 --- /dev/null +++ b/src/clib/amathc.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {01757088-637B-45D8-B042-14B76DF11115} + Win32Proj + + + + StaticLibrary + true + v141 + + + StaticLibrary + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + $(ProjectDir)..;%(AdditionalIncludeDirectories) + + + MachineX86 + true + Windows + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/clib/amathc.vcxproj.filters b/src/clib/amathc.vcxproj.filters new file mode 100644 index 00000000..7a9995db --- /dev/null +++ b/src/clib/amathc.vcxproj.filters @@ -0,0 +1,40 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/src/clib/mem.c b/src/clib/mem.c index 50164ba7..1b0a8bb5 100644 --- a/src/clib/mem.c +++ b/src/clib/mem.c @@ -26,7 +26,7 @@ * http://amath.innolan.net * */ - + #include "amathc.h" #ifdef AMIGA diff --git a/src/clib/memcpy.c b/src/clib/memcpy.c index 18b424f5..1a63d573 100644 --- a/src/clib/memcpy.c +++ b/src/clib/memcpy.c @@ -47,28 +47,26 @@ #pragma GCC diagnostic ignored "-Wcast-align" #endif -#ifdef AMIGA +#ifdef AMIGA #include #endif /** - * + * @brief * sizeof(word) MUST BE A POWER OF TWO * SO THAT wmask BELOW IS ALL ONES */ typedef uint32_t word; - -#ifdef _WIN32 -typedef unsigned long long mem_ptr; -#else -typedef unsigned long mem_ptr; -#endif +typedef uintptr_t mem_ptr; /** - * - * Macros: loop-t-times; and loop-t-times, t>0 + * @brief loop-t-times */ #define TLOOP(s) if (t) TLOOP1(s) + +/** + * @brief loop-t-times, t>0 + */ #define TLOOP1(s) do { s; } while (--t) /** diff --git a/src/clib/memset.c b/src/clib/memset.c index 0168de32..5ab2360a 100644 --- a/src/clib/memset.c +++ b/src/clib/memset.c @@ -48,11 +48,7 @@ #pragma GCC diagnostic ignored "-Wcast-align" #endif -#ifdef _WIN32 -typedef unsigned long long mem_ptr; -#else -typedef unsigned long mem_ptr; -#endif +typedef uintptr_t mem_ptr; /** * @brief Fill block of memory with a constant value. diff --git a/src/clib/strcmp.c b/src/clib/strcmp.c index 528e8036..976c5fc4 100644 --- a/src/clib/strcmp.c +++ b/src/clib/strcmp.c @@ -32,7 +32,7 @@ */ /** - * @file strcmp.h + * @file strcmp.c * @brief Compare two null terminated strings to each other. * * Code originate from FreeBSD base, revision 229286. diff --git a/src/cplex/Makefile b/src/cplex/Makefile index 41a92ab7..33673de0 100644 --- a/src/cplex/Makefile +++ b/src/cplex/Makefile @@ -1,14 +1,20 @@ -CC = gcc -CFLAGS = -std=c9x -O3 -DWITHTEST -I. -I.. -Wall -AR = ar -RANLIB = ranlib -MKDIR = mkdir -p -DEL = rm -f -INSTALL = install -m 0644 -PREFIX = /usr - -alib = libamathcplex.a -solib = libamathcplex.so +CC = gcc +CFLAGS = -std=c9x -O3 -DWITHTEST -I. -I.. -Wall +AR = ar +RANLIB = ranlib +MKDIR = mkdir -p +DEL = rm -f +INSTALL = install -m 0644 +LDCONFIG = ldconfig +PREFIX = /usr +INSTDIR = ${DESTDIR}${PREFIX}/lib/amath +INSTDIRI = ${DESTDIR}${PREFIX}/include/amath +INSTDIRPC = ${DESTDIR}${PREFIX}/lib/pkgconfig +INSTDIRM = ${DESTDIR}${PREFIX}/share/man/man3 +alib = libamathcplex.a +solib = libamathcplex.so +pkgconfig = amathi.pc +manpage = amathi.3 all: static shared @@ -220,7 +226,7 @@ build: ${MKDIR} shared ${solib}: build shared/cacos.o shared/cacosh.o shared/cacot.o shared/cacoth.o shared/cacsc.o shared/cacsch.o shared/casec.o shared/casech.o shared/casin.o shared/casinh.o shared/catan.o shared/catanh.o shared/ccbrt.o shared/ccos.o shared/ccosh.o shared/ccot.o shared/ccoth.o shared/ccsc.o shared/ccsch.o shared/cexp.o shared/clog.o shared/clog10.o shared/clogb.o shared/cpow.o shared/csec.o shared/csech.o shared/csgn.o shared/csin.o shared/csinh.o shared/csqrt.o shared/ctan.o shared/ctanh.o shared/prim.o - ${CC} -shared -fPIC -Wl,-soname,${solib} -o ${solib} shared/cacos.o shared/cacosh.o shared/cacot.o shared/cacoth.o shared/cacsc.o shared/cacsch.o shared/casec.o shared/casech.o shared/casin.o shared/casinh.o shared/catan.o shared/catanh.o shared/ccbrt.o shared/ccos.o shared/ccosh.o shared/ccot.o shared/ccoth.o shared/ccsc.o shared/ccsch.o shared/cexp.o shared/clog.o shared/clog10.o shared/clogb.o shared/cpow.o shared/csec.o shared/csech.o shared/csgn.o shared/csin.o shared/csinh.o shared/csqrt.o shared/ctan.o shared/ctanh.o shared/prim.o + ${CC} ${CFLAGS} -shared -s -fPIC -Wl,-soname,${solib}.1.7.0 -o ${solib} shared/cacos.o shared/cacosh.o shared/cacot.o shared/cacoth.o shared/cacsc.o shared/cacsch.o shared/casec.o shared/casech.o shared/casin.o shared/casinh.o shared/catan.o shared/catanh.o shared/ccbrt.o shared/ccos.o shared/ccosh.o shared/ccot.o shared/ccoth.o shared/ccsc.o shared/ccsch.o shared/cexp.o shared/clog.o shared/clog10.o shared/clogb.o shared/cpow.o shared/csec.o shared/csech.o shared/csgn.o shared/csin.o shared/csinh.o shared/csqrt.o shared/ctan.o shared/ctanh.o shared/prim.o ${alib}: build static/cacos.o static/cacosh.o static/cacot.o static/cacoth.o static/cacsc.o static/cacsch.o static/casec.o static/casech.o static/casin.o static/casinh.o static/catan.o static/catanh.o static/ccbrt.o static/ccos.o static/ccosh.o static/ccot.o static/ccoth.o static/ccsc.o static/ccsch.o static/cexp.o static/clog.o static/clog10.o static/clogb.o static/cpow.o static/csec.o static/csech.o static/csgn.o static/csin.o static/csinh.o static/csqrt.o static/ctan.o static/ctanh.o static/prim.o ${AR} rcs static/${alib} static/cacos.o static/cacosh.o static/cacot.o static/cacoth.o static/cacsc.o static/cacsch.o static/casec.o static/casech.o static/casin.o static/casinh.o static/catan.o static/catanh.o static/ccbrt.o static/ccos.o static/ccosh.o static/ccot.o static/ccoth.o static/ccsc.o static/ccsch.o static/cexp.o static/clog.o static/clog10.o static/clogb.o static/cpow.o static/csec.o static/csech.o static/csgn.o static/csin.o static/csinh.o static/csqrt.o static/ctan.o static/ctanh.o static/prim.o @@ -228,16 +234,25 @@ ${alib}: build static/cacos.o static/cacosh.o static/cacot.o static/cacoth.o st .PHONY: install install: ${alib} ${solib} - ${MKDIR} ${DESTDIR}${PREFIX}/lib - ${INSTALL} static/${alib} ${DESTDIR}${PREFIX}/lib/${alib} - ${INSTALL} ${solib} ${DESTDIR}${PREFIX}/lib/${solib} - ${INSTALL} ../complex.h ${DESTDIR}${PREFIX}/include + ${MKDIR} ${INSTDIR} + ${MKDIR} ${INSTDIRPC} + ${MKDIR} ${INSTDIRI} + ${INSTALL} static/${alib} ${INSTDIR}/${alib} + ${INSTALL} ${solib} ${INSTDIR}/${solib} + ${INSTALL} ${pkgconfig} ${INSTDIRPC}/${pkgconfig} + ${INSTALL} ${manpage} ${INSTDIRM}/${manpage} + ${INSTALL} ../complex.h ${INSTDIRI}/amathi.h + ${LDCONFIG} ${INSTDIR} .PHONY: uninstall uninstall: - ${DEL} ${DESTDIR}${PREFIX}/lib/${alib} - ${DEL} ${DESTDIR}${PREFIX}/lib/${solib} - ${DEL} ${DESTDIR}${PREFIX}/include/complex.h + ${DEL} ${INSTDIR}/${alib} + ${DEL} ${INSTDIR}/${solib} + ${DEL} ${INSTDIRPC}/${pkgconfig} + ${DEL} ${INSTDIRM}/${manpage} + ${DEL} ${INSTDIRPC}/amathi.pc + ${DEL} ${INSTDIRI}/amathi.h + ${LDCONFIG} clean: ${DEL} static/${alib} ${solib} static/cacos.o static/cacosh.o static/cacot.o static/cacoth.o static/cacsc.o static/cacsch.o static/casec.o static/casech.o static/casin.o static/casinh.o static/catan.o static/catanh.o static/ccbrt.o static/ccos.o static/ccosh.o static/ccot.o static/ccoth.o static/ccsc.o static/ccsch.o static/cexp.o static/clog.o static/clog10.o static/clogb.o static/cpow.o static/csec.o static/csech.o static/csgn.o static/csin.o static/csinh.o static/csqrt.o static/ctan.o static/ctanh.o static/prim.o shared/cacos.o shared/cacosh.o shared/cacot.o shared/cacoth.o shared/cacsc.o shared/cacsch.o shared/casec.o shared/casech.o shared/casin.o shared/casinh.o shared/catan.o shared/catanh.o shared/ccbrt.o shared/ccos.o shared/ccosh.o shared/ccot.o shared/ccoth.o shared/ccsc.o shared/ccsch.o shared/cexp.o shared/clog.o shared/clog10.o shared/clogb.o shared/cpow.o shared/csec.o shared/csech.o shared/csgn.o shared/csin.o shared/csinh.o shared/csqrt.o shared/ctan.o shared/ctanh.o shared/prim.o diff --git a/src/cplex/amathi.3 b/src/cplex/amathi.3 new file mode 100644 index 00000000..b05e2858 --- /dev/null +++ b/src/cplex/amathi.3 @@ -0,0 +1,1857 @@ +.TH "amath/amathi.h" 3 "Wed Mar 1 2017" "Version 1.7.0" "amath" \" -*- nroff -*- +.ad l +.nh +.SH NAME +amathi.h \- Complex numbers math library + +.SH SYNOPSIS +.br +.PP +.SS "Classes" + +.in +1c +.ti -1c +.RI "union \fBcomplex\fP" +.br +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "double \fBcsgn\fP (\fBcomplex\fP z)" +.br +.RI "\fIComplex signum\&. \fP" +.ti -1c +.RI "double \fBcabs\fP (\fBcomplex\fP z)" +.br +.RI "\fIAbsolute value of complex number\&. \fP" +.ti -1c +.RI "double \fBcreal\fP (\fBcomplex\fP z)" +.br +.RI "\fIReal part of complex number\&. \fP" +.ti -1c +.RI "double \fBcimag\fP (\fBcomplex\fP z)" +.br +.RI "\fIImaginary part of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcexp\fP (\fBcomplex\fP z)" +.br +.RI "\fIReturns e to the power of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBclog\fP (\fBcomplex\fP z)" +.br +.RI "\fINatural logarithm of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBconj\fP (\fBcomplex\fP z)" +.br +.ti -1c +.RI "\fBcomplex\fP \fBcsqrt\fP (\fBcomplex\fP z)" +.br +.RI "\fISquare root of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcpow\fP (\fBcomplex\fP x, \fBcomplex\fP z)" +.br +.RI "\fIComplex number raised to a power\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcpack\fP (double x, double y)" +.br +.RI "\fIPack two real numbers into a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcadd\fP (\fBcomplex\fP a, \fBcomplex\fP z)" +.br +.RI "\fIAddition of two complex numbers\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcsub\fP (\fBcomplex\fP a, \fBcomplex\fP z)" +.br +.RI "\fISubtraction of two complex numbers\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcmul\fP (\fBcomplex\fP a, \fBcomplex\fP z)" +.br +.RI "\fIMultiplication of two complex numbers\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcdiv\fP (\fBcomplex\fP a, \fBcomplex\fP z)" +.br +.RI "\fIDivision of two complex numbers\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcceil\fP (\fBcomplex\fP z)" +.br +.RI "\fICeiling value of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcfloor\fP (\fBcomplex\fP z)" +.br +.RI "\fIFloor value of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBctrunc\fP (\fBcomplex\fP z)" +.br +.RI "\fITruncated value of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcround\fP (\fBcomplex\fP z)" +.br +.RI "\fIDivision of two complex numbers\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcreci\fP (\fBcomplex\fP z)" +.br +.RI "\fIReciprocal value of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBccbrt\fP (\fBcomplex\fP z)" +.br +.RI "\fICube root of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBclogb\fP (\fBcomplex\fP z)" +.br +.RI "\fIBase 2 logarithmic value of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBclog10\fP (\fBcomplex\fP z)" +.br +.RI "\fIBase 10 logarithmic value of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBccos\fP (\fBcomplex\fP z)" +.br +.RI "\fICosine of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcsin\fP (\fBcomplex\fP z)" +.br +.RI "\fISine of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBctan\fP (\fBcomplex\fP z)" +.br +.RI "\fITangent of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcsec\fP (\fBcomplex\fP z)" +.br +.RI "\fISecant of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBccsc\fP (\fBcomplex\fP z)" +.br +.RI "\fICosecant of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBccot\fP (\fBcomplex\fP z)" +.br +.RI "\fICotangent of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcacos\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse cosine of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcasin\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse sine of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcatan\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse tangent of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcasec\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse secant expressed using complex logarithms: \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcacsc\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse cosecant of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcacot\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse cotangent of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBccosh\fP (\fBcomplex\fP z)" +.br +.RI "\fIHyperbolic cosine of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcsinh\fP (\fBcomplex\fP z)" +.br +.RI "\fIHyperbolic sine of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBctanh\fP (\fBcomplex\fP z)" +.br +.RI "\fIHyperbolic tangent of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcsech\fP (\fBcomplex\fP z)" +.br +.RI "\fIHyperbolic secant of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBccsch\fP (\fBcomplex\fP z)" +.br +.RI "\fIHyperbolic secant of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBccoth\fP (\fBcomplex\fP z)" +.br +.RI "\fIHyperbolic cotangent of a complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcacosh\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse hyperbolic cosine of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcasinh\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse hyperbolic sine of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcatanh\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse hyperbolic tangent of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcasech\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse hyperbolic secant of complex numbers\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcacsch\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse hyperbolic cosecant of complex number\&. \fP" +.ti -1c +.RI "\fBcomplex\fP \fBcacoth\fP (\fBcomplex\fP z)" +.br +.RI "\fIInverse hyperbolic cotangent of complex number\&. \fP" +.in -1c +.SH "Detailed Description" +.PP +Functions in math library for handling complex numbers\&. + + +.PP +Definition in file \fBcomplex\&.h\fP\&. +.SH "Function Documentation" +.PP +.SS "double cabs (\fBcomplex\fP z)" + +.PP +Absolute value of complex number\&. +.PP +Definition at line 59 of file prim\&.c\&. +.PP +References cimag(), creal(), and hypot()\&. +.PP +.nf +60 { +61 return hypot(creal(z), cimag(z)); +62 } +.fi +.SS "\fBcomplex\fP cacos (\fBcomplex\fP z)" + +.PP +Inverse cosine of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.0 +.RE +.PP +\fBDate:\fP +.RS 4 +14/09/15 +.RE +.PP +Inverse cosine expressed using complex logarithms: +.PP +.nf + +arccos z = -i * log(z + i * sqrt(1 - z * z)) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms +.PP +Definition at line 46 of file cacos\&.c\&. +.PP +References cadd(), clog(), cmul(), cpack(), csqrt(), and csub()\&. +.PP +.nf +47 { +48 complex a = cpack(1\&.0, 0\&.0); +49 complex i = cpack(0\&.0, 1\&.0); +50 complex j = cpack(0\&.0, -1\&.0); +51 complex p = csub(a, cmul(z, z)); +52 complex q = clog(cadd(z, cmul(i, csqrt(p)))); +53 complex w = cmul(j, q); +54 return w; +55 } +.fi +.SS "\fBcomplex\fP cacosh (\fBcomplex\fP z)" + +.PP +Inverse hyperbolic cosine of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +15/03/03 +.RE +.PP +Inverse hyperbolic cosine expressed using complex logarithms: +.PP +.nf + +acosh(z) = log(z + sqrt(z*z - 1)) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation +.PP +Definition at line 46 of file cacosh\&.c\&. +.PP +References cadd(), clog(), cmul(), cpack(), csqrt(), and csub()\&. +.PP +.nf +47 { +48 complex one = cpack(1\&.0, 0\&.0); +49 complex a = csub(cmul(z, z), one); +50 complex b = cadd(z, csqrt(a)); +51 complex w = clog(b); +52 return w; +53 } +.fi +.SS "\fBcomplex\fP cacot (\fBcomplex\fP z)" + +.PP +Inverse cotangent of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +14/10/01 +.RE +.PP +Inverse cotangent expressed using complex logarithms: +.PP +.nf + +arccot z = i/2 * (log(1 - i/z) - log(1 + i/z)) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms +.PP +Definition at line 46 of file cacot\&.c\&. +.PP +References cadd(), cdiv(), clog(), cmul(), cpack(), and csub()\&. +.PP +.nf +47 { +48 complex one = cpack(1\&.0, 0\&.0); +49 complex two = cpack(2\&.0, 0\&.0); +50 complex i = cpack(0\&.0, 1\&.0); +51 complex iz = cdiv(i, z); +52 complex p = clog(csub(one, iz)); +53 complex q = clog(cadd(one, iz)); +54 complex w = cmul(cdiv(i, two), csub(p, q)); +55 return w; +56 } +.fi +.SS "\fBcomplex\fP cacoth (\fBcomplex\fP z)" + +.PP +Inverse hyperbolic cotangent of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.0 +.RE +.PP +\fBDate:\fP +.RS 4 +14/09/15 +.RE +.PP +Inverse hyperbolic cotangent expressed using complex logarithms: +.PP +.nf + +acoth(z) = 1/2 * ((log(z + 1) - log(z - 1)) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation +.PP +Definition at line 46 of file cacoth\&.c\&. +.PP +References cadd(), clog(), cmul(), cpack(), and csub()\&. +.PP +.nf +47 { +48 complex half = cpack(0\&.5, 0\&.0); +49 complex one = cpack(1\&.0, 0\&.0); +50 complex a = clog(cadd(z, one)); +51 complex b = clog(csub(z, one)); +52 complex c = csub(a, b); +53 complex w = cmul(half, c); +54 return w; +55 } +.fi +.SS "\fBcomplex\fP cacsc (\fBcomplex\fP z)" + +.PP +Inverse cosecant of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +14/10/01 +.RE +.PP +Inverse cosecant expressed using complex logarithms: +.PP +.nf + +arccsc z = -i * log(sqr(1 - 1/(z*z)) + i/z) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms +.PP +Definition at line 46 of file cacsc\&.c\&. +.PP +References cadd(), cdiv(), clog(), cmul(), cpack(), csqrt(), and csub()\&. +.PP +.nf +47 { +48 complex one = cpack(1\&.0, 0\&.0); +49 complex i = cpack(0\&.0, 1\&.0); +50 complex j = cpack(0\&.0, -1\&.0); +51 complex iz = cdiv(i, z); +52 complex z2 = cmul(z, z); +53 complex p = cdiv(one, z2); +54 complex q = csqrt(csub(one, p)); +55 complex w = cmul(j, clog(cadd(q, iz))); +56 return w; +57 } +.fi +.SS "\fBcomplex\fP cacsch (\fBcomplex\fP z)" + +.PP +Inverse hyperbolic cosecant of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.0 +.RE +.PP +\fBDate:\fP +.RS 4 +14/09/15 +.RE +.PP +Inverse hyperbolic cosecant expressed using complex logarithms: +.PP +.nf + +acsch(z) = log(sqrt(1 + 1 / (z * z)) + 1/z) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation +.PP +Definition at line 46 of file cacsch\&.c\&. +.PP +References cadd(), clog(), cmul(), cpack(), creci(), and csqrt()\&. +.PP +.nf +47 { +48 complex one = cpack(1\&.0, 0\&.0); +49 complex a = creci(cmul(z, z)); +50 complex b = csqrt(cadd(one, a)); +51 complex c = cadd(b, creci(z)); +52 complex w = clog(c); +53 return w; +54 } +.fi +.SS "\fBcomplex\fP cadd (\fBcomplex\fP a, \fBcomplex\fP z)" + +.PP +Addition of two complex numbers\&. +.PP +Definition at line 131 of file prim\&.c\&. +.PP +References cimag(), cpack(), and creal()\&. +.PP +.nf +132 { +133 complex w; +134 w = cpack(creal(y) + creal(z), cimag(y) + cimag(z)); +135 return w; +136 } +.fi +.SS "\fBcomplex\fP casec (\fBcomplex\fP z)" + +.PP +Inverse secant expressed using complex logarithms: +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +14/10/01 +.RE +.PP +Inverse secant expressed using complex logarithms: +.PP +.nf + +arcsec z = -i * log(i * sqr(1 - 1/(z*z)) + 1/z) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms +.PP +Definition at line 46 of file casec\&.c\&. +.PP +References cadd(), cdiv(), clog(), cmul(), cpack(), creci(), csqrt(), and csub()\&. +.PP +.nf +47 { +48 complex one = cpack(1\&.0, 0\&.0); +49 complex i = cpack(0\&.0, 1\&.0); +50 complex j = cpack(0\&.0, -1\&.0); +51 complex rz = creci(z); +52 complex z2 = cmul(z, z); +53 complex p = cdiv(one, z2); +54 complex q = csqrt(csub(one, p)); +55 complex w = cmul(j, clog(cadd(cmul(i, q), rz))); +56 return w; +57 } +.fi +.SS "\fBcomplex\fP casech (\fBcomplex\fP z)" + +.PP +Inverse hyperbolic secant of complex numbers\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +15/03/03 +.RE +.PP +Inverse hyperbolic secant expressed using complex logarithms: +.PP +.nf + +asech(z) = log(sqrt(1 / (z * z) - 1) + 1/z) +.fi +.PP +.PP +.PP +.nf +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation +.PP +Definition at line 47 of file casech\&.c\&. +.PP +References cadd(), clog(), cmul(), cpack(), creci(), csqrt(), and csub()\&. +.PP +.nf +48 { +49 complex one = cpack(1\&.0, 0\&.0); +50 complex a = creci(cmul(z, z)); +51 complex b = csqrt(csub(a, one)); +52 complex c = cadd(b, creci(z)); +53 complex w = clog(c); +54 return w; +55 } +.fi +.SS "\fBcomplex\fP casin (\fBcomplex\fP z)" + +.PP +Inverse sine of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +14/10/01 +.RE +.PP +Inverse sine expressed using complex logarithms: +.PP +.nf + +arcsin z = -i * log(iz + sqrt(1 - z*z)) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms +.PP +Definition at line 46 of file casin\&.c\&. +.PP +References cadd(), clog(), cmul(), cpack(), csqrt(), and csub()\&. +.PP +.nf +47 { +48 complex one = cpack(1\&.0, 0\&.0); +49 complex i = cpack(0\&.0, 1\&.0); +50 complex j = cpack(0\&.0, -1\&.0); +51 complex iz = cmul(i, z); +52 complex z2 = cmul(z, z); +53 complex p = csqrt(csub(one, z2)); +54 complex q = clog(cadd(iz, p)); +55 complex w = cmul(j, q); +56 return w; +57 } +.fi +.SS "\fBcomplex\fP casinh (\fBcomplex\fP z)" + +.PP +Inverse hyperbolic sine of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.0 +.RE +.PP +\fBDate:\fP +.RS 4 +14/09/15 +.RE +.PP +Inverse hyperbolic sine expressed using complex logarithms: +.PP +.nf + +asinh(z) = log(z + sqrt(z*z + 1)) +.fi +.PP +.PP +.PP +.nf +With branch cuts: -i INF to -i and i to i INF +.fi +.PP +.PP +.PP +.nf +Domain: -INF to INF +Range: -INF to INF +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation +.PP +Definition at line 51 of file casinh\&.c\&. +.PP +References cadd(), clog(), cmul(), cpack(), and csqrt()\&. +.PP +.nf +52 { +53 complex one = cpack(1\&.0, 0\&.0); +54 complex a = cadd(cmul(z, z), one); +55 complex b = cadd(z, csqrt(a)); +56 complex w = clog(b); +57 return w; +58 } +.fi +.SS "\fBcomplex\fP catan (\fBcomplex\fP z)" + +.PP +Inverse tangent of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +14/10/01 +.RE +.PP +Inverse tangent expressed using complex logarithms: +.PP +.nf + +atan(z) = i/2 * (log(1 - i * z) - log(1 + i * z)) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms +.PP +Definition at line 46 of file catan\&.c\&. +.PP +References cadd(), cdiv(), clog(), cmul(), cpack(), and csub()\&. +.PP +.nf +47 { +48 complex one = cpack(1\&.0, 0\&.0); +49 complex two = cpack(2\&.0, 0\&.0); +50 complex i = cpack(0\&.0, 1\&.0); +51 complex iz = cmul(i, z); +52 complex p = clog(csub(one, iz)); +53 complex q = clog(cadd(one, iz)); +54 complex w = cmul(cdiv(i, two), csub(p, q)); +55 return w; +56 } +.fi +.SS "\fBcomplex\fP catanh (\fBcomplex\fP z)" + +.PP +Inverse hyperbolic tangent of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.0 +.RE +.PP +\fBDate:\fP +.RS 4 +14/09/15 +.RE +.PP +Inverse hyperbolic tangent expressed using complex logarithms: +.PP +.nf + +atanh(z) = 1/2 * ((log(1 + z) - log(1 - z)) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation +.PP +Definition at line 46 of file catanh\&.c\&. +.PP +References cadd(), clog(), cmul(), cpack(), and csub()\&. +.PP +.nf +47 { +48 complex half = cpack(0\&.5, 0\&.0); +49 complex one = cpack(1\&.0, 0\&.0); +50 complex a = clog(cadd(one, z)); +51 complex b = clog(csub(one, z)); +52 complex c = csub(a, b); +53 complex w = cmul(half, c); +54 return w; +55 } +.fi +.SS "\fBcomplex\fP ccbrt (\fBcomplex\fP z)" + +.PP +Cube root of complex number\&. +.PP +.nf + +cbrt z = exp(1/3 * log(z)) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Cube_root +.PP +Definition at line 43 of file ccbrt\&.c\&. +.PP +References cexp(), clog(), cmul(), and cpack()\&. +.PP +.nf +44 { +45 complex onethird = cpack(1\&.0 / 3\&.0, 0\&.0); +46 complex a = cmul(onethird, clog(z)); +47 complex w = cexp(a); +48 return w; +49 } +.fi +.SS "\fBcomplex\fP cceil (\fBcomplex\fP z)" + +.PP +Ceiling value of complex number\&. +.PP +Definition at line 109 of file prim\&.c\&. +.PP +References cimag(), cpack(), and creal()\&. +.PP +.nf +110 { +111 complex w; +112 w = cpack(ceil(creal(z)), ceil(cimag(z))); +113 return w; +114 } +.fi +.SS "\fBcomplex\fP ccos (\fBcomplex\fP z)" + +.PP +Cosine of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +2007/08/20 +.RE +.PP +.PP +.nf + +a+bi +real = cos(a) * cosh(b) +imag = -sin(a) * sinh(b) +.fi +.PP + +.PP +Definition at line 49 of file ccos\&.c\&. +.PP +References cchsh(), cimag(), cos(), cpack(), creal(), and sin()\&. +.PP +.nf +50 { +51 complex w; +52 double a, b; +53 double ch, sh; +54 +55 a = creal(z); +56 b = cimag(z); +57 cchsh(b, &ch, &sh); +58 w = cpack((cos(a) * ch), (-sin(a) * sh)); +59 +60 return w; +61 } +.fi +.SS "\fBcomplex\fP ccosh (\fBcomplex\fP z)" + +.PP +Hyperbolic cosine of a complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +2007/08/20 +.RE +.PP +.PP +.nf + +a+bi +real = cosh(a) * cos(b) +imag = sinh(a) * sin(b) +.fi +.PP + +.PP +Definition at line 52 of file ccosh\&.c\&. +.PP +References cchsh(), cimag(), cos(), cpack(), creal(), and sin()\&. +.PP +.nf +53 { +54 complex w; +55 double a, b; +56 double ch, sh; +57 +58 a = creal(z); +59 b = cimag(z); +60 cchsh(a, &ch, &sh); +61 w = cpack(cos(b) * ch, sin(b) * sh); +62 +63 return w; +64 } +.fi +.SS "\fBcomplex\fP ccot (\fBcomplex\fP z)" + +.PP +Cotangent of a complex number\&. Calculated as in Open Office: +.PP +.nf + +a+bi + sin(2\&.0 * a) +real = ------------------------------ + cosh(2\&.0 * b) - cos(2\&.0 * a) +.fi +.PP +.PP +.PP +.nf + -sinh(2\&.0 * b) +imag = ------------------------------ + cosh(2\&.0 * b) - cos(2\&.0 * a) +.fi +.PP + https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMCOT_function +.PP +Definition at line 50 of file ccot\&.c\&. +.PP +References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh()\&. +.PP +.nf +51 { +52 complex w; +53 double a, b; +54 double d; +55 +56 a = creal(z); +57 b = cimag(z); +58 d = cosh(2\&.0 * b) - cos(2\&.0 * a); +59 +60 if (d == 0\&.0) +61 { +62 w = cpack(D_INFP, D_INFP); +63 } +64 else +65 { +66 w = cpack((sin(2\&.0 * a) / d), (-sinh(2\&.0 * b) / d)); +67 } +68 +69 return w; +70 } +.fi +.SS "\fBcomplex\fP ccoth (\fBcomplex\fP z)" + +.PP +Hyperbolic cotangent of a complex number\&. +.PP +.nf + +acoth(z) = 0\&.5 * (log(1 + 1/z) - log(1 - 1/z)) +.fi +.PP + or +.PP +.nf + +a+bi + sinh(2\&.0 * a) +real = ------------------------------ + cosh(2\&.0 * a) - cos(2\&.0 * b) +.PP +.nf + -sin(2.0 * b) +.fi +.PP + +imag = ------------------------------ + cosh(2\&.0 * a) - cos(2\&.0 * b) +.fi +.PP + +.PP +Definition at line 52 of file ccoth\&.c\&. +.PP +References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh()\&. +.PP +.nf +53 { +54 complex w; +55 double a, b; +56 double d; +57 +58 a = creal(z); +59 b = cimag(z); +60 d = cosh(2\&.0 * a) - cos(2\&.0 * b); +61 w = cpack(sinh(2\&.0 * a) / d, -sin(2\&.0 * b) / d); +62 +63 return w; +64 } +.fi +.SS "\fBcomplex\fP ccsc (\fBcomplex\fP z)" + +.PP +Cosecant of a complex number\&. Calculated as in Open Office: +.PP +.nf + +a+bi + 2\&.0 * sin(a) * cosh(b) +real = ------------------------------ + cosh(2\&.0 * b) - cos(2\&.0 * a) +.fi +.PP +.PP +.PP +.nf + -2\&.0 * cos(a) * sinh(b) +imag = ------------------------------ + cosh(2\&.0 * b) - cos(2\&.0 * a) +.fi +.PP + https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMCSC_function +.PP +Definition at line 50 of file ccsc\&.c\&. +.PP +References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh()\&. +.PP +.nf +51 { +52 complex w; +53 double a, b; +54 double d; +55 +56 a = creal(z); +57 b = cimag(z); +58 d = cosh(2\&.0 * b) - cos(2\&.0 * a); +59 +60 if (d == 0\&.0) +61 { +62 w = cpack(D_INFP, D_INFP); +63 } +64 else +65 { +66 w = cpack((2\&.0 * sin(a) * cosh(b) / d), (-2\&.0 * cos(a) * sinh(b) / d)); +67 } +68 +69 return w; +70 } +.fi +.SS "\fBcomplex\fP ccsch (\fBcomplex\fP z)" + +.PP +Hyperbolic secant of a complex number\&. Calculated as in Open Office: +.PP +.nf + +a+bi + 2\&.0 * sinh(a) * cos(b) +real = ------------------------------ + cosh(2\&.0 * a) - cos(2\&.0 * b) +.fi +.PP +.PP +.PP +.nf + -2\&.0 * cosh(2\&.0 * a) * sin(b) +imag = ------------------------------ + cosh(2\&.0 * a) - cos(2\&.0 * b) +.fi +.PP + https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMCSCH_function +.PP +Definition at line 50 of file ccsch\&.c\&. +.PP +References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh()\&. +.PP +.nf +51 { +52 complex w; +53 double a, b; +54 double d; +55 +56 a = creal(z); +57 b = cimag(z); +58 d = cosh(2\&.0 * a) - cos(2\&.0 * b); +59 w = cpack((2\&.0 * sinh(a) * cos(b) / d), (-2\&.0 * cosh(a) * sin(b) / d)); +60 +61 return w; +62 } +.fi +.SS "\fBcomplex\fP cdiv (\fBcomplex\fP a, \fBcomplex\fP z)" + +.PP +Division of two complex numbers\&. +.PP +Definition at line 173 of file prim\&.c\&. +.PP +References cimag(), cpack(), and creal()\&. +.PP +.nf +174 { +175 complex w; +176 double a, b, c, d; +177 double q, v, x; +178 +179 a = creal(y); +180 b = cimag(y); +181 c = creal(z); +182 d = cimag(z); +183 +184 q = c * c + d * d; +185 v = a * c + b * d; +186 x = b * c - a * d; +187 +188 w = cpack(v / q, x / q); +189 return w; +190 } +.fi +.SS "\fBcomplex\fP cexp (\fBcomplex\fP z)" + +.PP +Returns e to the power of a complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +2007/08/20 +.RE +.PP + +.PP +Definition at line 47 of file cexp\&.c\&. +.PP +References cimag(), cos(), cpack(), creal(), exp(), and sin()\&. +.PP +.nf +48 { +49 complex w; +50 double r, x, y; +51 x = creal(z); +52 y = cimag(z); +53 r = exp(x); +54 w = cpack(r * cos(y), r * sin(y)); +55 return w; +56 } +.fi +.SS "\fBcomplex\fP cfloor (\fBcomplex\fP z)" + +.PP +Floor value of complex number\&. +.PP +Definition at line 98 of file prim\&.c\&. +.PP +References cimag(), cpack(), and creal()\&. +.PP +.nf +99 { +100 complex w; +101 w = cpack(floor(creal(z)), floor(cimag(z))); +102 return w; +103 } +.fi +.SS "double cimag (\fBcomplex\fP z)" + +.PP +Imaginary part of complex number\&. +.PP +Definition at line 50 of file prim\&.c\&. +.PP +.nf +51 { +52 return (IMAG_PART(z)); +53 } +.fi +.SS "\fBcomplex\fP clog (\fBcomplex\fP z)" + +.PP +Natural logarithm of a complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +2007/08/20 +.RE +.PP + +.PP +Definition at line 47 of file clog\&.c\&. +.PP +References atan2(), cabs(), cimag(), cpack(), and creal()\&. +.PP +.nf +48 { +49 complex w; +50 double p, q; +51 p = log(cabs(z)); +52 q = atan2(cimag(z), creal(z)); +53 w = cpack(p, q); +54 return w; +55 } +.fi +.SS "\fBcomplex\fP clog10 (\fBcomplex\fP z)" + +.PP +Base 10 logarithmic value of complex number\&. +.PP +.nf + +log z = log(z) / log(10) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Complex_logarithm +.PP +Definition at line 42 of file clog10\&.c\&. +.PP +References cdiv(), clog(), and cpack()\&. +.PP +.nf +43 { +44 complex teen = cpack(10\&.0, 0\&.0); +45 complex w = cdiv(clog(z), clog(teen)); +46 return w; +47 } +.fi +.SS "\fBcomplex\fP clogb (\fBcomplex\fP z)" + +.PP +Base 2 logarithmic value of complex number\&. +.PP +.nf + +lb z = log(z) / log(2) +.fi +.PP + More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Complex_logarithm +.PP +Definition at line 42 of file clogb\&.c\&. +.PP +References cdiv(), clog(), and cpack()\&. +.PP +.nf +43 { +44 complex two = cpack(2\&.0, 0\&.0); +45 complex w = cdiv(clog(z), clog(two)); +46 return w; +47 } +.fi +.SS "\fBcomplex\fP cmul (\fBcomplex\fP a, \fBcomplex\fP z)" + +.PP +Multiplication of two complex numbers\&. +.PP +Definition at line 153 of file prim\&.c\&. +.PP +References cimag(), cpack(), and creal()\&. +.PP +.nf +154 { +155 complex w; +156 double a, b, c, d; +157 +158 // (a+bi)(c+di) +159 a = creal(y); +160 b = cimag(y); +161 c = creal(z); +162 d = cimag(z); +163 +164 // (ac -bd) + (ad + bc)i +165 w = cpack(a * c - b * d, a * d + b * c); +166 return w; +167 } +.fi +.SS "\fBcomplex\fP conj (\fBcomplex\fP z)" + +.PP +Definition at line 64 of file prim\&.c\&. +.PP +References cpack()\&. +.PP +.nf +65 { +66 IMAG_PART(z) = -IMAG_PART(z); +67 return cpack(REAL_PART(z), IMAG_PART(z)); +68 } +.fi +.SS "\fBcomplex\fP cpack (double x, double y)" + +.PP +Pack two real numbers into a complex number\&. +.PP +Definition at line 74 of file prim\&.c\&. +.PP +.nf +75 { +76 complex z; +77 +78 REAL_PART(z) = x; +79 IMAG_PART(z) = y; +80 return (z); +81 } +.fi +.SS "\fBcomplex\fP cpow (\fBcomplex\fP a, \fBcomplex\fP z)" + +.PP +Complex number raised to a power\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +2007/08/20 +.RE +.PP + +.PP +Definition at line 47 of file cpow\&.c\&. +.PP +References atan2(), cabs(), cimag(), cos(), cpack(), creal(), exp(), pow(), and sin()\&. +.PP +.nf +48 { +49 complex w; +50 double x, y, r, theta, absa, arga; +51 +52 x = creal(z); +53 y = cimag(z); +54 absa = cabs(a); +55 if (absa == 0\&.0) +56 { +57 return cpack(0\&.0, + 0\&.0); +58 } +59 arga = atan2(cimag(a), creal(a)); +60 +61 r = pow(absa, x); +62 theta = x * arga; +63 if (y != 0\&.0) +64 { +65 r = r * exp(-y * arga); +66 theta = theta + y * log(absa); +67 } +68 +69 w = cpack(r * cos(theta), r * sin(theta)); +70 return w; +71 } +.fi +.SS "double creal (\fBcomplex\fP z)" + +.PP +Real part of complex number\&. +.PP +Definition at line 41 of file prim\&.c\&. +.PP +.nf +42 { +43 return (REAL_PART(z)); +44 } +.fi +.SS "\fBcomplex\fP creci (\fBcomplex\fP z)" + +.PP +Reciprocal value of complex number\&. +.PP +Definition at line 196 of file prim\&.c\&. +.PP +References cimag(), conj(), cpack(), and creal()\&. +.PP +.nf +197 { +198 complex w; +199 double q, a, b; +200 +201 a = creal(z); +202 b = cimag(conj(z)); +203 q = a * a + b * b; +204 w = cpack(a / q, b / q); +205 +206 return w; +207 } +.fi +.SS "\fBcomplex\fP cround (\fBcomplex\fP z)" + +.PP +Division of two complex numbers\&. +.PP +Definition at line 120 of file prim\&.c\&. +.PP +References cimag(), cpack(), creal(), and round()\&. +.PP +.nf +121 { +122 complex w; +123 w = cpack(round(creal(z)), round(cimag(z))); +124 return w; +125 } +.fi +.SS "\fBcomplex\fP csec (\fBcomplex\fP z)" + +.PP +Secant of a complex number\&. Calculated as in Open Office: +.br + https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMSEC_function +.PP +.nf + +a+bi + 2\&.0 * cos(a) * cosh(b) +real = ------------------------------ + cosh(2\&.0 * b) + cos(2\&.0 * a) +.fi +.PP +.PP +.PP +.nf + 2\&.0 * sin(a) * sinh(b) +imag = ------------------------------ + cosh(2\&.0 * b) + cos(2\&.0 * a) +.fi +.PP + +.PP +Definition at line 50 of file csec\&.c\&. +.PP +References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh()\&. +.PP +.nf +51 { +52 complex w; +53 double a, b; +54 double d; +55 +56 a = creal(z); +57 b = cimag(z); +58 d = cosh(2\&.0 * b) + cos(2\&.0 * a); +59 +60 if (d == 0\&.0) +61 { +62 w = cpack(D_INFP, D_INFP); +63 } +64 else +65 { +66 w = cpack((2\&.0 * cos(a) * cosh(b) / d), (2\&.0 * sin(a) * sinh(b) / d)); +67 } +68 +69 return w; +70 } +.fi +.SS "\fBcomplex\fP csech (\fBcomplex\fP z)" + +.PP +Hyperbolic secant of a complex number\&. Calculated as in Open Office: +.br + https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMSECH_function +.PP +.nf + +a+bi + 2\&.0 * cosh(a) * cos(b) +real = ------------------------------ + cosh(2\&.0 * a) + cos(2\&.0 * b) +.fi +.PP +.PP +.PP +.nf + -2\&.0 * sinh(2\&.0 * a) * sin(b) +imag = ------------------------------ + cosh(2\&.0 * a) + cos(2\&.0 * b) +.fi +.PP + +.PP +Definition at line 50 of file csech\&.c\&. +.PP +References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh()\&. +.PP +.nf +51 { +52 complex w; +53 double a, b; +54 double d; +55 +56 a = creal(z); +57 b = cimag(z); +58 d = cosh(2\&.0 * a) + cos(2\&.0 * b); +59 w = cpack((2\&.0 * cosh(a) * cos(b) / d), (-2\&.0 * sinh(a) * sin(b) / d)); +60 +61 return w; +62 } +.fi +.SS "double csgn (\fBcomplex\fP z)" + +.PP +Complex signum\&. Mostly as specified in [IEEE Std 1003\&.1, 2013 Edition]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/complex.h.html +.PP +More info is available at Wikipedia: +.br + https://wikipedia.org/wiki/Sign_function#Complex_signum +.PP +Definition at line 39 of file csgn\&.c\&. +.PP +References cimag(), and creal()\&. +.PP +.nf +40 { +41 double a = creal(z); +42 +43 if (a > 0\&.0) +44 { +45 return 1\&.0; +46 } +47 else if (a < 0\&.0) +48 { +49 return -1\&.0; +50 } +51 else +52 { +53 double b = cimag(z); +54 return b > 0\&.0 ? 1\&.0 : b < 0\&.0 ? -1\&.0 : 0\&.0; +55 } +56 } +.fi +.SS "\fBcomplex\fP csin (\fBcomplex\fP z)" + +.PP +Sine of a complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +2007/08/20 +.RE +.PP +Calculated according to description at wikipedia: +.br + https://wikipedia.org/wiki/Sine#Sine_with_a_complex_argument +.PP +.nf + +a+bi +real = sin(a) * cosh(b) +imag = cos(a) * sinh(b) +.fi +.PP + +.PP +Definition at line 54 of file csin\&.c\&. +.PP +References cchsh(), cimag(), cos(), cpack(), creal(), and sin()\&. +.PP +.nf +55 { +56 complex w; +57 double a, b; +58 double ch, sh; +59 +60 a = creal(z); +61 b = cimag(z); +62 cchsh(b, &ch, &sh); +63 w = cpack((sin(a) * ch), (cos(a) * sh)); +64 +65 return w; +66 } +.fi +.SS "\fBcomplex\fP csinh (\fBcomplex\fP z)" + +.PP +Hyperbolic sine of a complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +2007/08/20 +.RE +.PP +Calculated as in Open Office: +.br + https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMSINH_function +.PP +.nf + +a+bi +real = sinh(a) * cos(b) +imag = cosh(a) * sin(b) +.fi +.PP + +.PP +Definition at line 54 of file csinh\&.c\&. +.PP +References cchsh(), cimag(), cos(), cpack(), creal(), and sin()\&. +.PP +.nf +55 { +56 complex w; +57 double a, b; +58 double ch, sh; +59 +60 a = creal(z); +61 b = cimag(z); +62 cchsh(a, &ch, &sh); +63 w = cpack(cos(b) * sh, sin(b) * ch); +64 +65 return w; +66 } +.fi +.SS "\fBcomplex\fP csqrt (\fBcomplex\fP z)" + +.PP +Square root of complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +2007/08/20 +.RE +.PP + +.PP +Definition at line 47 of file csqrt\&.c\&. +.PP +References cabs(), cimag(), cpack(), creal(), and sqrt()\&. +.PP +.nf +48 { +49 complex w; +50 double x, y, r, t, scale; +51 +52 x = creal(z); +53 y = cimag(z); +54 +55 if (y == 0\&.0) +56 { +57 if (x == 0\&.0) +58 { +59 w = cpack(0\&.0, y); +60 } +61 else +62 { +63 r = fabs(x); +64 r = sqrt(r); +65 if (x < 0\&.0) +66 { +67 w = cpack(0\&.0, r); +68 } +69 else +70 { +71 w = cpack(r, y); +72 } +73 } +74 return w; +75 } +76 if (x == 0\&.0) +77 { +78 r = fabs(y); +79 r = sqrt(0\&.5 * r); +80 if (y > 0) +81 w = cpack(r, r); +82 else +83 w = cpack(r, -r); +84 return w; +85 } +86 /* Rescale to avoid internal overflow or underflow\&. */ +87 if ((fabs(x) > 4\&.0) || (fabs(y) > 4\&.0)) +88 { +89 x *= 0\&.25; +90 y *= 0\&.25; +91 scale = 2\&.0; +92 } +93 else +94 { +95 #if 1 +96 x *= 1\&.8014398509481984e16; /* 2^54 */ +97 y *= 1\&.8014398509481984e16; +98 scale = 7\&.450580596923828125e-9; /* 2^-27 */ +99 #else +100 x *= 4\&.0; +101 y *= 4\&.0; +102 scale = 0\&.5; +103 #endif +104 } +105 w = cpack(x, y); +106 r = cabs(w); +107 if (x > 0) +108 { +109 t = sqrt(0\&.5 * r + 0\&.5 * x); +110 r = scale * fabs((0\&.5 * y) / t); +111 t *= scale; +112 } +113 else +114 { +115 r = sqrt(0\&.5 * r - 0\&.5 * x); +116 t = scale * fabs((0\&.5 * y) / r); +117 r *= scale; +118 } +119 if (y < 0) +120 w = cpack(t, -r); +121 else +122 w = cpack(t, r); +123 return w; +124 } +.fi +.SS "\fBcomplex\fP csub (\fBcomplex\fP a, \fBcomplex\fP z)" + +.PP +Subtraction of two complex numbers\&. +.PP +Definition at line 142 of file prim\&.c\&. +.PP +References cimag(), cpack(), and creal()\&. +.PP +.nf +143 { +144 complex w; +145 w = cpack(creal(y) - creal(z), cimag(y) - cimag(z)); +146 return w; +147 } +.fi +.SS "\fBcomplex\fP ctan (\fBcomplex\fP z)" + +.PP +Tangent of a complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +2007/08/20 +.RE +.PP +Calculated as in Open Office: +.br + https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMTAN_function +.PP +.nf + +a+bi + sin(2\&.0 * a) +real = ------------------------------ + cos(2\&.0 * a) + cosh(2\&.0 * b) +.PP +.nf + sinh(2.0 * b) +.fi +.PP + +imag = ------------------------------ + cos(2\&.0 * a) + cosh(2\&.0 * b) +.fi +.PP + +.PP +Definition at line 59 of file ctan\&.c\&. +.PP +References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh()\&. +.PP +.nf +60 { +61 complex w; +62 double a, b; +63 double d; +64 +65 a = creal(z); +66 b = cimag(z); +67 d = cos(2\&.0 * a) + cosh(2\&.0 * b); +68 +69 if (d == 0\&.0) +70 { +71 w = cpack(D_INFP, D_INFP); +72 } +73 else +74 { +75 w = cpack((sin(2\&.0 * a) / d), (sinh(2\&.0 * b) / d)); +76 } +77 +78 return w; +79 } +.fi +.SS "\fBcomplex\fP ctanh (\fBcomplex\fP z)" + +.PP +Hyperbolic tangent of a complex number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.1 +.RE +.PP +\fBDate:\fP +.RS 4 +2007/08/20 +.RE +.PP +.PP +.nf + +a+bi + sinh(2\&.0 * a) +real = ------------------------------ + cosh(2\&.0 * a) + cos(2\&.0 * b) +.PP +.nf + sin(2.0 * b) +.fi +.PP + +imag = ------------------------------ + cosh(2\&.0 * a) + cos(2\&.0 * b) +.fi +.PP + +.PP +Definition at line 57 of file ctanh\&.c\&. +.PP +References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh()\&. +.PP +.nf +58 { +59 complex w; +60 double a, b; +61 double d; +62 +63 a = creal(z); +64 b = cimag(z); +65 d = cosh(2\&.0 * a) + cos(2\&.0 * b); +66 w = cpack((sinh(2\&.0 * a) / d), (sin(2\&.0 * b) / d)); +67 +68 return w; +69 } +.fi +.SS "\fBcomplex\fP ctrunc (\fBcomplex\fP z)" + +.PP +Truncated value of complex number\&. +.PP +Definition at line 87 of file prim\&.c\&. +.PP +References cimag(), cpack(), creal(), and trunc()\&. +.PP +.nf +88 { +89 complex w; +90 w = cpack(trunc(creal(z)), trunc(cimag(z))); +91 return w; +92 } +.fi +.SH "See also" +.PP +amath(1), amathc(3), amathr(3) diff --git a/src/cplex/amathi.pc b/src/cplex/amathi.pc new file mode 100644 index 00000000..b55e8bee --- /dev/null +++ b/src/cplex/amathi.pc @@ -0,0 +1,10 @@ +prefix=/usr +exec_prefix=${prefix} +includedir=${prefix}/include/amath +libdir=${exec_prefix}/lib + +Name: amath complex library +Description: Functions for handling complex numbers +Version: 1.7.0 +Cflags: -I${includedir} +Libs: -L${libdir} -lamathi diff --git a/src/cplex/amathi.vcxproj b/src/cplex/amathi.vcxproj new file mode 100644 index 00000000..2973ec59 --- /dev/null +++ b/src/cplex/amathi.vcxproj @@ -0,0 +1,142 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {278A3E34-C1F0-4176-AA98-6D8CD4F16438} + Win32Proj + + + + StaticLibrary + true + v141 + + + StaticLibrary + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + $(ProjectDir).. + + + MachineX86 + true + Windows + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/cplex/amathi.vcxproj.filters b/src/cplex/amathi.vcxproj.filters new file mode 100644 index 00000000..9f640be0 --- /dev/null +++ b/src/cplex/amathi.vcxproj.filters @@ -0,0 +1,123 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/src/cplex/cacosh.c b/src/cplex/cacosh.c index 54535273..c12042c5 100644 --- a/src/cplex/cacosh.c +++ b/src/cplex/cacosh.c @@ -46,7 +46,7 @@ complex cacosh(complex z) { complex one = cpack(1.0, 0.0); - complex a = csub(cmul(z, z) , one); + complex a = csub(cmul(z, z), one); complex b = cadd(z, csqrt(a)); complex w = clog(b); return w; diff --git a/src/cplex/ccot.c b/src/cplex/ccot.c index 25ba172e..7824ba25 100644 --- a/src/cplex/ccot.c +++ b/src/cplex/ccot.c @@ -26,7 +26,7 @@ * http://amath.innolan.net * */ - + #include "prim.h" #include "math.h" #include "complex.h" @@ -57,9 +57,12 @@ complex ccot(complex z) b = cimag(z); d = cosh(2.0 * b) - cos(2.0 * a); - if (d == 0.0) { + if (d == 0.0) + { w = cpack(D_INFP, D_INFP); - } else { + } + else + { w = cpack((sin(2.0 * a) / d), (-sinh(2.0 * b) / d)); } diff --git a/src/cplex/ccsc.c b/src/cplex/ccsc.c index 463ca9b0..b06e76be 100644 --- a/src/cplex/ccsc.c +++ b/src/cplex/ccsc.c @@ -57,9 +57,12 @@ complex ccsc(complex z) b = cimag(z); d = cosh(2.0 * b) - cos(2.0 * a); - if (d == 0.0) { + if (d == 0.0) + { w = cpack(D_INFP, D_INFP); - } else { + } + else + { w = cpack((2.0 * sin(a) * cosh(b) / d), (-2.0 * cos(a) * sinh(b) / d)); } diff --git a/src/cplex/cpow.c b/src/cplex/cpow.c index 11a7e565..e52ce795 100644 --- a/src/cplex/cpow.c +++ b/src/cplex/cpow.c @@ -52,14 +52,16 @@ complex cpow(complex a, complex z) x = creal(z); y = cimag(z); absa = cabs(a); - if (absa == 0.0) { + if (absa == 0.0) + { return cpack(0.0, + 0.0); } arga = atan2(cimag(a), creal(a)); r = pow(absa, x); theta = x * arga; - if (y != 0.0) { + if (y != 0.0) + { r = r * exp(-y * arga); theta = theta + y * log(absa); } diff --git a/src/cplex/csec.c b/src/cplex/csec.c index d02bd734..de8d159d 100644 --- a/src/cplex/csec.c +++ b/src/cplex/csec.c @@ -57,9 +57,12 @@ complex csec(complex z) b = cimag(z); d = cosh(2.0 * b) + cos(2.0 * a); - if (d == 0.0) { + if (d == 0.0) + { w = cpack(D_INFP, D_INFP); - } else { + } + else + { w = cpack((2.0 * cos(a) * cosh(b) / d), (2.0 * sin(a) * sinh(b) / d)); } diff --git a/src/cplex/csgn.c b/src/cplex/csgn.c index ab472f74..54604c3e 100644 --- a/src/cplex/csgn.c +++ b/src/cplex/csgn.c @@ -40,11 +40,16 @@ double csgn(complex z) { double a = creal(z); - if (a > 0.0) { + if (a > 0.0) + { return 1.0; - } else if (a < 0.0) { + } + else if (a < 0.0) + { return -1.0; - } else { + } + else + { double b = cimag(z); return b > 0.0 ? 1.0 : b < 0.0 ? -1.0 : 0.0; } diff --git a/src/cplex/csinh.c b/src/cplex/csinh.c index bac63cf1..ba75a77e 100644 --- a/src/cplex/csinh.c +++ b/src/cplex/csinh.c @@ -33,7 +33,7 @@ * http://amath.innolan.net * */ - + #include "prim.h" #include "math.h" #include "complex.h" diff --git a/src/cplex/csqrt.c b/src/cplex/csqrt.c index 3580d84a..46354dc8 100644 --- a/src/cplex/csqrt.c +++ b/src/cplex/csqrt.c @@ -49,40 +49,51 @@ complex csqrt(complex z) complex w; double x, y, r, t, scale; - x = creal (z); - y = cimag (z); + x = creal(z); + y = cimag(z); - if (y == 0.0) { - if (x == 0.0) { + if (y == 0.0) + { + if (x == 0.0) + { w = cpack(0.0, y); - } else { + } + else + { r = fabs(x); r = sqrt(r); - if (x < 0.0) { + if (x < 0.0) + { w = cpack(0.0, r); - } else { + } + else + { w = cpack(r, y); } } return w; } - if (x == 0.0) { + if (x == 0.0) + { r = fabs(y); r = sqrt(0.5 * r); if (y > 0) - w = cpack(r, r); + w = cpack(r, r); else w = cpack(r, -r); return w; } /* Rescale to avoid internal overflow or underflow. */ - if ((fabs(x) > 4.0) || (fabs(y) > 4.0)) { + if ((fabs(x) > 4.0) || (fabs(y) > 4.0)) + { x *= 0.25; y *= 0.25; scale = 2.0; - } else { + } + else + { #if 1 - x *= 1.8014398509481984e16; /* 2^54 */ + x *= 1.8014398509481984e16; /* 2^54 */ y *= 1.8014398509481984e16; scale = 7.450580596923828125e-9; /* 2^-27 */ #else @@ -93,11 +104,14 @@ complex csqrt(complex z) } w = cpack(x, y); r = cabs(w); - if (x > 0) { + if (x > 0) + { t = sqrt(0.5 * r + 0.5 * x); - r = scale * fabs((0.5 * y) / t ); + r = scale * fabs((0.5 * y) / t); t *= scale; - } else { + } + else + { r = sqrt(0.5 * r - 0.5 * x); t = scale * fabs((0.5 * y) / r); r *= scale; diff --git a/src/cplex/ctan.c b/src/cplex/ctan.c index ff881ef4..8ae84d2a 100644 --- a/src/cplex/ctan.c +++ b/src/cplex/ctan.c @@ -66,9 +66,12 @@ complex ctan(complex z) b = cimag(z); d = cos(2.0 * a) + cosh(2.0 * b); - if (d == 0.0) { + if (d == 0.0) + { w = cpack(D_INFP, D_INFP); - } else { + } + else + { w = cpack((sin(2.0 * a) / d), (sinh(2.0 * b) / d)); } diff --git a/src/cplex/prim.h b/src/cplex/prim.h index 54c80cdb..84cf98f4 100644 --- a/src/cplex/prim.h +++ b/src/cplex/prim.h @@ -31,7 +31,7 @@ #define AMATH_LIB_COMPLEX_PRIM_H /** - * @file prim.h + * @file cplex/prim.h * @brief Primitives in math library for handling complex numbers. * */ diff --git a/src/lib/Makefile b/src/lib/Makefile index dfba089e..f8613713 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -1,14 +1,18 @@ -CXX = g++ -CXXFLAGS = -O3 -DWITHTEST -I. -I.. -Wall -AR = ar -RANLIB = ranlib -MKDIR = mkdir -p -DEL = rm -f -INSTALL = install -m 0644 -PREFIX = /usr - -alib = libamathapp.a -solib = libamathapp.so +CXX = g++ +CXXFLAGS = -O3 -DWITHTEST -I. -I.. -Wall +AR = ar +RANLIB = ranlib +MKDIR = mkdir -p +DEL = rm -f +INSTALL = install -m 0644 +LDCONFIG = ldconfig +PREFIX = /usr +INSTDIR = ${DESTDIR}${PREFIX}/lib/amath +INSTDIRI = ${DESTDIR}${PREFIX}/include/amath +INSTDIRPC = ${DESTDIR}${PREFIX}/lib/pkgconfig +alib = libamathapp.a +solib = libamathapp.so +pkgconfig = amatha.pc all: static shared @@ -64,20 +68,44 @@ build: ${MKDIR} shared ${solib}: build shared/aengine.o shared/charbuf.o shared/integer.o shared/cplex.o shared/nnumb.o shared/ntext.o shared/real.o - ${CC} -shared -fPIC -Wl,-soname,${solib} -o ${solib} shared/aengine.o shared/charbuf.o shared/integer.o shared/cplex.o shared/nnumb.o shared/ntext.o shared/real.o + ${CXX} ${CXXFLAGS} -shared -s -fPIC -Wl,-soname,${solib}.1.7.0 -o ${solib} shared/aengine.o shared/charbuf.o shared/integer.o shared/cplex.o shared/nnumb.o shared/ntext.o shared/real.o ${alib}: build static/aengine.o static/charbuf.o static/integer.o static/cplex.o static/nnumb.o static/ntext.o static/real.o ${AR} rcs static/${alib} static/aengine.o static/charbuf.o static/integer.o static/cplex.o static/nnumb.o static/ntext.o static/real.o ${RANLIB} static/${alib} -.PHONY: install -install: ${solib} - ${MKDIR} ${DESTDIR}${PREFIX}/lib - ${INSTALL} ${solib} ${DESTDIR}${PREFIX}/lib/${solib} +.PHONY: install +install: ${alib} ${solib} + ${MKDIR} ${INSTDIR} + ${MKDIR} ${INSTDIRPC} + ${MKDIR} ${INSTDIRI} + ${INSTALL} static/${alib} ${INSTDIR}/${alib} + ${INSTALL} ${solib} ${INSTDIR}/${solib} + ${INSTALL} ${pkgconfig} ${INSTDIRPC}/${pkgconfig} + ${INSTALL} aengine.h ${INSTDIRI}/aengine.h + ${INSTALL} charbuf.h ${INSTDIRI}/charbuf.h + ${INSTALL} cplex.h ${INSTDIRI}/cplex.h + ${INSTALL} integer.h ${INSTDIRI}/integer.h + ${INSTALL} nnumb.h ${INSTDIRI}/nnumb.h + ${INSTALL} ntext.h ${INSTDIRI}/ntext.h + ${INSTALL} numb.h ${INSTDIRI}/numb.h + ${INSTALL} real.h ${INSTDIRI}/real.h + ${LDCONFIG} ${INSTDIR} .PHONY: uninstall uninstall: - ${DEL} ${DESTDIR}${PREFIX}/lib/${solib} + ${DEL} ${INSTDIR}/${alib} + ${DEL} ${INSTDIR}/${solib} + ${DEL} ${INSTDIRPC}/${pkgconfig} + ${DEL} ${INSTDIRI}/aengine.h + ${DEL} ${INSTDIRI}/charbuf.h + ${DEL} ${INSTDIRI}/cplex.h + ${DEL} ${INSTDIRI}/integer.h + ${DEL} ${INSTDIRI}/nnumb.h + ${DEL} ${INSTDIRI}/ntext.h + ${DEL} ${INSTDIRI}/numb.h + ${DEL} ${INSTDIRI}/real.h + ${LDCONFIG} clean: ${DEL} static/${alib} ${solib} static/aengine.o static/charbuf.o static/integer.o static/cplex.o static/nnumb.o static/ntext.o static/real.o shared/aengine.o shared/charbuf.o shared/integer.o shared/cplex.o shared/nnumb.o shared/ntext.o shared/real.o diff --git a/src/lib/amatha.pc b/src/lib/amatha.pc new file mode 100644 index 00000000..fcb77569 --- /dev/null +++ b/src/lib/amatha.pc @@ -0,0 +1,10 @@ +prefix=/usr +exec_prefix=${prefix} +includedir=${prefix}/include/amath +libdir=${exec_prefix}/lib + +Name: amath application library +Description: C++ library for handling numbers +Version: 1.7.0 +Cflags: -I${includedir} +Libs: -L${libdir} -lamathapp -lamathr -lamathi -lamathc diff --git a/src/lib/amatha.vcxproj b/src/lib/amatha.vcxproj new file mode 100644 index 00000000..39612ca3 --- /dev/null +++ b/src/lib/amatha.vcxproj @@ -0,0 +1,124 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {B2BC043B-5799-4D01-96B0-C7871F7734FB} + Win32Proj + + + + StaticLibrary + true + v141 + + + StaticLibrary + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + $(ProjectDir).. + + + MachineX86 + true + Windows + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/lib/amatha.vcxproj.filters b/src/lib/amatha.vcxproj.filters new file mode 100644 index 00000000..9a2b00fd --- /dev/null +++ b/src/lib/amatha.vcxproj.filters @@ -0,0 +1,69 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/lib/charval.h b/src/lib/charval.h index 78e0e363..7b17312e 100644 --- a/src/lib/charval.h +++ b/src/lib/charval.h @@ -30,9 +30,13 @@ #ifndef AMATH_CHAR_VALIDATOR_H #define AMATH_CHAR_VALIDATOR_H -class CharValidator { +class CharValidator +{ public: - virtual ~CharValidator() {} + virtual ~CharValidator() + { + } + virtual bool Validate(char c) = 0; }; diff --git a/src/lib/cplex.cpp b/src/lib/cplex.cpp index 82108d51..792bcf3d 100644 --- a/src/lib/cplex.cpp +++ b/src/lib/cplex.cpp @@ -273,8 +273,7 @@ Number* ComplexNumber::Raise(Number* exponent) Number* ComplexNumber::Factorial() { - // TODO - return new RealNumber(1); + return new NonNumber(nnnimp); } Number* ComplexNumber::Signum() diff --git a/src/lib/cplex.h b/src/lib/cplex.h index d17d1bdb..f24196e2 100644 --- a/src/lib/cplex.h +++ b/src/lib/cplex.h @@ -67,7 +67,7 @@ public: bool IsTooSmall(); bool IsTooLarge(); bool IsNotImplemented(); - + Number* Unary(); Number* Add(Number* other); Number* Sub(Number* other); @@ -124,7 +124,7 @@ public: Number* HaVerCosine(); Number* HaCoVerSine(); Number* HaCoVerCosine(); - + Number* ArcVerSine(); Number* ArcVerCosine(); Number* ArcCoVerSine(); @@ -133,7 +133,7 @@ public: Number* ArcHaVerCosine(); Number* ArcHaCoVerSine(); Number* ArcHaCoVerCosine(); - + Number* ExSecant(); Number* ExCosecant(); Number* ArcExSecant(); diff --git a/src/lib/integer.cpp b/src/lib/integer.cpp index 0bc22fd0..5230abd9 100644 --- a/src/lib/integer.cpp +++ b/src/lib/integer.cpp @@ -378,7 +378,6 @@ Number* IntegerNumber::Log() */ Number* IntegerNumber::Log10() { - if (i == 0) return new NonNumber(nnnan); diff --git a/src/lib/integer.h b/src/lib/integer.h index 1021be25..02f4322e 100644 --- a/src/lib/integer.h +++ b/src/lib/integer.h @@ -63,7 +63,7 @@ public: bool IsTooSmall(); bool IsTooLarge(); bool IsNotImplemented(); - + Number* Unary(); Number* Add(Number* other); Number* Sub(Number* other); @@ -120,7 +120,7 @@ public: Number* HaVerCosine(); Number* HaCoVerSine(); Number* HaCoVerCosine(); - + Number* ArcVerSine(); Number* ArcVerCosine(); Number* ArcCoVerSine(); @@ -129,7 +129,7 @@ public: Number* ArcHaVerCosine(); Number* ArcHaCoVerSine(); Number* ArcHaCoVerCosine(); - + Number* ExSecant(); Number* ExCosecant(); Number* ArcExSecant(); diff --git a/src/lib/nnumb.h b/src/lib/nnumb.h index fc694c22..d244c207 100644 --- a/src/lib/nnumb.h +++ b/src/lib/nnumb.h @@ -67,7 +67,7 @@ public: bool IsTooSmall(); bool IsTooLarge(); bool IsNotImplemented(); - + Number* Unary(); Number* Add(Number* other); Number* Sub(Number* other); @@ -124,7 +124,7 @@ public: Number* HaVerCosine(); Number* HaCoVerSine(); Number* HaCoVerCosine(); - + Number* ArcVerSine(); Number* ArcVerCosine(); Number* ArcCoVerSine(); @@ -133,7 +133,7 @@ public: Number* ArcHaVerCosine(); Number* ArcHaCoVerSine(); Number* ArcHaCoVerCosine(); - + Number* ExSecant(); Number* ExCosecant(); Number* ArcExSecant(); diff --git a/src/lib/ntext.cpp b/src/lib/ntext.cpp index f67f0540..5d0ffab3 100644 --- a/src/lib/ntext.cpp +++ b/src/lib/ntext.cpp @@ -135,7 +135,7 @@ const char* PositionalNumeralSystem::GetText(Number* number) buf->Append("NaN"); return buf->GetString(); } - + if (number->IsNotImplemented()) { buf->Empty(); diff --git a/src/lib/numb.h b/src/lib/numb.h index 14f9deac..a917c202 100644 --- a/src/lib/numb.h +++ b/src/lib/numb.h @@ -73,7 +73,7 @@ public: virtual bool IsTooSmall() = 0; virtual bool IsTooLarge() = 0; virtual bool IsNotImplemented() = 0; - + virtual Number* Unary() = 0; virtual Number* Add(Number* other) = 0; virtual Number* Sub(Number* other) = 0; @@ -132,7 +132,7 @@ public: virtual Number* HaVerCosine() = 0; virtual Number* HaCoVerSine() = 0; virtual Number* HaCoVerCosine() = 0; - + virtual Number* ArcVerSine() = 0; virtual Number* ArcVerCosine() = 0; virtual Number* ArcCoVerSine() = 0; @@ -141,7 +141,7 @@ public: virtual Number* ArcHaVerCosine() = 0; virtual Number* ArcHaCoVerSine() = 0; virtual Number* ArcHaCoVerCosine() = 0; - + virtual Number* ExSecant() = 0; virtual Number* ExCosecant() = 0; virtual Number* ArcExSecant() = 0; diff --git a/src/lib/real.cpp b/src/lib/real.cpp index 78822726..5c4f7caa 100644 --- a/src/lib/real.cpp +++ b/src/lib/real.cpp @@ -382,7 +382,7 @@ Number* RealNumber::CubeRoot() Number* RealNumber::Reciprocal() { if (x != 0.0) - return new RealNumber(1 / x); + return new RealNumber(1.0 / x); return new NonNumber(nnnan); } @@ -393,21 +393,7 @@ Number* RealNumber::Reciprocal() */ Number* RealNumber::Factorial() { - int l = (int)trunc(x); - double r = 1; - int c; - - // TODO: Fix - if (l < 0) - return new RealNumber(0); - - if (l == 0) - return new RealNumber(1); - - for (c = 1; c <= l; c++) - r = r * c; - - return new RealNumber(r); + return new NonNumber(nnnimp); } /** @@ -825,7 +811,7 @@ Number* RealNumber::ArcCoVerSine() { if (x < 0.0 || x > 2.0) return new NonNumber(nnnan); - + return new RealNumber(acvs(x)); } @@ -838,7 +824,7 @@ Number* RealNumber::ArcHaVerSine() { if (x < 0.0 || x > 1.0) return new NonNumber(nnnan); - + return new RealNumber(ahv(x)); } @@ -869,14 +855,12 @@ Number* RealNumber::ExCosecant() Number* RealNumber::ArcExSecant() { - if (x <= -2.0 || x >= 0.0) - { - double a = x * x + 2 * x; - double b = sqrt(a); - return new RealNumber(atan(b)); - } + if (x > -2.0 && x < 0.0) + return new NonNumber(nnnan); - return new NonNumber(nnnan); + double a = x * x + 2 * x; + double b = sqrt(a); + return new RealNumber(atan(b)); } Number* RealNumber::ArcExCosecant() diff --git a/src/lib/real.h b/src/lib/real.h index f74f8fb6..f599b850 100644 --- a/src/lib/real.h +++ b/src/lib/real.h @@ -123,7 +123,7 @@ public: Number* HaVerCosine(); Number* HaCoVerSine(); Number* HaCoVerCosine(); - + Number* ArcVerSine(); Number* ArcVerCosine(); Number* ArcCoVerSine(); @@ -132,7 +132,7 @@ public: Number* ArcHaVerCosine(); Number* ArcHaCoVerSine(); Number* ArcHaCoVerCosine(); - + Number* ExSecant(); Number* ExCosecant(); Number* ArcExSecant(); diff --git a/src/localize/help.h b/src/localize/help.h index c5d981ea..8667d5e2 100644 --- a/src/localize/help.h +++ b/src/localize/help.h @@ -34,7 +34,7 @@ #define AMATH_LOCALIZE_HELP_H /** - * @file help.h + * @file localize/help.h * @brief Help texts for statement. * */ @@ -54,40 +54,42 @@ struct helptextdef }; static const helptextdef helptexts[] = { - {0, symzero, "Enter command or expression to evaluate.#NEWLINE##SYNTAXHIGHLIGHT#Example: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#More help is available for designated topics.#NEWLINE#-------------------------------------------------#NEWLINE#functions Base functions.#NEWLINE#trigon Trigonometric functions.#NEWLINE#hyper Hyperbolic functions.#NEWLINE#complex Syntax for complex numbers.#NEWLINE#statements Available statements.#NEWLINE#operators Supported operators.#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: help trigon#NEWLINE#"}, - {1, symoperator, "-------------------------------------------------#NEWLINE# + Mathematical addition.#NEWLINE# - Mathematical subtraction.#NEWLINE# * Mathematical multiplication.#NEWLINE# / Mathematical division.#NEWLINE# ^ Mathematical exponentiation.#NEWLINE# = Assignment of variable values.#NEWLINE# | Absolute value of number. #NEWLINE#-------------------------------------------------#NEWLINE#"}, - {2, symfunction, "-------------------------------------------------#NEWLINE#abs Absolute value of number.#NEWLINE#sgn Mathematical signum function.#NEWLINE#round Round to nearest integer number.#NEWLINE#trunc Discard fraction part of number.#NEWLINE#floor Mathematical floor function.#NEWLINE#ceil Mathematical ceiling function.#NEWLINE#sqrt Square root function (exp 1/2).#NEWLINE#cbrt Cube root function (exp 1/3).#NEWLINE#lb Binary logarithm function (base 2).#NEWLINE#ln Natural logarithm function (base e).#NEWLINE#lg Common logarithm function (base 10).#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: round(1.55)#NORMALTEXT##NEWLINE#"}, - {3, symtrigon, "-------------------------------------------------#NEWLINE#sin Trigonometric sine function.#NEWLINE#cos Trigonometric cosine function.#NEWLINE#tan Trigonometric tangent function.#NEWLINE#cot Trigonometric cotangent function.#NEWLINE#sec Trigonometric secant function.#NEWLINE#csc Trigonometric cosecant function.#NEWLINE#asin Inverse trigonometric sine function.#NEWLINE#acos Inverse trigonometric cosine function.#NEWLINE#atan Inverse trigonometric tangent function.#NEWLINE#acot Inverse trigonometric cotangent function.#NEWLINE#asec Inverse trigonometric secant function.#NEWLINE#acsc Inverse trigonometric cosecant function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE#"}, - {4, symhyper, "-------------------------------------------------#NEWLINE#sinh Hyperbolic sine function.#NEWLINE#cosh Hyperbolic cosine function.#NEWLINE#tanh Hyperbolic tangent function.#NEWLINE#coth Hyperbolic cotangent function.#NEWLINE#sech Hyperbolic secant function.#NEWLINE#csch Hyperbolic cosecant function. #NEWLINE#asinh Inverse hyperbolic sine function.#NEWLINE#acosh Inverse hyperbolic cosine function.#NEWLINE#atanh Inverse hyperbolic tangent function.#NEWLINE#acoth Inverse hyperbolic cotangent function.#NEWLINE#asech Inverse hyperbolic secant function.#NEWLINE#acsch Inverse hyperbolic cosecant function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE#"}, - {5, symstatement, "---------------------------------------------------------#NEWLINE#clear Clear console window.#NEWLINE#def Define function.#NEWLINE#delete Delete variable or function.#NEWLINE#digits Set number of significant digits.#NEWLINE#eval Evaluate arithmetic expression.#NEWLINE#execute Execute statements in a file.#NEWLINE#functions Show list of user defined functions.#NEWLINE#input Change numeral input system.#NEWLINE#help Show basic help text.#NEWLINE#output Change numeral output system.#NEWLINE#list Show content of a directory.#NEWLINE#show Show content of a file.#NEWLINE#load Load variable and functions from file.#NEWLINE#save Save variable and functions to file.#NEWLINE#variables Show list of variables.#NEWLINE#version Show version string.#NEWLINE#memory Show internal memory usage.#NEWLINE#exit Exit program.#NEWLINE#---------------------------------------------------------#NEWLINE#The def and eval statements are optional. Functions and#NEWLINE#variables statements can be shorten to funcs and vars.#NEWLINE#"}, - {6, symcomplex, "Expressions with complex numbers are written using an i to denote#NEWLINE#the imaginary value. Complex numbers can seamlessly be mixed with#NEWLINE#real numbers.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: 2+3i#NEWLINE#Example: 2+3.2i*cos(-1i)+5/7#NEWLINE#"}, - {7, symclear, "The clear statement erases all text in the console window.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: clear#NEWLINE#"}, - {8, symdef, "The def statement is used to define functions. When defining a function#NEWLINE#it is possible to omit the def keyword. Defined functions can be shown#NEWLINE#using the functions statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: def f(x)=2*x+3#NEWLINE#Optional syntax: f(x)=2*x+3#NEWLINE#"}, - {9, symdelete, "The delete statement can delete variable and functions. To delete a#NEWLINE#single variable or functions use the name of the function or variable.#NEWLINE#To delete all functions or variables specify either the variable or#NEWLINE#function keyword.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: delete f(x)#NEWLINE#Syntax: delete variables#NEWLINE#"}, - {10, symdigits, "The digits statement defines the displayed number of significant digits.#NEWLINE#To show current configuration use the digits statement without specifying#NEWLINE#the number.#NEWLINE# #SYNTAXHIGHLIGHT#Syntax: digits 7#NEWLINE#"}, - {11, symeval, "The eval statement evaluates an expression. When evaluating an expression#NEWLINE#it is possible to omit the eval keyword.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: eval 2.4*x+3.2#NEWLINE#Optional syntax: 2.4*x+3.2#NEWLINE#"}, - {12, symexecute, "The execute statement reads the content of a file and execute all statements.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: execute \"savedfile\"#NEWLINE#"}, - {13, syminput, "The input statement either changes or shows the how numeral input is interpreted.#NEWLINE#Possible input systems are: binary, octal, decimal and hexadecimal. Default is#NEWLINE#decimal. To use positional systems with other bases specify the base number.#NEWLINE#Numeral output system can be modified using the output statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: input hexadecimal#NEWLINE#Syntax: input 4#NEWLINE#"}, - {14, symhelp, "The help statement can be used to display help about topics and statements.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: help variables#NEWLINE#"}, - {15, symoutput, "The output statement either changes or shows the how numeral output is shown.#NEWLINE#Possible output systems are: binary, octal, decimal and hexadecimal. Default#NEWLINE#is decimal. To use positional systems with other bases specify the base number.#NEWLINE#Numeral input system can be modified using the input statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: output octal#NEWLINE#"}, - {16, symlist, "No description is available for the list statement.#NEWLINE#"}, - {17, symshow, "The show statement displays the content of a file.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: show \"filetosee\"#NEWLINE#"}, - {18, symload, "The load statement retrieves a set of defined variables and functions from#NEWLINE#a file. Variables and functions can be saved using the save statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: load \"savedwork\"#NEWLINE#"}, - {19, symsave, "The save statement saves defined variables and functions to a file in a#NEWLINE#plain text format. Saved variables and functions can be retrieved using#NEWLINE#the load statement.#NEWLINE# #SYNTAXHIGHLIGHT#Syntax: save \"worktokeep\"#NEWLINE#"}, - {20, symversion, "Show which version of amath is running.#NEWLINE#"}, - {21, symmem, "Show internal memory usage together with maximum usage.#NEWLINE#"}, - {22, symprefs, "There is no help for prefs statement now.#NEWLINE#"}, - {23, symvariable, "The variable statement shows a list of variables in memory.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: variables#NEWLINE##NORMALTEXT#optional syntax: vars#NEWLINE#"}, - {24, symexit, "The exit statement shuts down amath.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: exit#NEWLINE#"}, - {25, syme, "Euler's number is base of the exponential function which equals its own#NEWLINE#derivative. It is approximately equal to 2.71828.#NEWLINE##SYNTAXHIGHLIGHT#Example: ln(e)#NEWLINE#"}, - {26, sympi, "Pi is the ratio of the circumference of a circle to its diameter. Being an#NEWLINE#irrational number, pi cannot be expressed exactly as a common fraction.#NEWLINE#The value of pi is commonly approximated as #SYNTAXHIGHLIGHT#3.14159#NORMALTEXT#.#NEWLINE#"}, - {27, symi, "The imaginary unit is denoted and commonly referred to as i.#NEWLINE#The imaginary unit is a number, which when multiplied#NEWLINE#by itself gives -1.#NEWLINE#"}, - {28, symins, "No help is available for the ins variable#NEWLINE#"}, - {29, symbin, "No help is available for the binary keyword#NEWLINE"}, - {30, symoct, "No help is available for the octal keyword#NEWLINE"}, - {31, symdec, "No help is available for the decimal keyword#NEWLINE"}, - {32, symhex, "No help is available for the hexadecimal keyword#NEWLINE"}, - {-1, symzero, EMPTYSTRING} + { 0, symzero, "Enter command or expression to evaluate.#NEWLINE##SYNTAXHIGHLIGHT#Example: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#More help is available for designated topics.#NEWLINE#-------------------------------------------------#NEWLINE#functions Base functions.#NEWLINE#trigon Trigonometric functions.#NEWLINE#hyper Hyperbolic functions.#NEWLINE#early Early trigonometric functions.#NEWLINE#complex Syntax for complex numbers.#NEWLINE#statements Available statements.#NEWLINE#operators Supported operators.#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: help trigon#NEWLINE#" }, + { 1, symoperator, "-------------------------------------------------#NEWLINE# + Mathematical addition.#NEWLINE# - Mathematical subtraction.#NEWLINE# * Mathematical multiplication.#NEWLINE# / Mathematical division.#NEWLINE# ^ Mathematical exponentiation.#NEWLINE# = Assignment of variable values.#NEWLINE# | Absolute value of number. #NEWLINE#-------------------------------------------------#NEWLINE#" }, + { 2, symfunction, "-------------------------------------------------#NEWLINE#abs Absolute value of number.#NEWLINE#sgn Mathematical signum function.#NEWLINE#round Round to nearest integer number.#NEWLINE#trunc Discard fraction part of number.#NEWLINE#floor Mathematical floor function.#NEWLINE#ceil Mathematical ceiling function.#NEWLINE#sqrt Square root function (exp 1/2).#NEWLINE#cbrt Cube root function (exp 1/3).#NEWLINE#lb Binary logarithm function (base 2).#NEWLINE#ln Natural logarithm function (base e).#NEWLINE#lg Common logarithm function (base 10).#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: round(1.55)#NORMALTEXT##NEWLINE#" }, + { 3, symtrigon, "-------------------------------------------------#NEWLINE#sin Trigonometric sine function.#NEWLINE#cos Trigonometric cosine function.#NEWLINE#tan Trigonometric tangent function.#NEWLINE#cot Trigonometric cotangent function.#NEWLINE#sec Trigonometric secant function.#NEWLINE#csc Trigonometric cosecant function.#NEWLINE#exsec Trigonometric exsecant function.#NEWLINE#excsc Trigonometric excosecant function.#NEWLINE#asin Inverse trigonometric sine function.#NEWLINE#acos Inverse trigonometric cosine function.#NEWLINE#atan Inverse trigonometric tangent function.#NEWLINE#acot Inverse trigonometric cotangent function.#NEWLINE#asec Inverse trigonometric secant function.#NEWLINE#acsc Inverse trigonometric cosecant function.#NEWLINE#exsec Inverse trigonometric exsecant function.#NEWLINE#excsc Inverse trigonometric excosecant function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE#" }, + { 4, symhyper, "-------------------------------------------------#NEWLINE#sinh Hyperbolic sine function.#NEWLINE#cosh Hyperbolic cosine function.#NEWLINE#tanh Hyperbolic tangent function.#NEWLINE#coth Hyperbolic cotangent function.#NEWLINE#sech Hyperbolic secant function.#NEWLINE#csch Hyperbolic cosecant function. #NEWLINE#asinh Inverse hyperbolic sine function.#NEWLINE#acosh Inverse hyperbolic cosine function.#NEWLINE#atanh Inverse hyperbolic tangent function.#NEWLINE#acoth Inverse hyperbolic cotangent function.#NEWLINE#asech Inverse hyperbolic secant function.#NEWLINE#acsch Inverse hyperbolic cosecant function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE#" }, + { 5, symearly, "-------------------------------------------------#NEWLINE#ver Versed sine function.#NEWLINE#vcs Versed cosine function.#NEWLINE#cvs Coversed sine function.#NEWLINE#cvc Coversed cosine function.#NEWLINE#hv Haversed sine function.#NEWLINE#hvc Haversed cosine function.#NEWLINE#hcv Hacoversed sine function.#NEWLINE#hcc Hacoversed cosine function.#NEWLINE#aver Inverse versed sine function.#NEWLINE#avcs Inverse versed cosine function.#NEWLINE#acvs Inverse coversed sine function.#NEWLINE#acvc Inverse coversed cosine function.#NEWLINE#ahv Inverse haversed sine function.#NEWLINE#ahvc Inverse haversed cosine function.#NEWLINE#ahcv Inverse hacoversed sine function.#NEWLINE#ahcc Inverse hacoversed cosine function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE#" }, + { 6, symcomplex, "Expressions with complex numbers are written using an i to denote#NEWLINE#the imaginary value. Complex numbers can seamlessly be mixed with#NEWLINE#real numbers.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: 2+3i#NEWLINE#Example: 2+3.2i*cos(-1i)+5/7#NEWLINE#" }, + { 7, symclear, "The clear statement erases all text in the console window.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: clear#NEWLINE#" }, + { 8, symdef, "The def statement is used to define functions. When defining a function#NEWLINE#it is possible to omit the def keyword. Defined functions can be shown#NEWLINE#using the functions statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: def f(x)=2*x+3#NEWLINE#Optional syntax: f(x)=2*x+3#NEWLINE#" }, + { 9, symdelete, "The delete statement can delete variable and functions. To delete a#NEWLINE#single variable or functions use the name of the function or variable.#NEWLINE#To delete all functions or variables specify either the variable or#NEWLINE#function keyword.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: delete f(x)#NEWLINE#Syntax: delete variables#NEWLINE#" }, + { 10, symdigits, "The digits statement defines the displayed number of significant digits.#NEWLINE#To show current configuration use the digits statement without specifying#NEWLINE#the number.#NEWLINE# #SYNTAXHIGHLIGHT#Syntax: digits 7#NEWLINE#" }, + { 11, symeval, "The eval statement evaluates an expression. When evaluating an expression#NEWLINE#it is possible to omit the eval keyword.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: eval 2.4*x+3.2#NEWLINE#Optional syntax: 2.4*x+3.2#NEWLINE#" }, + { 12, symexecute, "The execute statement reads the content of a file and execute all statements.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: execute \"savedfile\"#NEWLINE#" }, + { 13, syminput, "The input statement either changes or shows the how numeral input is interpreted.#NEWLINE#Possible input systems are: binary, octal, decimal and hexadecimal. Default is#NEWLINE#decimal. To use positional systems with other bases specify the base number.#NEWLINE#Numeral output system can be modified using the output statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: input hexadecimal#NEWLINE#Syntax: input 4#NEWLINE#" }, + { 14, symhelp, "The help statement can be used to display help about topics and statements.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: help variables#NEWLINE#" }, + { 15, symoutput, "The output statement either changes or shows the how numeral output is shown.#NEWLINE#Possible output systems are: binary, octal, decimal and hexadecimal. Default#NEWLINE#is decimal. To use positional systems with other bases specify the base number.#NEWLINE#Numeral input system can be modified using the input statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: output octal#NEWLINE#" }, + { 16, symlist, "No description is available for the list statement.#NEWLINE#" }, + { 17, symshow, "The show statement displays the content of a file.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: show \"filetosee\"#NEWLINE#" }, + { 18, symload, "The load statement retrieves a set of defined variables and functions from#NEWLINE#a file. Variables and functions can be saved using the save statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: load \"savedwork\"#NEWLINE#" }, + { 19, symsave, "The save statement saves defined variables and functions to a file in a#NEWLINE#plain text format. Saved variables and functions can be retrieved using#NEWLINE#the load statement.#NEWLINE# #SYNTAXHIGHLIGHT#Syntax: save \"worktokeep\"#NEWLINE#" }, + { 20, symversion, "Show which version of amath is running.#NEWLINE#" }, + { 21, symabout, "Show various information about the running version of amath.#NEWLINE#" }, + { 22, symlicense, "Show license details.#NEWLINE#" }, + { 23, symmem, "Show internal memory usage together with maximum usage.#NEWLINE#" }, + { 24, symprefs, "There is no help for prefs statement now.#NEWLINE#" }, + { 25, symvariable, "The variable statement shows a list of variables in memory.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: variables#NEWLINE##NORMALTEXT#optional syntax: vars#NEWLINE#" }, + { 26, symexit, "The exit statement shuts down amath.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: exit#NEWLINE#" }, + { 27, syme, "Euler's number is base of the exponential function which equals its own#NEWLINE#derivative. It is approximately equal to 2.71828.#NEWLINE##SYNTAXHIGHLIGHT#Example: ln(e)#NEWLINE#" }, + { 28, sympi, "Pi is the ratio of the circumference of a circle to its diameter. Being an#NEWLINE#irrational number, pi cannot be expressed exactly as a common fraction.#NEWLINE#The value of pi is commonly approximated as #SYNTAXHIGHLIGHT#3.14159#NORMALTEXT#.#NEWLINE#" }, + { 29, symi, "The imaginary unit is denoted and commonly referred to as i.#NEWLINE#The imaginary unit is a number, which when multiplied#NEWLINE#by itself gives -1.#NEWLINE#" }, + { 30, symins, "No help is available for the ins variable#NEWLINE#" }, + { 31, symbin, "No help is available for the binary keyword#NEWLINE" }, + { 32, symoct, "No help is available for the octal keyword#NEWLINE" }, + { 33, symdec, "No help is available for the decimal keyword#NEWLINE" }, + { 34, symhex, "No help is available for the hexadecimal keyword#NEWLINE" }, + { -1, symzero, EMPTYSTRING } }; #endif diff --git a/src/localize/ialias.h b/src/localize/ialias.h index 65c0509c..aaf52f74 100644 --- a/src/localize/ialias.h +++ b/src/localize/ialias.h @@ -33,7 +33,9 @@ #include "amatht.h" static const identalias identaliases[] = { + {"squareroot", "sqrt"}, {"sqr", "sqrt"}, + {"cuberoot", "cbrt"}, {"cbr", "cbrt"}, {"log2", "lb"}, {"log", "lg"}, @@ -41,6 +43,18 @@ static const identalias identaliases[] = { {"sine", "sin"}, {"cosine", "cos"}, {"tangent", "tan"}, + {"secant", "sec"}, + {"cosec", "csc"}, + {"cosecant", "csc"}, + {"ctg", "cot"}, + {"ctn", "cot"}, + {"cotangent", "cot"}, + {"arcsine", "asin"}, + {"arccosine", "acos"}, + {"arctangent", "atan"}, + {"arccotangent", "acot"}, + {"arcsecant", "asec"}, + {"arccosecant", "acsc"}, {"arsin", "asin"}, {"arcos", "acos"}, {"artan", "atan"}, diff --git a/src/localize/ident.h b/src/localize/ident.h index 7450d7f2..e7780a23 100644 --- a/src/localize/ident.h +++ b/src/localize/ident.h @@ -34,7 +34,7 @@ #define AMATH_LOCALIZE_IDENT_H /** - * @file ident.h + * @file localize/ident.h * @brief Help texts for built-in functions. * */ @@ -44,42 +44,62 @@ #include "amatht.h" static const identhelpdef identtexts[] = { - {0, "abs", "No help is available for this function.#NEWLINE#"}, - {1, "sgn", "No help is available for this function.#NEWLINE#"}, - {2, "round", "No help is available for this function.#NEWLINE#"}, - {3, "trunc", "No help is available for this function.#NEWLINE#"}, - {4, "floor", "No help is available for this function.#NEWLINE#"}, - {5, "ceil", "No help is available for this function.#NEWLINE#"}, - {6, "sqr", "No help is available for this function.#NEWLINE#"}, - {7, "cbr", "No help is available for this function.#NEWLINE#"}, - {8, "lb", "No help is available for this function.#NEWLINE#"}, - {9, "ln", "No help is available for this function.#NEWLINE#"}, - {10, "lg", "No help is available for this function.#NEWLINE#"}, - {11, "sin", "No help is available for this function.#NEWLINE#"}, - {12, "cos", "No help is available for this function.#NEWLINE#"}, - {13, "tan", "No help is available for this function.#NEWLINE#"}, - {14, "cot", "No help is available for this function.#NEWLINE#"}, - {15, "sec", "No help is available for this function.#NEWLINE#"}, - {16, "csc", "No help is available for this function.#NEWLINE#"}, - {17, "asin", "No help is available for this function.#NEWLINE#"}, - {18, "acos", "No help is available for this function.#NEWLINE#"}, - {19, "atan", "No help is available for this function.#NEWLINE#"}, - {20, "acot", "No help is available for this function.#NEWLINE#"}, - {21, "asec", "No help is available for this function.#NEWLINE#"}, - {22, "acsc", "No help is available for this function.#NEWLINE#"}, - {23, "sinh", "No help is available for this function.#NEWLINE#"}, - {24, "cosh", "No help is available for this function.#NEWLINE#"}, - {25, "tanh", "No help is available for this function.#NEWLINE#"}, - {26, "coth", "No help is available for this function.#NEWLINE#"}, - {27, "sech", "No help is available for this function.#NEWLINE#"}, - {28, "csch", "No help is available for this function.#NEWLINE#"}, - {29, "asinh", "No help is available for this function.#NEWLINE#"}, - {30, "acosh", "No help is available for this function.#NEWLINE#"}, - {31, "atanh", "No help is available for this function.#NEWLINE#"}, - {32, "acoth", "No help is available for this function.#NEWLINE#"}, - {33, "asech", "No help is available for this function.#NEWLINE#"}, - {34, "acsch", "No help is available for this function.#NEWLINE#"}, - {-1, EMPTYSTRING, EMPTYSTRING} + { 0, "abs", "No help is available for this function.#NEWLINE#" }, + { 1, "sgn", "No help is available for this function.#NEWLINE#" }, + { 2, "round", "No help is available for this function.#NEWLINE#" }, + { 3, "trunc", "No help is available for this function.#NEWLINE#" }, + { 4, "floor", "No help is available for this function.#NEWLINE#" }, + { 5, "ceil", "No help is available for this function.#NEWLINE#" }, + { 6, "sqr", "No help is available for this function.#NEWLINE#" }, + { 7, "cbr", "No help is available for this function.#NEWLINE#" }, + { 8, "lb", "No help is available for this function.#NEWLINE#" }, + { 9, "ln", "No help is available for this function.#NEWLINE#" }, + { 10, "lg", "No help is available for this function.#NEWLINE#" }, + { 11, "sin", "No help is available for this function.#NEWLINE#" }, + { 12, "cos", "No help is available for this function.#NEWLINE#" }, + { 13, "tan", "No help is available for this function.#NEWLINE#" }, + { 14, "cot", "No help is available for this function.#NEWLINE#" }, + { 15, "sec", "No help is available for this function.#NEWLINE#" }, + { 16, "csc", "No help is available for this function.#NEWLINE#" }, + { 17, "asin", "No help is available for this function.#NEWLINE#" }, + { 18, "acos", "No help is available for this function.#NEWLINE#" }, + { 19, "atan", "No help is available for this function.#NEWLINE#" }, + { 20, "acot", "No help is available for this function.#NEWLINE#" }, + { 21, "asec", "No help is available for this function.#NEWLINE#" }, + { 22, "acsc", "No help is available for this function.#NEWLINE#" }, + { 23, "sinh", "No help is available for this function.#NEWLINE#" }, + { 24, "cosh", "No help is available for this function.#NEWLINE#" }, + { 25, "tanh", "No help is available for this function.#NEWLINE#" }, + { 26, "coth", "No help is available for this function.#NEWLINE#" }, + { 27, "sech", "No help is available for this function.#NEWLINE#" }, + { 28, "csch", "No help is available for this function.#NEWLINE#" }, + { 29, "asinh", "No help is available for this function.#NEWLINE#" }, + { 30, "acosh", "No help is available for this function.#NEWLINE#" }, + { 31, "atanh", "No help is available for this function.#NEWLINE#" }, + { 32, "acoth", "No help is available for this function.#NEWLINE#" }, + { 33, "asech", "No help is available for this function.#NEWLINE#" }, + { 34, "acsch", "No help is available for this function.#NEWLINE#" }, + { 35, "ver", "The versed sine is an early appearing trigonometric function.#NEWLINE#It is equal to one minus the cosine.#NEWLINE#ver(x) = 1 - cos(x)#NEWLINE#" }, + { 36, "vcs", "The versed cosine is an early appearing trigonometric function.#NEWLINE#It is equal to one plus the cosine.#NEWLINE#ver(x) = 1 + cos(x)#NEWLINE#" }, + { 37, "cvs", "The coversed sine is an early appearing trigonometric function.#NEWLINE#It is equal to one minus the sine.#NEWLINE#ver(x) = 1 - sin(x)#NEWLINE#" }, + { 38, "cvc", "The coversed cosine is an early appearing trigonometric function.#NEWLINE#It is equal to one plus the sine.#NEWLINE#cvc(x) = 1 + sin(x)#NEWLINE#" }, + { 39, "hv", "No help is available for the haversed sine function.#NEWLINE#" }, + { 40, "hvc", "No help is available for the haversed cosine function.#NEWLINE#" }, + { 41, "hcv", "No help is available for the hacoversed sine function.#NEWLINE#" }, + { 42, "hcc", "No help is available for the hacoversed cosine function.#NEWLINE#" }, + { 43, "aver", "No help is available for this function.#NEWLINE#" }, + { 44, "avcs", "No help is available for this function.#NEWLINE#" }, + { 45, "acvs", "No help is available for this function.#NEWLINE#" }, + { 46, "acvc", "No help is available for this function.#NEWLINE#" }, + { 47, "ahv", "No help is available for this function.#NEWLINE#" }, + { 48, "ahvc", "No help is available for this function.#NEWLINE#" }, + { 49, "ahcv", "The inverse hacoversed sine is not implemented in this version of amath.#NEWLINE#" }, + { 50, "ahcc", "The inverse hacoversed cosine is not implemented in this version of amath.#NEWLINE#" }, + { 51, "exsec", "No help is available for the exsecant function.#NEWLINE#" }, + { 52, "excsc", "No help is available for the excosecant function.#NEWLINE#" }, + { 53, "aexsec", "No help is available for the inverse exsecant function.#NEWLINE#" }, + { 54, "aexcsc", "No help is available for the inverse excosecant function.#NEWLINE#" }, + { -1, EMPTYSTRING, EMPTYSTRING } }; #endif diff --git a/src/localize/kword.h b/src/localize/kword.h index a4d2cd89..d9e7b9c4 100644 --- a/src/localize/kword.h +++ b/src/localize/kword.h @@ -34,7 +34,7 @@ #define AMATH_LOCALIZE_KEYWORD_H /** - * @file kword.h + * @file localize/kword.h * @brief Keywords used by lexer. * */ @@ -55,55 +55,56 @@ struct keyworddef }; static const keyworddef keywords[] = { - {0, symclear, "clear"}, - {1, symdef, "def"}, - {2, symdelete, "delete"}, - {3, syme, "e"}, - {4, symi, "i"}, - {5, sympi, "pi"}, - {6, symins, "ins"}, - {7, symeval, "eval"}, - {8, symdraw, "draw"}, - {9, symplot, "plot"}, - {10, symexecute, "execute"}, - {11, symexit, "exit"}, - {12, symexit, "quit"}, - {13, symstatement, "statements"}, - {14, symoperator, "operators"}, - {15, symcomplex, "complex"}, - {16, symfunction, "funcs"}, - {17, symfunction, "functions"}, - {18, symtrigon, "trigon"}, - {19, symtrigon, "trigonometric"}, - {20, symhyper, "hyper"}, - {21, symhyper, "hyperbolic"}, - {22, symhelp, "help"}, - {23, symprompt, "prompt"}, - {24, symversion, "version"}, - {25, symmem, "mem"}, - {26, symmem, "memory"}, - {27, symprefs, "prefs"}, - {28, symprefs, "preferences"}, - {29, symlist, "list"}, - {30, symload, "load"}, - {31, symsave, "save"}, - {32, symshow, "show"}, - {33, symvariable, "vars"}, - {34, symvariable, "variables"}, - {35, symdigits, "digits"}, - {36, syminput, "input"}, - {37, symoutput, "output"}, - {38, symbin, "bin"}, - {39, symbin, "binary"}, - {40, symoct, "oct"}, - {41, symoct, "octal"}, - {42, symdec, "dec"}, - {43, symdec, "decimal"}, - {44, symhex, "hex"}, - {45, symhex, "hexadecimal"}, - {46, symabout, "about"}, - {47, symlicense, "license"}, - {-1, Symbol(0), EMPTYSTRING} + { 0, symclear, "clear" }, + { 1, symdef, "def" }, + { 2, symdelete, "delete" }, + { 3, syme, "e" }, + { 4, symi, "i" }, + { 5, sympi, "pi" }, + { 6, symins, "ins" }, + { 7, symeval, "eval" }, + { 8, symdraw, "draw" }, + { 9, symplot, "plot" }, + { 10, symexecute, "execute" }, + { 11, symexit, "exit" }, + { 12, symexit, "quit" }, + { 13, symstatement, "statements" }, + { 14, symoperator, "operators" }, + { 15, symcomplex, "complex" }, + { 16, symfunction, "funcs" }, + { 17, symfunction, "functions" }, + { 18, symtrigon, "trigon" }, + { 19, symtrigon, "trigonometric" }, + { 20, symhyper, "hyper" }, + { 21, symhyper, "hyperbolic" }, + { 22, symearly, "early" }, + { 23, symhelp, "help" }, + { 24, symprompt, "prompt" }, + { 25, symversion, "version" }, + { 26, symmem, "mem" }, + { 27, symmem, "memory" }, + { 28, symprefs, "prefs" }, + { 29, symprefs, "preferences" }, + { 30, symlist, "list" }, + { 31, symload, "load" }, + { 32, symsave, "save" }, + { 33, symshow, "show" }, + { 34, symvariable, "vars" }, + { 35, symvariable, "variables" }, + { 36, symdigits, "digits" }, + { 37, syminput, "input" }, + { 38, symoutput, "output" }, + { 39, symbin, "bin" }, + { 40, symbin, "binary" }, + { 41, symoct, "oct" }, + { 42, symoct, "octal" }, + { 43, symdec, "dec" }, + { 44, symdec, "decimal" }, + { 45, symhex, "hex" }, + { 46, symhex, "hexadecimal" }, + { 47, symabout, "about" }, + { 48, symlicense, "license" }, + { -1, Symbol(0), EMPTYSTRING } }; #endif diff --git a/src/localize/lex.h b/src/localize/lex.h index b8bd69c3..6aee2216 100644 --- a/src/localize/lex.h +++ b/src/localize/lex.h @@ -31,7 +31,7 @@ #define AMATH_LOCALIZE_LEX_H /** - * @file lex.h + * @file localize/lex.h * @brief Lexer defitions used by other classes. * */ @@ -73,6 +73,7 @@ typedef enum symvariable, symtrigon, symhyper, + symearly, symcomplex, syme, sympi, diff --git a/src/localize/text.h b/src/localize/text.h index fde82e72..a02ca8b7 100644 --- a/src/localize/text.h +++ b/src/localize/text.h @@ -34,7 +34,7 @@ #define AMATH_LOCALIZE_TEXT_H /** - * @file text.h + * @file localize/text.h * @brief Static texts in amath. * */ @@ -45,77 +45,117 @@ #include "amatht.h" #include "system/program.h" -#define INTROMSG Program->Language->GetText(0) -#define TXTLISTDIRHEADER Program->Language->GetText(1) -#define TXTLISTDIRTFILE Program->Language->GetText(2) -#define TXTLISTDIRTDIR Program->Language->GetText(3) -#define TXTLISTDIRTUNKNOWN Program->Language->GetText(4) -#define TXTMEMBLOCKS Program->Language->GetText(5) -#define TXTMEMSIZE Program->Language->GetText(6) -#define TXTMEMMAXSIZE Program->Language->GetText(7) -#define HELPNOHELP Program->Language->GetText(8) -#define HELPSYNTAX Program->Language->GetText(9) -#define HELPUERROR Program->Language->GetText(10) -#define HELPVARNDEF Program->Language->GetText(11) -#define HELPFUNNDEF Program->Language->GetText(12) -#define HELPFUNRDEF Program->Language->GetText(13) -#define HELPPNUMERA Program->Language->GetText(14) -#define HELPPDIGITS Program->Language->GetText(15) -#define HELPINPUSHOW Program->Language->GetText(16) -#define HELPOUTPSHOW Program->Language->GetText(17) -#define HELPINPUSETT Program->Language->GetText(18) -#define HELPOUTPSETT Program->Language->GetText(19) -#define HELPDIGISETT Program->Language->GetText(20) -#define HELPDIGISHOW Program->Language->GetText(21) -#define HELPVARSNDEF Program->Language->GetText(22) -#define HELPFUNCNDEF Program->Language->GetText(23) -#define HELPLOADSUCC Program->Language->GetText(24) -#define HELPSAVESUCC Program->Language->GetText(25) -#define HELPSAVEFAIL Program->Language->GetText(26) -#define HELPSAVENOTH Program->Language->GetText(27) -#define HELPPREFLOAD Program->Language->GetText(28) -#define HELPPREFNOLO Program->Language->GetText(29) -#define HELPPREFSAVE Program->Language->GetText(30) -#define HELPPREFNOSA Program->Language->GetText(31) -#define MSGNODIR Program->Language->GetText(32) -#define MSGNOFILE Program->Language->GetText(33) +#define INTROMSG (Program->Language->GetText(0)) +#define STATEMENTLINE (Program->Language->GetText(1)) +#define STATEMENTCLEAR (Program->Language->GetText(2)) +#define STATEMENTDEF (Program->Language->GetText(3)) +#define STATEMENTDELETE (Program->Language->GetText(4)) +#define STATEMENTDIGITS (Program->Language->GetText(5)) +#define STATEMENTEVAL (Program->Language->GetText(6)) +#define STATEMENTEXECUTE (Program->Language->GetText(7)) +#define STATEMENTFUNCS (Program->Language->GetText(8)) +#define STATEMENTINPUT (Program->Language->GetText(9)) +#define STATEMENTHELP (Program->Language->GetText(10)) +#define STATEMENTOUTPUT (Program->Language->GetText(11)) +#define STATEMENTLIST (Program->Language->GetText(12)) +#define STATEMENTSHOW (Program->Language->GetText(13)) +#define STATEMENTLOAD (Program->Language->GetText(14)) +#define STATEMENTSAVE (Program->Language->GetText(15)) +#define STATEMENTVARS (Program->Language->GetText(16)) +#define STATEMENTVERSION (Program->Language->GetText(17)) +#define STATEMENTMEMORY (Program->Language->GetText(18)) +#define STATEMENTEXIT (Program->Language->GetText(19)) +#define STATEMENTFOOTER (Program->Language->GetText(20)) +#define TXTLISTDIRHEADER (Program->Language->GetText(21)) +#define TXTLISTDIRTFILE (Program->Language->GetText(22)) +#define TXTLISTDIRTDIR (Program->Language->GetText(23)) +#define TXTLISTDIRTUNKNOWN (Program->Language->GetText(24)) +#define TXTMEMBLOCKS (Program->Language->GetText(25)) +#define TXTMEMSIZE (Program->Language->GetText(26)) +#define TXTMEMMAXSIZE (Program->Language->GetText(27)) +#define HELPNOHELP (Program->Language->GetText(28)) +#define HELPSYNTAX (Program->Language->GetText(29)) +#define HELPUERROR (Program->Language->GetText(30)) +#define HELPVARNDEF (Program->Language->GetText(31)) +#define HELPFUNNDEF (Program->Language->GetText(32)) +#define HELPFUNRDEF (Program->Language->GetText(33)) +#define HELPPNUMERA (Program->Language->GetText(34)) +#define HELPPDIGITS (Program->Language->GetText(35)) +#define HELPINPUSHOW (Program->Language->GetText(36)) +#define HELPOUTPSHOW (Program->Language->GetText(37)) +#define HELPINPUSETT (Program->Language->GetText(38)) +#define HELPOUTPSETT (Program->Language->GetText(39)) +#define HELPDIGISETT (Program->Language->GetText(40)) +#define HELPDIGISHOW (Program->Language->GetText(41)) +#define HELPVARSNDEF (Program->Language->GetText(42)) +#define HELPFUNCNDEF (Program->Language->GetText(43)) +#define HELPLOADSUCC (Program->Language->GetText(44)) +#define HELPSAVESUCC (Program->Language->GetText(45)) +#define HELPSAVEFAIL (Program->Language->GetText(46)) +#define HELPSAVENOTH (Program->Language->GetText(47)) +#define HELPPREFLOAD (Program->Language->GetText(48)) +#define HELPPREFNOLO (Program->Language->GetText(49)) +#define HELPPREFSAVE (Program->Language->GetText(50)) +#define HELPPREFNOSA (Program->Language->GetText(51)) +#define MSGNODIR (Program->Language->GetText(52)) +#define MSGNOFILE (Program->Language->GetText(53)) static const textdef textdefs[] = { - {0, "#NORMALTEXT##BOLD##STARTMSG##NEWLINE##NORMALTEXT##COLOR02#Type help to show info.#NEWLINE#"}, /* INTROMSG */ - {1, "Type Name#NEWLINE#-----------------------------------------------#NEWLINE#"}, /* TXTLISTDIRHEADER */ - {2, "[file]"}, /* TXTLISTDIRTFILE */ - {3, "[dir]"}, /* TXTLISTDIRTDIR */ - {4, "[unknown]"}, /* TXTLISTDIRTUNKNOWN */ - {5, "Allocated blocks:#SPACE#"}, /* TXTMEMBLOCKS */ - {6, "Memory usage: #SPACE#"}, /* TXTMEMSIZE */ - {7, "Maximum usage: #SPACE#"}, /* TXTMEMMAXSIZE */ - {8, "No help is available for this topic.#NEWLINE#"}, /* HELPNOHELP */ - {9, "Syntax error:#SPACE#"}, /* HELPSYNTAX */ - {10, "Unexpected error:#SPACE#"}, /* HELPUERROR */ - {11, "Variable is not defined:#SPACE#"}, /* HELPVARNDEF */ - {12, "Function is not defined:#SPACE#"}, /* HELPFUNNDEF */ - {13, "Function cannot be redefined:#SPACE#"}, /* HELPFUNRDEF */ - {14, "Base value must be between 2 and 32:#SPACE#"}, /* HELPPNUMERA */ - {15, "Number of digist must be between 0 and 15:#SPACE#"}, /* HELPPDIGITS */ - {16, "Numeral input system is#SPACE#"}, /* HELPINPUSHOW */ - {17, "Numeral output system is#SPACE#"}, /* HELPOUTPSHOW */ - {18, "Input changed to#SPACE#"}, /* HELPINPUSETT */ - {19, "Output changed to#SPACE#"}, /* HELPOUTPSETT */ - {20, "Number of digits changed to#SPACE#"}, /* HELPDIGISETT */ - {21, "Number of digits shown are#SPACE#"}, /* HELPDIGISHOW */ - {22, "No variables are defined.#NEWLINE#"}, /* HELPVARSNDEF */ - {23, "No functions are defined.#NEWLINE#"}, /* HELPFUNCNDEF */ - {24, "Variable and functions loaded from file.#NEWLINE#"}, /* HELPLOADSUCC */ - {25, "Variable and functions saved to file.#NEWLINE#"}, /* HELPSAVESUCC */ - {26, "Cannot save to file.#NEWLINE#"}, /* HELPSAVEFAIL */ - {27, "Nothing to save.#NEWLINE#"}, /* HELPSAVENOTH */ - {28, "Preferences loaded.#NEWLINE#"}, /* HELPPREFLOAD */ - {29, "Preferences could not be loaded.#NEWLINE#"}, /* HELPPREFNOLO */ - {30, "Preferences saved to disk.#NEWLINE#"}, /* HELPPREFSAVE */ - {31, "Preferences could not be saved.#NEWLINE#"}, /* HELPPREFNOSA */ - {32, "Could not open directory:#SPACE#"}, /* MSGNODIR */ - {33, "Cannot open file.#NEWLINE#"}, /* MSGNOFILE */ - {-1, EMPTYSTRING} + { 0, "#NORMALTEXT##BOLD##STARTMSG##NEWLINE##NORMALTEXT##COLOR02#Type help to show info.#NEWLINE#" }, /* INTROMSG */ + { 1, "---------------------------------------------------------#NEWLINE#" }, /* STATEMENTLINE */ + { 2, "clear Clear console window.#NEWLINE#" }, /* STATEMENTCLEAR */ + { 3, "def Define function.#NEWLINE#" }, /* STATEMENTDEF */ + { 4, "delete Delete variable or function.#NEWLINE#" }, /* STATEMENTDELETE */ + { 5, "digits Set number of significant digits.#NEWLINE#" }, /* STATEMENTDIGITS */ + { 6, "eval Evaluate arithmetic expression.#NEWLINE#" }, /* STATEMENTEVAL */ + { 7, "execute Execute statements in a file.#NEWLINE#" }, /* STATEMENTEXECUTE */ + { 8, "functions Show list of user defined functions.#NEWLINE#" }, /* STATEMENTFUNCS */ + { 9, "input Change numeral input system.#NEWLINE#" }, /* STATEMENTINPUT */ + { 10, "help Show basic help text.#NEWLINE#" }, /* STATEMENTHELP */ + { 11, "output Change numeral output system.#NEWLINE#" }, /* STATEMENTOUTPUT */ + { 12, "list Show content of a directory.#NEWLINE#" }, /* STATEMENTLIST */ + { 13, "show Show content of a file.#NEWLINE#" }, /* STATEMENTSHOW */ + { 14, "load Load variable and functions from file.#NEWLINE#" }, /* STATEMENTLOAD */ + { 15, "save Save variable and functions to file.#NEWLINE#" }, /* STATEMENTSAVE */ + { 16, "variables Show list of variables.#NEWLINE#" }, /* STATEMENTVARS */ + { 17, "version Show version string.#NEWLINE#" }, /* STATEMENTVERSION */ + { 18, "memory Show internal memory usage.#NEWLINE#" }, /* STATEMENTMEMORY */ + { 19, "exit Exit program.#NEWLINE#" }, /* STATEMENTEXIT */ + { 20, "The def and eval statements are optional. Functions and#NEWLINE#variables statements can be shorten to funcs and vars.#NEWLINE#" }, /* STATEMENTFOOTER */ + { 21, "Type Name#NEWLINE#-----------------------------------------------#NEWLINE#" }, /* TXTLISTDIRHEADER */ + { 22, "[file]" }, /* TXTLISTDIRTFILE */ + { 23, "[dir]" }, /* TXTLISTDIRTDIR */ + { 24, "[unknown]" }, /* TXTLISTDIRTUNKNOWN */ + { 25, "Allocated blocks:#SPACE#" }, /* TXTMEMBLOCKS */ + { 26, "Memory usage: #SPACE#" }, /* TXTMEMSIZE */ + { 27, "Maximum usage: #SPACE#" }, /* TXTMEMMAXSIZE */ + { 28, "No help is available for this topic.#NEWLINE#" }, /* HELPNOHELP */ + { 29, "Syntax error:#SPACE#" }, /* HELPSYNTAX */ + { 30, "Unexpected error:#SPACE#" }, /* HELPUERROR */ + { 31, "Variable is not defined:#SPACE#" }, /* HELPVARNDEF */ + { 32, "Function is not defined:#SPACE#" }, /* HELPFUNNDEF */ + { 33, "Function cannot be redefined:#SPACE#" }, /* HELPFUNRDEF */ + { 34, "Base value must be between 2 and 32:#SPACE#" }, /* HELPPNUMERA */ + { 35, "Number of digist must be between 0 and 15:#SPACE#" }, /* HELPPDIGITS */ + { 36, "Numeral input system is#SPACE#" }, /* HELPINPUSHOW */ + { 37, "Numeral output system is#SPACE#" }, /* HELPOUTPSHOW */ + { 38, "Input changed to#SPACE#" }, /* HELPINPUSETT */ + { 39, "Output changed to#SPACE#" }, /* HELPOUTPSETT */ + { 40, "Number of digits changed to#SPACE#" }, /* HELPDIGISETT */ + { 41, "Number of digits shown are#SPACE#" }, /* HELPDIGISHOW */ + { 42, "No variables are defined.#NEWLINE#" }, /* HELPVARSNDEF */ + { 43, "No functions are defined.#NEWLINE#" }, /* HELPFUNCNDEF */ + { 44, "Variable and functions loaded from file.#NEWLINE#" }, /* HELPLOADSUCC */ + { 45, "Variable and functions saved to file.#NEWLINE#" }, /* HELPSAVESUCC */ + { 46, "Cannot save to file.#NEWLINE#" }, /* HELPSAVEFAIL */ + { 47, "Nothing to save.#NEWLINE#" }, /* HELPSAVENOTH */ + { 48, "Preferences loaded.#NEWLINE#" }, /* HELPPREFLOAD */ + { 49, "Preferences could not be loaded.#NEWLINE#" }, /* HELPPREFNOLO */ + { 50, "Preferences saved to disk.#NEWLINE#" }, /* HELPPREFSAVE */ + { 51, "Preferences could not be saved.#NEWLINE#" }, /* HELPPREFNOSA */ + { 52, "Could not open directory:#SPACE#" }, /* MSGNODIR */ + { 53, "Cannot open file.#NEWLINE#" }, /* MSGNOFILE */ + { -1, EMPTYSTRING } }; #endif diff --git a/src/main.h b/src/main.h index 7da4d062..ed701a1d 100644 --- a/src/main.h +++ b/src/main.h @@ -105,75 +105,94 @@ \subsection command_stat Statements \verbatim - clear Clear console window. - def Define function. - delete Delete variable or function. - digits Set number of significant digits. - eval Evaluate arithmetic expression. - execute Execute statements in a file. - functions Show list of user defined functions. - input Change numeral input system (experimental). - help Show basic help text. - output Change numeral output system (experimental). - list Show content of a directory. - show Show content of a file. - load Load variable and functions from file. - save Save variable and functions to file. - variables Show list of variables. - version Show version string. - memory Show internal memory usage. - exit Exit program. + clear Clear console window + def Define function + delete Delete variable or function + digits Set number of significant digits + eval Evaluate arithmetic expression + execute Execute statements in a file + functions Show list of user defined functions + input Change numeral input system + help Show basic help text + output Change numeral output system + list Show content of a directory + show Show content of a file + load Load variable and functions from file + save Save variable and functions to file + variables Show list of variables + version Show version string + memory Show internal memory usage + exit Exit program \endverbatim \subsection command_func Base functions \verbatim - abs Absolute value of number. - sgn Mathematical signum function. - round Round to nearest integer number. - trunc Discard fraction part of number. - floor Mathematical floor function. - ceil Mathematical ceiling function. - sqrt Square root function (exp 1/2). - cbrt Cube root function (exp 1/3). - lb Binary logarithm function (base 2). - ln Natural logarithm function (base e). - lg Common logarithm function (base 10). + abs Absolute value of number + sgn Mathematical signum function + round Round to nearest integer number + trunc Discard fraction part of number + floor Mathematical floor function + ceil Mathematical ceiling function + sqrt Square root function (exp 1/2) + cbrt Cube root function (exp 1/3) + lb Binary logarithm function (base 2) + ln Natural logarithm function (base e) + lg Common logarithm function (base 10) \endverbatim \subsection command_trig Trigonometric functions \verbatim - sin Trigonometric sine function. - cos Trigonometric cosine function. - tan Trigonometric tangent function. - cot Trigonometric cotangent function. - sec Trigonometric secant function. - csc Trigonometric cosecant function. - arcsin Inverse trigonometric sine function. - arccos Inverse trigonometric cosine function. - arctan Inverse trigonometric tangent function. - arccot Inverse trigonometric cotangent function. - arcsec Inverse trigonometric secant function. - arccsc Inverse trigonometric cosecant function. + sin Trigonometric sine function + cos Trigonometric cosine function + tan Trigonometric tangent function + cot Trigonometric cotangent function + sec Trigonometric secant function + csc Trigonometric cosecant function + arcsin Inverse trigonometric sine function + arccos Inverse trigonometric cosine function + arctan Inverse trigonometric tangent function + arccot Inverse trigonometric cotangent function + arcsec Inverse trigonometric secant function + arccsc Inverse trigonometric cosecant function \endverbatim \subsection command_hype Hyperbolic functions \verbatim - sinh Hyperbolic sine function. - cosh Hyperbolic cosine function. - tanh Hyperbolic tangent function. - coth Hyperbolic cotangent function. - sech Hyperbolic secant function. - csch Hyperbolic cosecant function. - arcsinh Inverse hyperbolic sine function. - arccosh Inverse hyperbolic cosine function. - arctanh Inverse hyperbolic tangent function. - arccoth Inverse hyperbolic cotangent function. - arcsech Inverse hyperbolic secant function. - arccsch Inverse hyperbolic cosecant function. + sinh Hyperbolic sine function + cosh Hyperbolic cosine function + tanh Hyperbolic tangent function + coth Hyperbolic cotangent function + sech Hyperbolic secant function + csch Hyperbolic cosecant function + arcsinh Inverse hyperbolic sine function + arccosh Inverse hyperbolic cosine function + arctanh Inverse hyperbolic tangent function + arccoth Inverse hyperbolic cotangent function + arcsech Inverse hyperbolic secant function + arccsch Inverse hyperbolic cosecant function + \endverbatim + \subsection command_earl Early trigonometric functions + \verbatim + ver Versed sine function + vcs Versed cosine function + cvs Coversed sine function + cvc Coversed cosine function + hv Haversed sine function + hvc Haversed cosine function + hcv Hacoversed sine function + hcc Hacoversed cosine function + arcver Inverse versed sine function + arcvcs Inverse versed cosine function + arccvs Inverse coversed sine function + arccvc Inverse coversed cosine function + archv Inverse haversed sine function + archvc Inverse haversed cosine function + archcv Inverse hacoversed sine function + archcc Inverse hacoversed cosine function \endverbatim \subsection command_vars Variables and constant \verbatim - pi Trigonometric constant. - e Euler's number. - i Imaginary unit. - ins Result of last calculation. + pi Trigonometric constant + e Euler's number + i Imaginary unit + ins Result of last calculation \endverbatim \subsection command_exfunc Example script \verbatim @@ -250,7 +269,7 @@ \page release_page Release history \section release_sec Release history - \subsection version170 v1.7.0 February 28 2017 + \subsection version170 v1.7.0 March 12 2017 - Introduce scientific notation. - Introduce Not a Number (NaN). - Fixed bugs related to infinity (Inf). diff --git a/src/main/Makefile b/src/main/Makefile index d17559fb..04b78107 100644 --- a/src/main/Makefile +++ b/src/main/Makefile @@ -13,9 +13,6 @@ evaluator.o: evaluator.cpp functionlist.o: functionlist.cpp ${CXX} ${CXXFLAGS} -c functionlist.cpp -functions.o: functions.cpp - ${CXX} ${CXXFLAGS} -c functions.cpp - fgrid.o: fgrid.cpp ${CXX} ${CXXFLAGS} -c fgrid.cpp @@ -46,10 +43,10 @@ values.o: values.cpp viewer.o: viewer.cpp ${CXX} ${CXXFLAGS} -c viewer.cpp -lib: evaluator.o functionlist.o functions.o fgrid.o lexer.o nodes.o operators.o optimizer.o parser.o token.o userfunction.o values.o viewer.o - ${AR} rcs libappmain.a evaluator.o functionlist.o functions.o fgrid.o lexer.o nodes.o operators.o optimizer.o parser.o token.o userfunction.o values.o viewer.o +lib: evaluator.o functionlist.o fgrid.o lexer.o nodes.o operators.o optimizer.o parser.o token.o userfunction.o values.o viewer.o + ${AR} rcs libappmain.a evaluator.o functionlist.o fgrid.o lexer.o nodes.o operators.o optimizer.o parser.o token.o userfunction.o values.o viewer.o ${RANLIB} libappmain.a clean: - ${DEL} libappmain.a evaluator.o functionlist.o functions.o fgrid.o lexer.o nodes.o operators.o optimizer.o parser.o token.o userfunction.o values.o viewer.o + ${DEL} libappmain.a evaluator.o functionlist.o fgrid.o lexer.o nodes.o operators.o optimizer.o parser.o token.o userfunction.o values.o viewer.o diff --git a/src/main/evaluator.cpp b/src/main/evaluator.cpp index e6aec277..319cb59e 100644 --- a/src/main/evaluator.cpp +++ b/src/main/evaluator.cpp @@ -28,7 +28,6 @@ */ #include "amath.h" -#include "amathc.h" #include "parser.h" #include "viewer.h" #include "optimizer.h" diff --git a/src/main/fgrid.cpp b/src/main/fgrid.cpp index 282794f5..f31f2071 100644 --- a/src/main/fgrid.cpp +++ b/src/main/fgrid.cpp @@ -28,7 +28,6 @@ */ #include "fgrid.h" -#include "functions.h" #include "lib/real.h" Grid::Grid(UserFunction* function) : diff --git a/src/main/function/Makefile b/src/main/function/Makefile index 4e2a7a98..8048fd74 100644 --- a/src/main/function/Makefile +++ b/src/main/function/Makefile @@ -34,6 +34,30 @@ arccotangent.o: arccotangent.cpp arcsecant.o: arcsecant.cpp ${CXX} ${CXXFLAGS} -c arcsecant.cpp +arccovercosine.o: arccovercosine.cpp + ${CXX} ${CXXFLAGS} -c arccovercosine.cpp + +arccoversine.o: arccoversine.cpp + ${CXX} ${CXXFLAGS} -c arccoversine.cpp + +archacovercosine.o: archacovercosine.cpp + ${CXX} ${CXXFLAGS} -c archacovercosine.cpp + +archacoversine.o: archacoversine.cpp + ${CXX} ${CXXFLAGS} -c archacoversine.cpp + +archavercosine.o: archavercosine.cpp + ${CXX} ${CXXFLAGS} -c archavercosine.cpp + +archaversine.o: archaversine.cpp + ${CXX} ${CXXFLAGS} -c archaversine.cpp + +arcvercosine.o: arcvercosine.cpp + ${CXX} ${CXXFLAGS} -c arcvercosine.cpp + +arcversine.o: arcversine.cpp + ${CXX} ${CXXFLAGS} -c arcversine.cpp + ceil.o: ceil.cpp ${CXX} ${CXXFLAGS} -c ceil.cpp @@ -76,6 +100,42 @@ havercos.o: havercos.cpp haversin.o: haversin.cpp ${CXX} ${CXXFLAGS} -c haversin.cpp +hyparccosecant.o: hyparccosecant.cpp + ${CXX} ${CXXFLAGS} -c hyparccosecant.cpp + +hyparccosine.o: hyparccosine.cpp + ${CXX} ${CXXFLAGS} -c hyparccosine.cpp + +hyparccotangent.o: hyparccotangent.cpp + ${CXX} ${CXXFLAGS} -c hyparccotangent.cpp + +hyparcsecant.o: hyparcsecant.cpp + ${CXX} ${CXXFLAGS} -c hyparcsecant.cpp + +hyparcsine.o: hyparcsine.cpp + ${CXX} ${CXXFLAGS} -c hyparcsine.cpp + +hyparctangent.o: hyparctangent.cpp + ${CXX} ${CXXFLAGS} -c hyparctangent.cpp + +hypcosecant.o: hypcosecant.cpp + ${CXX} ${CXXFLAGS} -c hypcosecant.cpp + +hypcosine.o: hypcosine.cpp + ${CXX} ${CXXFLAGS} -c hypcosine.cpp + +hypcotangent.o: hypcotangent.cpp + ${CXX} ${CXXFLAGS} -c hypcotangent.cpp + +hypsecant.o: hypsecant.cpp + ${CXX} ${CXXFLAGS} -c hypsecant.cpp + +hypsine.o: hypsine.cpp + ${CXX} ${CXXFLAGS} -c hypsine.cpp + +hyptangent.o: hyptangent.cpp + ${CXX} ${CXXFLAGS} -c hyptangent.cpp + ln.o: ln.cpp ${CXX} ${CXXFLAGS} -c ln.cpp @@ -118,10 +178,10 @@ vercos.o: vercos.cpp versin.o: versin.cpp ${CXX} ${CXXFLAGS} -c versin.cpp -lib: absolute.o aexcosecant.o aexsecant.o arccos.o arcsin.o arctan.o arccosecant.o arccotangent.o arcsecant.o ceil.o cosecant.o cosine.o cotangent.o covercos.o coversin.o cube.o excosecant.o exsecant.o floor.o hacovercos.o hacoversin.o havercos.o haversin.o ln.o log10.o log2.o node.o round.o secant.o signum.o sine.o square.o tangent.o trunc.o user.o vercos.o versin.o - ${AR} rcs libfunctions.a absolute.o aexcosecant.o aexsecant.o arccos.o arcsin.o arctan.o arccosecant.o arccotangent.o arcsecant.o ceil.o cosecant.o cosine.o cotangent.o covercos.o coversin.o cube.o excosecant.o exsecant.o floor.o hacovercos.o hacoversin.o havercos.o haversin.o ln.o log10.o log2.o node.o round.o secant.o signum.o sine.o square.o tangent.o trunc.o user.o vercos.o versin.o +lib: absolute.o aexcosecant.o aexsecant.o arccos.o arcsin.o arctan.o arccosecant.o arccotangent.o arcsecant.o arccovercosine.o arccoversine.o archacovercosine.o archacoversine.o archavercosine.o archaversine.o arcvercosine.o arcversine.o ceil.o cosecant.o cosine.o cotangent.o covercos.o coversin.o cube.o excosecant.o exsecant.o floor.o hacovercos.o hacoversin.o havercos.o haversin.o hyparccosecant.o hyparccosine.o hyparccotangent.o hyparcsecant.o hyparcsine.o hyparctangent.o hypcosecant.o hypcosine.o hypcotangent.o hypsecant.o hypsine.o hyptangent.o ln.o log10.o log2.o node.o round.o secant.o signum.o sine.o square.o tangent.o trunc.o user.o vercos.o versin.o + ${AR} rcs libfunctions.a absolute.o aexcosecant.o aexsecant.o arccos.o arcsin.o arctan.o arccosecant.o arccotangent.o arcsecant.o arccovercosine.o arccoversine.o archacovercosine.o archacoversine.o archavercosine.o archaversine.o arcvercosine.o arcversine.o ceil.o cosecant.o cosine.o cotangent.o covercos.o coversin.o cube.o excosecant.o exsecant.o floor.o hacovercos.o hacoversin.o havercos.o haversin.o hyparccosecant.o hyparccosine.o hyparccotangent.o hyparcsecant.o hyparcsine.o hyparctangent.o hypcosecant.o hypcosine.o hypcotangent.o hypsecant.o hypsine.o hyptangent.o ln.o log10.o log2.o node.o round.o secant.o signum.o sine.o square.o tangent.o trunc.o user.o vercos.o versin.o ${RANLIB} libfunctions.a clean: - ${DEL} libfunctions.a absolute.o aexcosecant.o aexsecant.o arccos.o arcsin.o arctan.o arccosecant.o arccotangent.o arcsecant.o ceil.o cosecant.o cosine.o cotangent.o covercos.o coversin.o cube.o excosecant.o exsecant.o floor.o hacovercos.o hacoversin.o havercos.o haversin.o ln.o log10.o log2.o node.o round.o secant.o signum.o sine.o square.o tangent.o trunc.o user.o vercos.o versin.o + ${DEL} libfunctions.a absolute.o aexcosecant.o aexsecant.o arccos.o arcsin.o arctan.o arccosecant.o arccotangent.o arcsecant.o arccovercosine.o arccoversine.o archacovercosine.o archacoversine.o archavercosine.o archaversine.o arcvercosine.o arcversine.o ceil.o cosecant.o cosine.o cotangent.o covercos.o coversin.o cube.o excosecant.o exsecant.o floor.o hacovercos.o hacoversin.o havercos.o haversin.o hyparccosecant.o hyparccosine.o hyparccotangent.o hyparcsecant.o hyparcsine.o hyparctangent.o hypcosecant.o hypcosine.o hypcotangent.o hypsecant.o hypsine.o hyptangent.o ln.o log10.o log2.o node.o round.o secant.o signum.o sine.o square.o tangent.o trunc.o user.o vercos.o versin.o diff --git a/src/main/function/aexcosecant.cpp b/src/main/function/aexcosecant.cpp index d6300050..6d598465 100644 --- a/src/main/function/aexcosecant.cpp +++ b/src/main/function/aexcosecant.cpp @@ -42,5 +42,5 @@ FunctionNode* ArcExcosecantNode::Create(ExpressionNode* expression, char* text, Number* ArcExcosecantNode::Evaluate() { result = expression->Evaluate()->ArcExCosecant(); - return result; + return result; } diff --git a/src/main/function/aexcosecant.h b/src/main/function/aexcosecant.h index aeb96331..0f660f77 100644 --- a/src/main/function/aexcosecant.h +++ b/src/main/function/aexcosecant.h @@ -33,7 +33,7 @@ #include "node.h" /** - * @brief A inverse excosecant function in a syntax tree. + * @brief An inverse excosecant function in a syntax tree. * @details * More info on the excosecant function is available at [Wikipedia]: * https://wikipedia.org/wiki/Excosecant diff --git a/src/main/function/aexsecant.cpp b/src/main/function/aexsecant.cpp index 068fbbc0..7d1327a7 100644 --- a/src/main/function/aexsecant.cpp +++ b/src/main/function/aexsecant.cpp @@ -31,16 +31,16 @@ ArcExsecantNode::ArcExsecantNode(ExpressionNode* expression, char* text, char* sys) : FunctionNode(expression, text, sys) -{ +{ } FunctionNode* ArcExsecantNode::Create(ExpressionNode* expression, char* text, char* sys) { - return new ArcExsecantNode(expression, text, sys); + return new ArcExsecantNode(expression, text, sys); } Number* ArcExsecantNode::Evaluate() { result = expression->Evaluate()->ArcExSecant(); - return result; + return result; } diff --git a/src/main/function/aexsecant.h b/src/main/function/aexsecant.h index 4701db66..14841b3f 100644 --- a/src/main/function/aexsecant.h +++ b/src/main/function/aexsecant.h @@ -33,7 +33,7 @@ #include "node.h" /** - * @brief A inverse exsecant function in a syntax tree. + * @brief An inverse exsecant function in a syntax tree. * @details * More info on the exsecant function is available at [Wikipedia]: * https://wikipedia.org/wiki/Exsecant diff --git a/src/main/function/arccovercosine.cpp b/src/main/function/arccovercosine.cpp new file mode 100644 index 00000000..88f625a9 --- /dev/null +++ b/src/main/function/arccovercosine.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "arccovercosine.h" + +ArcCoversedCosineNode::ArcCoversedCosineNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* ArcCoversedCosineNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new ArcCoversedCosineNode(expression, text, sys); +} + +Number* ArcCoversedCosineNode::Evaluate() +{ + result = expression->Evaluate()->ArcCoVerCosine(); + return result; +} diff --git a/src/system/graph.h b/src/main/function/arccovercosine.h similarity index 71% rename from src/system/graph.h rename to src/main/function/arccovercosine.h index e421a9a6..e7967fc0 100644 --- a/src/system/graph.h +++ b/src/main/function/arccovercosine.h @@ -27,40 +27,24 @@ * */ -#ifndef AMATH_GRAPH_WINDOW_H -#define AMATH_GRAPH_WINDOW_H +#ifndef AMATH_FUNCTION_ARCCOVERSEDCOSINE_H +#define AMATH_FUNCTION_ARCCOVERSEDCOSINE_H + +#include "node.h" /** - * @file graph.h - * @brief Logic related to graph of functions. + * @brief An inverse coversed cosine function in a syntax tree. + * @details + * More info on the coversed cosine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Covercosine * */ - -#if 0 - -#include "clib.h" -#include "lib/fgrid.h" -#include "main/functions.h" - -class GraphList; - -class GraphWindow +class ArcCoversedCosineNode : public FunctionNode { public: - GraphWindow(); - virtual ~GraphWindow(); - virtual void OpenGraphWindow(UserFunction* function) = 0; - virtual void CloseGraphWindow() = 0; - virtual void DrawGraph(UserFunction* function) = 0; - -protected: - virtual void DrawAxis() = 0; - GraphWindow* next; - Grid* grid; - - friend class GraphList; + explicit ArcCoversedCosineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); }; #endif - -#endif \ No newline at end of file diff --git a/src/main/function/arccoversine.cpp b/src/main/function/arccoversine.cpp new file mode 100644 index 00000000..cecdc5c5 --- /dev/null +++ b/src/main/function/arccoversine.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "arccoversine.h" + +ArcCoversedSineNode::ArcCoversedSineNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* ArcCoversedSineNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new ArcCoversedSineNode(expression, text, sys); +} + +Number* ArcCoversedSineNode::Evaluate() +{ + result = expression->Evaluate()->ArcCoVerSine(); + return result; +} diff --git a/src/main/function/arccoversine.h b/src/main/function/arccoversine.h new file mode 100644 index 00000000..1591f908 --- /dev/null +++ b/src/main/function/arccoversine.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_ARCCOVERSEDSINE_H +#define AMATH_FUNCTION_ARCCOVERSEDSINE_H + +#include "node.h" + +/** + * @brief An inverse coversed sine function in a syntax tree. + * @details + * More info on the coversed sine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Coversine + * + */ +class ArcCoversedSineNode : public FunctionNode +{ +public: + explicit ArcCoversedSineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/archacovercosine.cpp b/src/main/function/archacovercosine.cpp new file mode 100644 index 00000000..1f1faa7c --- /dev/null +++ b/src/main/function/archacovercosine.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "archacovercosine.h" + +ArcHaCoversedCosineNode::ArcHaCoversedCosineNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* ArcHaCoversedCosineNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new ArcHaCoversedCosineNode(expression, text, sys); +} + +Number* ArcHaCoversedCosineNode::Evaluate() +{ + result = expression->Evaluate()->ArcHaCoVerCosine(); + return result; +} diff --git a/src/main/function/archacovercosine.h b/src/main/function/archacovercosine.h new file mode 100644 index 00000000..cc01636b --- /dev/null +++ b/src/main/function/archacovercosine.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_ARCHACOVERSEDCOSINE_H +#define AMATH_FUNCTION_ARCHACOVERSEDCOSINE_H + +#include "node.h" + +/** + * @brief An inverse hacoversed cosine function in a syntax tree. + * @details + * More info on the hacoversed cosine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Hacovercosine + * + */ +class ArcHaCoversedCosineNode : public FunctionNode +{ +public: + explicit ArcHaCoversedCosineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/archacoversine.cpp b/src/main/function/archacoversine.cpp new file mode 100644 index 00000000..bfbfc6a5 --- /dev/null +++ b/src/main/function/archacoversine.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "archacoversine.h" + +ArcHaCoversedSineNode::ArcHaCoversedSineNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* ArcHaCoversedSineNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new ArcHaCoversedSineNode(expression, text, sys); +} + +Number* ArcHaCoversedSineNode::Evaluate() +{ + result = expression->Evaluate()->ArcHaCoVerSine(); + return result; +} diff --git a/src/real/matherr.c b/src/main/function/archacoversine.h similarity index 65% rename from src/real/matherr.c rename to src/main/function/archacoversine.h index 0be5550d..897160f6 100644 --- a/src/real/matherr.c +++ b/src/main/function/archacoversine.h @@ -1,6 +1,4 @@ -/* @(#)s_matherr.c 1.3 95/01/18 */ - -/* +/*- * Copyright (c) 2014-2017 Carsten Sonne Larsen * All rights reserved. * @@ -24,34 +22,29 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * The origin source code can be obtained from: - * http://www.netlib.org/fdlibm/s_matherr.c + * Project homepage: + * http://amath.innolan.net * */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. +#ifndef AMATH_FUNCTION_ArcHaCoversedSine_H +#define AMATH_FUNCTION_ArcHaCoversedSine_H + +#include "node.h" + +/** + * @brief An inverse hacoversed sine function in a syntax tree. + * @details + * More info on the hacoversed sine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Hacoversine * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== */ - -// NOTICE: Not a part of libamath yet - -#include "fdlibm.h" - -#ifdef __STDC__ -int matherr(struct exception *x) -#else -int matherr(x) -struct exception *x; -#endif +class ArcHaCoversedSineNode : public FunctionNode { - int n=0; - if(x->arg1!=x->arg1) return 0; - return n; -} +public: + explicit ArcHaCoversedSineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/archavercosine.cpp b/src/main/function/archavercosine.cpp new file mode 100644 index 00000000..856532d3 --- /dev/null +++ b/src/main/function/archavercosine.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "archavercosine.h" + +ArcHaVersedCosineNode::ArcHaVersedCosineNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* ArcHaVersedCosineNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new ArcHaVersedCosineNode(expression, text, sys); +} + +Number* ArcHaVersedCosineNode::Evaluate() +{ + result = expression->Evaluate()->ArcHaVerCosine(); + return result; +} diff --git a/src/main/function/archavercosine.h b/src/main/function/archavercosine.h new file mode 100644 index 00000000..fd3943be --- /dev/null +++ b/src/main/function/archavercosine.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_ARCHAVERSEDCOSINE_H +#define AMATH_FUNCTION_ARCHAVERSEDCOSINE_H + +#include "node.h" + +/** + * @brief An inverse haversed cosine function in a syntax tree. + * @details + * More info on the haversed cosine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Havercosine + * + */ +class ArcHaVersedCosineNode : public FunctionNode +{ +public: + explicit ArcHaVersedCosineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/archaversine.cpp b/src/main/function/archaversine.cpp new file mode 100644 index 00000000..79834766 --- /dev/null +++ b/src/main/function/archaversine.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "archaversine.h" + +ArcHaVersedSineNode::ArcHaVersedSineNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* ArcHaVersedSineNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new ArcHaVersedSineNode(expression, text, sys); +} + +Number* ArcHaVersedSineNode::Evaluate() +{ + result = expression->Evaluate()->ArcHaVerSine(); + return result; +} diff --git a/src/main/function/archaversine.h b/src/main/function/archaversine.h new file mode 100644 index 00000000..12f0b806 --- /dev/null +++ b/src/main/function/archaversine.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_ARCHAVERSEDSINE_H +#define AMATH_FUNCTION_ARCHAVERSEDSINE_H + +#include "node.h" + +/** + * @brief An inverse haversed sine function in a syntax tree. + * @details + * More info on the haversed sine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Haversine + * + */ +class ArcHaVersedSineNode : public FunctionNode +{ +public: + explicit ArcHaVersedSineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/arcvercosine.cpp b/src/main/function/arcvercosine.cpp new file mode 100644 index 00000000..18a288ae --- /dev/null +++ b/src/main/function/arcvercosine.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "arcvercosine.h" + +ArcVersedCosineNode::ArcVersedCosineNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* ArcVersedCosineNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new ArcVersedCosineNode(expression, text, sys); +} + +Number* ArcVersedCosineNode::Evaluate() +{ + result = expression->Evaluate()->ArcVerCosine(); + return result; +} diff --git a/src/main/function/arcvercosine.h b/src/main/function/arcvercosine.h new file mode 100644 index 00000000..eea824dc --- /dev/null +++ b/src/main/function/arcvercosine.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_ARCVERSEDCOSINE_H +#define AMATH_FUNCTION_ARCVERSEDCOSINE_H + +#include "node.h" + +/** + * @brief An inverse versed cosine function in a syntax tree. + * @details + * More info on the versed cosine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Vercosine + * + */ +class ArcVersedCosineNode : public FunctionNode +{ +public: + explicit ArcVersedCosineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/system/graph_gtk.h b/src/main/function/arcversine.cpp similarity index 76% rename from src/system/graph_gtk.h rename to src/main/function/arcversine.cpp index 428b030e..bd2fe38f 100644 --- a/src/system/graph_gtk.h +++ b/src/main/function/arcversine.cpp @@ -27,25 +27,20 @@ * */ -/** - * @file ggraph.h - * @brief Gtk specific graph window. - * - */ +#include "arcversine.h" -#ifdef GTK -#include "fgrid.h" -#include "functions.h" +ArcVersedSineNode::ArcVersedSineNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} -class GtkGraphWindow { -public: - GtkGraphWindow(UserFunction* function); - ~GtkGraphWindow(); +FunctionNode* ArcVersedSineNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new ArcVersedSineNode(expression, text, sys); +} - void DrawGraph(); - -private: - UserFunction* function; - Grid *grid; -}; -#endif +Number* ArcVersedSineNode::Evaluate() +{ + result = expression->Evaluate()->ArcVerSine(); + return result; +} diff --git a/src/main/function/arcversine.h b/src/main/function/arcversine.h new file mode 100644 index 00000000..18c571e8 --- /dev/null +++ b/src/main/function/arcversine.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_ARCVERSEDSINE_H +#define AMATH_FUNCTION_ARCVERSEDSINE_H + +#include "node.h" + +/** + * @brief An inverse versed sine function in a syntax tree. + * @details + * More info on the versed sine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Versine + * + */ +class ArcVersedSineNode : public FunctionNode +{ +public: + explicit ArcVersedSineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/cosecant.cpp b/src/main/function/cosecant.cpp index 2bb142da..02936d42 100644 --- a/src/main/function/cosecant.cpp +++ b/src/main/function/cosecant.cpp @@ -44,4 +44,3 @@ Number* CosecantNode::Evaluate() result = expression->Evaluate()->Cosecant(); return result; } - \ No newline at end of file diff --git a/src/main/function/defs.h b/src/main/function/defs.h index 3d8d8efd..737d6660 100644 --- a/src/main/function/defs.h +++ b/src/main/function/defs.h @@ -42,6 +42,14 @@ #include "arccosecant.h" #include "arccotangent.h" #include "arcsecant.h" +#include "arccovercosine.h" +#include "arccoversine.h" +#include "archacovercosine.h" +#include "archacoversine.h" +#include "archavercosine.h" +#include "archaversine.h" +#include "arcvercosine.h" +#include "arcversine.h" #include "ceil.h" #include "cosecant.h" #include "cosine.h" @@ -56,6 +64,18 @@ #include "hacoversin.h" #include "havercos.h" #include "haversin.h" +#include "hyparccosecant.h" +#include "hyparccosine.h" +#include "hyparccotangent.h" +#include "hyparcsecant.h" +#include "hyparcsine.h" +#include "hyparctangent.h" +#include "hypcosecant.h" +#include "hypcosine.h" +#include "hypcotangent.h" +#include "hypsecant.h" +#include "hypsine.h" +#include "hyptangent.h" #include "ln.h" #include "log2.h" #include "log10.h" @@ -70,10 +90,9 @@ #include "versin.h" #include "main/nodes.h" -#include "main/functions.h" class FunctionNode; -typedef FunctionNode* (*CreateFunctionNode)(ExpressionNode*,char*,char*); +typedef FunctionNode* (*CreateFunctionNode)(ExpressionNode*, char*, char*); /** * @brief Function definitions of known mathematical functions. @@ -132,7 +151,15 @@ static const functiondef functiondefs[] = { {"hv", HaVersedSineNode::Create}, {"hvc", HaVersedCosineNode::Create}, {"hcv", HaCoversedSineNode::Create}, - {"hcc", HaCoversedCosineNode::Create} + {"hcc", HaCoversedCosineNode::Create}, + {"aver", ArcVersedSineNode::Create}, + {"avcs", ArcVersedCosineNode::Create}, + {"acvs", ArcCoversedSineNode::Create}, + {"acvc", ArcCoversedCosineNode::Create}, + {"ahv", ArcHaVersedSineNode::Create}, + {"ahvc", ArcHaVersedCosineNode::Create}, + {"ahcv", ArcHaCoversedSineNode::Create}, + {"ahcc", ArcHaCoversedCosineNode::Create} }; #endif diff --git a/src/main/function/excosecant.cpp b/src/main/function/excosecant.cpp index 8a5b0777..9fdc91fd 100644 --- a/src/main/function/excosecant.cpp +++ b/src/main/function/excosecant.cpp @@ -31,7 +31,7 @@ ExcosecantNode::ExcosecantNode(ExpressionNode* expression, char* text, char* sys) : FunctionNode(expression, text, sys) -{ +{ } FunctionNode* ExcosecantNode::Create(ExpressionNode* expression, char* text, char* sys) @@ -42,6 +42,5 @@ FunctionNode* ExcosecantNode::Create(ExpressionNode* expression, char* text, cha Number* ExcosecantNode::Evaluate() { result = expression->Evaluate()->ExCosecant(); - return result; + return result; } - \ No newline at end of file diff --git a/src/main/function/functions.vcxproj b/src/main/function/functions.vcxproj new file mode 100644 index 00000000..75377a9e --- /dev/null +++ b/src/main/function/functions.vcxproj @@ -0,0 +1,224 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {AD6E3CD6-48C4-47D9-94F5-565EE3AF7485} + Win32Proj + + + + StaticLibrary + true + v141 + + + StaticLibrary + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + $(ProjectDir)../..;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Windows + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + $(ProjectDir)../..;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/function/functions.vcxproj.filters b/src/main/function/functions.vcxproj.filters new file mode 100644 index 00000000..af84dadd --- /dev/null +++ b/src/main/function/functions.vcxproj.filters @@ -0,0 +1,366 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/main/function/hyparccosecant.cpp b/src/main/function/hyparccosecant.cpp new file mode 100644 index 00000000..0f7e0fd0 --- /dev/null +++ b/src/main/function/hyparccosecant.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "hyparccosecant.h" + +HyperbolicArcCosecantNode::HyperbolicArcCosecantNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* HyperbolicArcCosecantNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new HyperbolicArcCosecantNode(expression, text, sys); +} + +Number* HyperbolicArcCosecantNode::Evaluate() +{ + result = expression->Evaluate()->HypArcCosecant(); + return result; +} diff --git a/src/main/function/hyparccosecant.h b/src/main/function/hyparccosecant.h new file mode 100644 index 00000000..5da0ff97 --- /dev/null +++ b/src/main/function/hyparccosecant.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPARCCOSECANT_H +#define AMATH_FUNCTION_HYPARCCOSECANT_H + +#include "node.h" + +/** + * @brief An inverse hyperbolic cosecant function in a syntax tree. + * @details + * More info on the inverse hyperbolic cosecant function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Inverse_hyperbolic_cosecant + * + */ +class HyperbolicArcCosecantNode : public FunctionNode +{ +public: + explicit HyperbolicArcCosecantNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/hyparccosine.cpp b/src/main/function/hyparccosine.cpp new file mode 100644 index 00000000..46c85fe7 --- /dev/null +++ b/src/main/function/hyparccosine.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "hyparccosine.h" + +HyperbolicArccosineNode::HyperbolicArccosineNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* HyperbolicArccosineNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new HyperbolicArccosineNode(expression, text, sys); +} + +Number* HyperbolicArccosineNode::Evaluate() +{ + result = expression->Evaluate()->HypArcCosine(); + return result; +} diff --git a/src/main/function/hyparccosine.h b/src/main/function/hyparccosine.h new file mode 100644 index 00000000..3b937b3c --- /dev/null +++ b/src/main/function/hyparccosine.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPARCCOSINE_H +#define AMATH_FUNCTION_HYPARCCOSINE_H + +#include "node.h" + +/** + * @brief An inverse hyperbolic cosine function in a syntax tree. + * @details + * More info on the inverse hyperbolic cosine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Inverse_hyperbolic_cosine + * + */ +class HyperbolicArccosineNode : public FunctionNode +{ +public: + explicit HyperbolicArccosineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/hyparccotangent.cpp b/src/main/function/hyparccotangent.cpp new file mode 100644 index 00000000..2a788c2e --- /dev/null +++ b/src/main/function/hyparccotangent.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "hyparccotangent.h" + +HyperbolicArcCotangentNode::HyperbolicArcCotangentNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* HyperbolicArcCotangentNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new HyperbolicArcCotangentNode(expression, text, sys); +} + +Number* HyperbolicArcCotangentNode::Evaluate() +{ + result = expression->Evaluate()->HypArcCotangent(); + return result; +} diff --git a/src/main/function/hyparccotangent.h b/src/main/function/hyparccotangent.h new file mode 100644 index 00000000..26a60b62 --- /dev/null +++ b/src/main/function/hyparccotangent.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPARCCOTANGENT_H +#define AMATH_FUNCTION_HYPARCCOTANGENT_H + +#include "node.h" + +/** + * @brief An inverse hyperbolic cotangent function in a syntax tree. + * @details + * More info on the inverse hyperbolic cotangent function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Inverse_hyperbolic_cotangent + * + */ +class HyperbolicArcCotangentNode : public FunctionNode +{ +public: + explicit HyperbolicArcCotangentNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/hyparcsecant.cpp b/src/main/function/hyparcsecant.cpp new file mode 100644 index 00000000..03ba52ce --- /dev/null +++ b/src/main/function/hyparcsecant.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "hyparcsecant.h" + +HyperbolicArcSecantNode::HyperbolicArcSecantNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* HyperbolicArcSecantNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new HyperbolicArcSecantNode(expression, text, sys); +} + +Number* HyperbolicArcSecantNode::Evaluate() +{ + result = expression->Evaluate()->HypArcSecant(); + return result; +} diff --git a/src/main/function/hyparcsecant.h b/src/main/function/hyparcsecant.h new file mode 100644 index 00000000..f2af517f --- /dev/null +++ b/src/main/function/hyparcsecant.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPARCSECANT_H +#define AMATH_FUNCTION_HYPARCSECANT_H + +#include "node.h" + +/** + * @brief An inverse hyperbolic secant function in a syntax tree. + * @details + * More info on the inverse hyperbolic secant function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Inverse_hyperbolic_secant + * + */ +class HyperbolicArcSecantNode : public FunctionNode +{ +public: + explicit HyperbolicArcSecantNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/hyparcsine.cpp b/src/main/function/hyparcsine.cpp new file mode 100644 index 00000000..9ab230b0 --- /dev/null +++ b/src/main/function/hyparcsine.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "hyparcsine.h" + +HyperbolicArcsineNode::HyperbolicArcsineNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* HyperbolicArcsineNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new HyperbolicArcsineNode(expression, text, sys); +} + +Number* HyperbolicArcsineNode::Evaluate() +{ + result = expression->Evaluate()->HypArcSine(); + return result; +} diff --git a/src/main/function/hyparcsine.h b/src/main/function/hyparcsine.h new file mode 100644 index 00000000..d4d6fe8e --- /dev/null +++ b/src/main/function/hyparcsine.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPARCSINE_H +#define AMATH_FUNCTION_HYPARCSINE_H + +#include "node.h" + +/** + * @brief An inverse hyperbolic sine function in a syntax tree. + * @details + * More info on the inverse hyperbolic sine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Inverse_hyperbolic_sine + * + */ +class HyperbolicArcsineNode : public FunctionNode +{ +public: + explicit HyperbolicArcsineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/hyparctangent.cpp b/src/main/function/hyparctangent.cpp new file mode 100644 index 00000000..23dc0952 --- /dev/null +++ b/src/main/function/hyparctangent.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "hyparctangent.h" + +HyperbolicArctangentNode::HyperbolicArctangentNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* HyperbolicArctangentNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new HyperbolicArctangentNode(expression, text, sys); +} + +Number* HyperbolicArctangentNode::Evaluate() +{ + result = expression->Evaluate()->HypArcTangent(); + return result; +} diff --git a/src/main/function/hyparctangent.h b/src/main/function/hyparctangent.h new file mode 100644 index 00000000..feac08ab --- /dev/null +++ b/src/main/function/hyparctangent.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPARCTANGENT_H +#define AMATH_FUNCTION_HYPARCTANGENT_H + +#include "node.h" + +/** + * @brief An inverse hyperbolic tangent function in a syntax tree. + * @details + * More info on the inverse hyperbolic tangent function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Inverse_hyperbolic_tangent + * + */ +class HyperbolicArctangentNode : public FunctionNode +{ +public: + explicit HyperbolicArctangentNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/hypcosecant.cpp b/src/main/function/hypcosecant.cpp new file mode 100644 index 00000000..4f8f05a0 --- /dev/null +++ b/src/main/function/hypcosecant.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "hypcosecant.h" + +HyperbolicCosecantNode::HyperbolicCosecantNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* HyperbolicCosecantNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new HyperbolicCosecantNode(expression, text, sys); +} + +Number* HyperbolicCosecantNode::Evaluate() +{ + result = expression->Evaluate()->HypCosecant(); + return result; +} diff --git a/src/main/function/hypcosecant.h b/src/main/function/hypcosecant.h new file mode 100644 index 00000000..9e134c1c --- /dev/null +++ b/src/main/function/hypcosecant.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPCOSECANT_H +#define AMATH_FUNCTION_HYPCOSECANT_H + +#include "node.h" + +/** + * @brief A hyperbolic cosecant function in a syntax tree. + * @details + * More info on the hyperbolic cosecant function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Hyperbolic_cosecant + * + */ +class HyperbolicCosecantNode : public FunctionNode +{ +public: + explicit HyperbolicCosecantNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/hypcosine.cpp b/src/main/function/hypcosine.cpp new file mode 100644 index 00000000..25129970 --- /dev/null +++ b/src/main/function/hypcosine.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "hypcosine.h" + +HyperbolicCosineNode::HyperbolicCosineNode(ExpressionNode* expression, char* text, char* sys) + : FunctionNode(expression, text, sys) +{ +} + +FunctionNode* HyperbolicCosineNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new HyperbolicCosineNode(expression, text, sys); +} + +Number* HyperbolicCosineNode::Evaluate() +{ + result = expression->Evaluate()->HypCosine(); + return result; +} diff --git a/src/main/function/hypcosine.h b/src/main/function/hypcosine.h new file mode 100644 index 00000000..13496df4 --- /dev/null +++ b/src/main/function/hypcosine.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPCOSINE_H +#define AMATH_FUNCTION_HYPCOSINE_H + +#include "node.h" + +/** + * @brief A hyperbolic cosine function in a syntax tree. + * @details + * More info on the hyperbolic cosine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Hyperbolic_cosine + * + */ +class HyperbolicCosineNode : public FunctionNode +{ +public: + explicit HyperbolicCosineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/hypcotangent.cpp b/src/main/function/hypcotangent.cpp new file mode 100644 index 00000000..b4d40a9c --- /dev/null +++ b/src/main/function/hypcotangent.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "hypcotangent.h" + +HyperbolicCotangentNode::HyperbolicCotangentNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* HyperbolicCotangentNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new HyperbolicCotangentNode(expression, text, sys); +} + +Number* HyperbolicCotangentNode::Evaluate() +{ + result = expression->Evaluate()->HypCotangent(); + return result; +} diff --git a/src/main/function/hypcotangent.h b/src/main/function/hypcotangent.h new file mode 100644 index 00000000..b35813ba --- /dev/null +++ b/src/main/function/hypcotangent.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPCOTANGENT_H +#define AMATH_FUNCTION_HYPCOTANGENT_H + +#include "node.h" + +/** + * @brief A hyperbolic cotangent function in a syntax tree. + * @details + * More info on the hyperbolic cotangent function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Hyperbolic_cotangent + * + */ +class HyperbolicCotangentNode : public FunctionNode +{ +public: + explicit HyperbolicCotangentNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/hypsecant.cpp b/src/main/function/hypsecant.cpp new file mode 100644 index 00000000..8c7f346e --- /dev/null +++ b/src/main/function/hypsecant.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "hypsecant.h" + +HyperbolicSecantNode::HyperbolicSecantNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* HyperbolicSecantNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new HyperbolicSecantNode(expression, text, sys); +} + +Number* HyperbolicSecantNode::Evaluate() +{ + result = expression->Evaluate()->HypSecant(); + return result; +} diff --git a/src/main/function/hypsecant.h b/src/main/function/hypsecant.h new file mode 100644 index 00000000..ae479fc8 --- /dev/null +++ b/src/main/function/hypsecant.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPSECANT_H +#define AMATH_FUNCTION_HYPSECANT_H + +#include "node.h" + +/** + * @brief A hyperbolic secant function in a syntax tree. + * @details + * More info on the hyperbolic secant function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Hyperbolic_secant + * + */ +class HyperbolicSecantNode : public FunctionNode +{ +public: + explicit HyperbolicSecantNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/system/graph.cpp b/src/main/function/hypsine.cpp similarity index 77% rename from src/system/graph.cpp rename to src/main/function/hypsine.cpp index 2c34a78f..6cddedbb 100644 --- a/src/system/graph.cpp +++ b/src/main/function/hypsine.cpp @@ -27,29 +27,20 @@ * */ -#include "amath.h" -#include "amathc.h" -#include "system/graph.h" +#include "hypsine.h" -#if 0 - -GraphWindow::GraphWindow() +HyperbolicSineNode::HyperbolicSineNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) { - grid = nullptr; - next = nullptr; } -GraphWindow::~GraphWindow() +FunctionNode* HyperbolicSineNode::Create(ExpressionNode* expression, char* text, char* sys) { - if (grid != nullptr) - { - delete grid; - } - - if (next != nullptr) - { - delete next; - } + return new HyperbolicSineNode(expression, text, sys); } -#endif +Number* HyperbolicSineNode::Evaluate() +{ + result = expression->Evaluate()->HypSine(); + return result; +} diff --git a/src/main/function/hypsine.h b/src/main/function/hypsine.h new file mode 100644 index 00000000..884d46a5 --- /dev/null +++ b/src/main/function/hypsine.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPSINE_H +#define AMATH_FUNCTION_HYPSINE_H + +#include "node.h" + +/** + * @brief A hyperbolic sine function in a syntax tree. + * @details + * More info on the hyperbolic sine function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Hyperbolic_sine + * + */ +class HyperbolicSineNode : public FunctionNode +{ +public: + explicit HyperbolicSineNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/hyptangent.cpp b/src/main/function/hyptangent.cpp new file mode 100644 index 00000000..f9ae3a8f --- /dev/null +++ b/src/main/function/hyptangent.cpp @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "hyptangent.h" + +HyperbolicTangentNode::HyperbolicTangentNode(ExpressionNode* expression, char* text, char* sys) : + FunctionNode(expression, text, sys) +{ +} + +FunctionNode* HyperbolicTangentNode::Create(ExpressionNode* expression, char* text, char* sys) +{ + return new HyperbolicTangentNode(expression, text, sys); +} + +Number* HyperbolicTangentNode::Evaluate() +{ + result = expression->Evaluate()->HypTangent(); + return result; +} diff --git a/src/main/function/hyptangent.h b/src/main/function/hyptangent.h new file mode 100644 index 00000000..d93f414c --- /dev/null +++ b/src/main/function/hyptangent.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#ifndef AMATH_FUNCTION_HYPTANGENT_H +#define AMATH_FUNCTION_HYPTANGENT_H + +#include "node.h" + +/** + * @brief A hyperbolic tangent function in a syntax tree. + * @details + * More info on the hyperbolic tangent function is available at [Wikipedia]: + * https://wikipedia.org/wiki/Hyperbolic_tangent + * + */ +class HyperbolicTangentNode : public FunctionNode +{ +public: + explicit HyperbolicTangentNode(ExpressionNode* expression, char* text, char* sys); + static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); + Number* Evaluate(); +}; + +#endif diff --git a/src/main/function/log10.cpp b/src/main/function/log10.cpp index 944f59eb..d1b35afd 100644 --- a/src/main/function/log10.cpp +++ b/src/main/function/log10.cpp @@ -44,4 +44,3 @@ Number* LogNode::Evaluate() result = expression->Evaluate()->Log10(); return result; } - \ No newline at end of file diff --git a/src/main/function/node.cpp b/src/main/function/node.cpp index 53bbff9a..3af78ac6 100644 --- a/src/main/function/node.cpp +++ b/src/main/function/node.cpp @@ -44,12 +44,12 @@ FunctionNode::~FunctionNode() { delete expression; } - + if (name != nullptr) { delete name; } - + if (sysname != nullptr) { delete sysname; @@ -65,22 +65,22 @@ char* FunctionNode::GetText() { const char* functionText = GetNodeText(); const char* expText = expression->GetText(); - + output->EnsureSize(StrLen(functionText) + StrLen(expText) + 2 + 1); output->Empty(); output->Append(functionText); output->Append("("); output->Append(expText); output->Append(")"); - + return output->GetString(); } char* FunctionNode::GetNodeText() { return Program->Preferences->GetRefactorNames() - ? sysname - : name; + ? sysname + : name; } SyntaxNode* FunctionNode::GetNext() @@ -90,8 +90,8 @@ SyntaxNode* FunctionNode::GetNext() iterator = expression; return expression; } - - return nullptr; + + return nullptr; } void FunctionNode::Attach(SyntaxNode* node) @@ -119,4 +119,3 @@ void FunctionNode::Replace(SyntaxNode* n, SyntaxNode* x) expression = static_cast(x); } } - \ No newline at end of file diff --git a/src/main/function/trunc.cpp b/src/main/function/trunc.cpp index f73579d6..c9954977 100644 --- a/src/main/function/trunc.cpp +++ b/src/main/function/trunc.cpp @@ -44,4 +44,3 @@ Number* TruncNode::Evaluate() result = expression->Evaluate()->Trunc(); return result; } - \ No newline at end of file diff --git a/src/main/function/user.cpp b/src/main/function/user.cpp index 78b48f81..f68f632e 100644 --- a/src/main/function/user.cpp +++ b/src/main/function/user.cpp @@ -54,7 +54,7 @@ SyntaxNode* UserFunctionNode::GetNext() iterator = function->GetExpression(); return iterator; } - + return nullptr; } diff --git a/src/main/function/user.h b/src/main/function/user.h index 3cbd3998..ee003ad3 100644 --- a/src/main/function/user.h +++ b/src/main/function/user.h @@ -46,10 +46,10 @@ public: void Attach(SyntaxNode* node); void Detach(SyntaxNode* node); void Replace(SyntaxNode* n, SyntaxNode* x); - + protected: char* GetNodeText(); - + private: UserFunction* function; }; diff --git a/src/main/functionlist.cpp b/src/main/functionlist.cpp index a32ac0fc..3796f3f6 100644 --- a/src/main/functionlist.cpp +++ b/src/main/functionlist.cpp @@ -163,7 +163,7 @@ FunctionNode* FunctionList::GetFunctionCall(const char* function, ExpressionNode if (systemFunction != nullptr) { char* sysname = FindAlias(function); - return (systemFunction->create)(parameter, (char*)function, sysname); + return (systemFunction->create)(parameter, const_cast(function), sysname); } UserFunction* current = first; @@ -265,6 +265,6 @@ char* FunctionList::FindAlias(const char* ident) return const_cast(identaliases[i].alias); } } - + return const_cast(ident); } diff --git a/src/main/functionlist.h b/src/main/functionlist.h index 11eb241d..f0631ac4 100644 --- a/src/main/functionlist.h +++ b/src/main/functionlist.h @@ -44,7 +44,7 @@ class FunctionList public: FunctionList(); ~FunctionList(); - + void Clear(); bool Delete(const char* name, const char* argument); static bool IsSystemFunction(const char* name); @@ -52,10 +52,10 @@ public: UserFunction* GetFunctionDef(const char* name); UserFunction* GetFunctionDef(const char* name, const char* argument) const; FunctionNode* GetFunctionCall(const char* function, ExpressionNode* value) const; - + char* List() const; char* ListDefinitions() const; - + private: char* ListContent(bool cmdFormat) const; CharBuffer* buf; diff --git a/src/main/functions.cpp b/src/main/functions.cpp deleted file mode 100644 index 054a529b..00000000 --- a/src/main/functions.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "amath.h" -#include "amathc.h" -#include "lib/numb.h" -#include "values.h" -#include "functions.h" -#include "function/defs.h" -#include "function/user.h" -#include "system/program.h" -#include "localize/text.h" - - -HyperbolicSineNode::HyperbolicSineNode(ExpressionNode* expression, char* text, char* sys) : - FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicSineNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicSineNode(expression, text, sys); -} - -Number* HyperbolicSineNode::Evaluate() -{ - result = expression->Evaluate()->HypSine(); - return result; -} - -HyperbolicCosineNode::HyperbolicCosineNode(ExpressionNode* expression, char* text, char* sys) -: FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicCosineNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicCosineNode(expression, text, sys); -} - -Number* HyperbolicCosineNode::Evaluate() -{ - result = expression->Evaluate()->HypCosine(); - return result; -} - -HyperbolicTangentNode::HyperbolicTangentNode(ExpressionNode* expression, char* text, char* sys) : - FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicTangentNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicTangentNode(expression, text, sys); -} - -Number* HyperbolicTangentNode::Evaluate() -{ - result = expression->Evaluate()->HypTangent(); - return result; -} - -HyperbolicCotangentNode::HyperbolicCotangentNode(ExpressionNode* expression, char* text, char* sys) : - FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicCotangentNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicCotangentNode(expression, text, sys); -} - -Number* HyperbolicCotangentNode::Evaluate() -{ - result = expression->Evaluate()->HypCotangent(); - return result; -} - -HyperbolicSecantNode::HyperbolicSecantNode(ExpressionNode* expression, char* text, char* sys) : - FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicSecantNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicSecantNode(expression, text, sys); -} - -Number* HyperbolicSecantNode::Evaluate() -{ - result = expression->Evaluate()->HypSecant(); - return result; -} - -HyperbolicCosecantNode::HyperbolicCosecantNode(ExpressionNode* expression, char* text, char* sys) : - FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicCosecantNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicCosecantNode(expression, text, sys); -} - -Number* HyperbolicCosecantNode::Evaluate() -{ - result = expression->Evaluate()->HypCosecant(); - return result; -} - -// ------------------------------------------------------------------------- -// --------------------- Inverse Hyperbolic Functions ---------------------- -// ------------------------------------------------------------------------- - -HyperbolicArcsineNode::HyperbolicArcsineNode(ExpressionNode* expression, char* text, char* sys) : - FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicArcsineNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicArcsineNode(expression, text, sys); -} - -Number* HyperbolicArcsineNode::Evaluate() -{ - result = expression->Evaluate()->HypArcSine(); - return result; -} - -HyperbolicArccosineNode::HyperbolicArccosineNode(ExpressionNode* expression, char* text, char* sys) : - FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicArccosineNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicArccosineNode(expression, text, sys); -} - -Number* HyperbolicArccosineNode::Evaluate() -{ - result = expression->Evaluate()->HypArcCosine(); - return result; -} - -HyperbolicArctangentNode::HyperbolicArctangentNode(ExpressionNode* expression, char* text, char* sys) : - FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicArctangentNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicArctangentNode(expression, text, sys); -} - -Number* HyperbolicArctangentNode::Evaluate() -{ - result = expression->Evaluate()->HypArcTangent(); - return result; -} - -HyperbolicArcCotangentNode::HyperbolicArcCotangentNode(ExpressionNode* expression, char* text, char* sys) : - FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicArcCotangentNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicArcCotangentNode(expression, text, sys); -} - -Number* HyperbolicArcCotangentNode::Evaluate() -{ - result = expression->Evaluate()->HypArcCotangent(); - return result; -} - -HyperbolicArcSecantNode::HyperbolicArcSecantNode(ExpressionNode* expression, char* text, char* sys) : - FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicArcSecantNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicArcSecantNode(expression, text, sys); -} - -Number* HyperbolicArcSecantNode::Evaluate() -{ - result = expression->Evaluate()->HypArcSecant(); - return result; -} - -HyperbolicArcCosecantNode::HyperbolicArcCosecantNode(ExpressionNode* expression, char* text, char* sys) : - FunctionNode(expression, text, sys) -{ -} - -FunctionNode* HyperbolicArcCosecantNode::Create(ExpressionNode* expression, char* text, char* sys) -{ - return new HyperbolicArcCosecantNode(expression, text, sys); -} - -Number* HyperbolicArcCosecantNode::Evaluate() -{ - result = expression->Evaluate()->HypArcCosecant(); - return result; -} diff --git a/src/main/functions.h b/src/main/functions.h deleted file mode 100644 index e0b130b3..00000000 --- a/src/main/functions.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef AMATH_FUNCTIONS_H -#define AMATH_FUNCTIONS_H - -/** - * @file functions.h - * @brief Application logic tied to functions. - * - */ - -#include "main/nodes.h" -#include "function/node.h" - -class HyperbolicSineNode : public FunctionNode -{ -public: - explicit HyperbolicSineNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -class HyperbolicCosineNode : public FunctionNode -{ -public: - explicit HyperbolicCosineNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -class HyperbolicTangentNode : public FunctionNode -{ -public: - explicit HyperbolicTangentNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -class HyperbolicCotangentNode : public FunctionNode -{ -public: - explicit HyperbolicCotangentNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -class HyperbolicSecantNode : public FunctionNode -{ -public: - explicit HyperbolicSecantNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -class HyperbolicCosecantNode : public FunctionNode -{ -public: - explicit HyperbolicCosecantNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -class HyperbolicArccosineNode : public FunctionNode -{ -public: - explicit HyperbolicArccosineNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -class HyperbolicArcsineNode : public FunctionNode -{ -public: - explicit HyperbolicArcsineNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -class HyperbolicArctangentNode : public FunctionNode -{ -public: - explicit HyperbolicArctangentNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -class HyperbolicArcCotangentNode : public FunctionNode -{ -public: - explicit HyperbolicArcCotangentNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -class HyperbolicArcCosecantNode : public FunctionNode -{ -public: - explicit HyperbolicArcCosecantNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -class HyperbolicArcSecantNode : public FunctionNode -{ -public: - explicit HyperbolicArcSecantNode(ExpressionNode* expression, char* text, char* sys); - static FunctionNode* Create(ExpressionNode* expression, char* text, char* sys); - Number* Evaluate(); -}; - -#endif diff --git a/src/main/lexer.cpp b/src/main/lexer.cpp index 3fc931bc..1f10379c 100644 --- a/src/main/lexer.cpp +++ b/src/main/lexer.cpp @@ -27,7 +27,6 @@ * */ -#include "amath.h" #include "amathc.h" #include "lexer.h" #include "token.h" diff --git a/src/main/main.vcxproj b/src/main/main.vcxproj new file mode 100644 index 00000000..2949cb8a --- /dev/null +++ b/src/main/main.vcxproj @@ -0,0 +1,134 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {A1EA2AF8-7233-45C5-BA42-C746F658EA4E} + Win32Proj + + + + StaticLibrary + true + v141 + + + StaticLibrary + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + DEBUGTREE;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + $(ProjectDir)..;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Windows + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + $(ProjectDir)..;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/main.vcxproj.filters b/src/main/main.vcxproj.filters new file mode 100644 index 00000000..e902dce3 --- /dev/null +++ b/src/main/main.vcxproj.filters @@ -0,0 +1,96 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/main/operators.cpp b/src/main/operators.cpp index 648cc1fd..f9af0d39 100644 --- a/src/main/operators.cpp +++ b/src/main/operators.cpp @@ -27,7 +27,6 @@ * */ -#include "amath.h" #include "amathc.h" #include "operators.h" #include "lib/numb.h" diff --git a/src/main/optimizer.cpp b/src/main/optimizer.cpp index d3b2066b..3e5ea8e7 100644 --- a/src/main/optimizer.cpp +++ b/src/main/optimizer.cpp @@ -28,7 +28,6 @@ */ #include "amath.h" -#include "amathc.h" #include "nodes.h" #include "values.h" #include "optimizer.h" @@ -56,7 +55,7 @@ void Optimizer::Optimize() const TagStartNode(root); } -void Optimizer::TagChildren(SyntaxNode* node) const +void Optimizer::TagChildren(SyntaxNode* node) { SyntaxNode* current; node->ResetIterator(); @@ -67,7 +66,7 @@ void Optimizer::TagChildren(SyntaxNode* node) const } } -void Optimizer::BalanceTree(SyntaxNode* node) const +void Optimizer::BalanceTree(SyntaxNode* node) { if (node == nullptr) return; @@ -113,7 +112,7 @@ void Optimizer::BalanceTree(SyntaxNode* node) const } } -int Optimizer::GetTreeDepth(SyntaxNode* node, int depth) const +int Optimizer::GetTreeDepth(SyntaxNode* node, int depth) { int max = depth; SyntaxNode* current; @@ -131,7 +130,7 @@ int Optimizer::GetTreeDepth(SyntaxNode* node, int depth) const return max; } -void Optimizer::ReduceUnaryNodes(SyntaxNode* node) const +void Optimizer::ReduceUnaryNodes(SyntaxNode* node) { SyntaxNode* current; node->ResetIterator(); @@ -173,7 +172,7 @@ void Optimizer::ReduceUnaryNodes(SyntaxNode* node) const } } -void Optimizer::ReduceValueNodes(SyntaxNode* node) const +void Optimizer::ReduceValueNodes(SyntaxNode* node) { SyntaxNode* current; node->ResetIterator(); @@ -212,7 +211,7 @@ void Optimizer::ReduceValueNodes(SyntaxNode* node) const } } -void Optimizer::TagStartNode(SyntaxNode* node) const +void Optimizer::TagStartNode(SyntaxNode* node) { node->ResetIterator(); SyntaxNode* next = node->GetNext(); diff --git a/src/main/optimizer.h b/src/main/optimizer.h index 6c3f7a62..9def8a30 100644 --- a/src/main/optimizer.h +++ b/src/main/optimizer.h @@ -44,15 +44,15 @@ public: void Optimize() const; SyntaxNode* GetRoot() const; - int GetTreeDepth(SyntaxNode* node, int depth) const; + static int GetTreeDepth(SyntaxNode* node, int depth); private: SyntaxNode* root; - void TagChildren(SyntaxNode* node) const; - void BalanceTree(SyntaxNode* node) const; - void ReduceUnaryNodes(SyntaxNode* node) const; - void ReduceValueNodes(SyntaxNode* node) const; - void TagStartNode(SyntaxNode* node) const; + static void TagChildren(SyntaxNode* node); + static void BalanceTree(SyntaxNode* node); + static void ReduceUnaryNodes(SyntaxNode* node); + static void ReduceValueNodes(SyntaxNode* node); + static void TagStartNode(SyntaxNode* node); }; #endif diff --git a/src/main/parser.cpp b/src/main/parser.cpp index a72a80b5..935ff418 100644 --- a/src/main/parser.cpp +++ b/src/main/parser.cpp @@ -168,7 +168,7 @@ SyntaxNode* Parser::ParseStatement() case symdef: res = ParseFunctionDef(); break; -#if defined(UNIX) || defined(HAIKU) +#if defined(UNIX) || defined(HAIKU) || defined(AMIGA) case symlist: res = ParseListStatement(); break; diff --git a/src/main/statement/about.cpp b/src/main/statement/about.cpp index c878f6aa..f924e3aa 100644 --- a/src/main/statement/about.cpp +++ b/src/main/statement/about.cpp @@ -32,7 +32,12 @@ AboutStatement::AboutStatement() : StatementNode( - "This ..." NEWLINE) + BOLD TXTVERSMSG NORMALTEXT NEWLINE TXTCOMPMSG NORMALTEXT NEWLINE NEWLINE + "amath features a case sensitive command line interface, internal IEEE 754" NEWLINE + "calculations with 15 significant digits, calculations with real and complex" NEWLINE + "numbers, variables and user defined functions, logarithmic and exponential" NEWLINE + "functions, trigonometric and hyperbolic function and selected mathematical" NEWLINE + "constants and rounding functions." NEWLINE) { } diff --git a/src/main/statement/delete.h b/src/main/statement/delete.h index efa3d37f..8a0b200f 100644 --- a/src/main/statement/delete.h +++ b/src/main/statement/delete.h @@ -45,7 +45,7 @@ public: DeleteStatement(const char* name, const char* argument); ~DeleteStatement(); char* Execute(); - + private: Symbol type; char* name; diff --git a/src/main/statement/digits.h b/src/main/statement/digits.h index 254570f4..b0d22611 100644 --- a/src/main/statement/digits.h +++ b/src/main/statement/digits.h @@ -43,7 +43,7 @@ public: explicit DigitsStatement(unsigned int digits); ~DigitsStatement(); char* Execute(); - + private: bool show; unsigned int digits; diff --git a/src/main/statement/draw.h b/src/main/statement/draw.h index 3fb855d4..c15c1b8c 100644 --- a/src/main/statement/draw.h +++ b/src/main/statement/draw.h @@ -38,7 +38,7 @@ public: DrawStatement(const char* name, const char* parameter); ~DrawStatement(); char* Execute(); - + private: char* name; char* parameter; diff --git a/src/main/statement/empty.cpp b/src/main/statement/empty.cpp index f598f3ee..d7460515 100644 --- a/src/main/statement/empty.cpp +++ b/src/main/statement/empty.cpp @@ -27,7 +27,6 @@ * */ -#include "amath.h" #include "empty.h" EmptyStatement::EmptyStatement() : diff --git a/src/main/statement/eval.h b/src/main/statement/eval.h index 304b9137..953bedca 100644 --- a/src/main/statement/eval.h +++ b/src/main/statement/eval.h @@ -41,13 +41,13 @@ class EvalStatement : public virtual StatementNode public: explicit EvalStatement(ExpressionNode* expression); ~EvalStatement(); - + char* Execute(); SyntaxNode* GetNext(); void Attach(SyntaxNode* node); void Detach(SyntaxNode* node); void Replace(SyntaxNode* n, SyntaxNode* x); - + private: ExpressionNode* expression; }; diff --git a/src/main/statement/execute.h b/src/main/statement/execute.h index e91ba9e4..23585cc1 100644 --- a/src/main/statement/execute.h +++ b/src/main/statement/execute.h @@ -38,7 +38,7 @@ public: explicit ExecuteStatement(const char* file); ~ExecuteStatement(); char* Execute(); - + private: char* file; }; diff --git a/src/main/statement/help.cpp b/src/main/statement/help.cpp index 50f0f95c..060d58d4 100644 --- a/src/main/statement/help.cpp +++ b/src/main/statement/help.cpp @@ -64,10 +64,60 @@ HelpStatement::~HelpStatement() char* HelpStatement::Execute() { - char* text = argument != symident - ? Program->Language->GetHelpText(argument) - : Program->Language->GetHelpText(ident); + if (argument == symstatement) + { + return StatementHelp(); + } + else if (argument == symident) + { + char* text = Program->Language->GetHelpText(ident); + output->ClearAndCopy(text); + return output->GetString(); + } + char* text = Program->Language->GetHelpText(argument); output->ClearAndCopy(text); return output->GetString(); } + +#define APPENDHELP(x) \ + text = x; \ + output->EnsureGrowth(StrLen(text)); \ + output->Append(text); + +char* HelpStatement::StatementHelp() const +{ + char* text; + output->ClearBuffer(); + + APPENDHELP(STATEMENTLINE) +#if defined(ANSICONSOLE) + APPENDHELP(STATEMENTCLEAR) +#endif + APPENDHELP(STATEMENTDEF) + APPENDHELP(STATEMENTDELETE) + APPENDHELP(STATEMENTDIGITS) + APPENDHELP(STATEMENTDEF) + APPENDHELP(STATEMENTDELETE) + APPENDHELP(STATEMENTDIGITS) + APPENDHELP(STATEMENTEVAL) + APPENDHELP(STATEMENTEXECUTE) + APPENDHELP(STATEMENTFUNCS) + APPENDHELP(STATEMENTINPUT) + APPENDHELP(STATEMENTHELP) + APPENDHELP(STATEMENTOUTPUT) +#if defined(UNIX) || defined(HAIKU) || defined(AMIGA) + APPENDHELP(STATEMENTLIST) +#endif + APPENDHELP(STATEMENTSHOW) + APPENDHELP(STATEMENTLOAD) + APPENDHELP(STATEMENTSAVE) + APPENDHELP(STATEMENTVARS) + APPENDHELP(STATEMENTVERSION) + APPENDHELP(STATEMENTMEMORY) + APPENDHELP(STATEMENTEXIT) + APPENDHELP(STATEMENTLINE) + APPENDHELP(STATEMENTFOOTER) + + return output->GetString(); +} diff --git a/src/main/statement/help.h b/src/main/statement/help.h index e9d10690..555ed739 100644 --- a/src/main/statement/help.h +++ b/src/main/statement/help.h @@ -45,8 +45,10 @@ public: explicit HelpStatement(const char* ident); ~HelpStatement(); char* Execute(); - + private: + char* StatementHelp() const; + Symbol argument; char* ident; }; diff --git a/src/main/statement/input.h b/src/main/statement/input.h index a83a3e7f..a73cfc93 100644 --- a/src/main/statement/input.h +++ b/src/main/statement/input.h @@ -43,7 +43,7 @@ public: explicit InputStatement(unsigned int base); ~InputStatement(); char* Execute(); - + private: unsigned int base; }; diff --git a/src/main/statement/license.cpp b/src/main/statement/license.cpp index 6940df43..ee4f91c9 100644 --- a/src/main/statement/license.cpp +++ b/src/main/statement/license.cpp @@ -32,41 +32,41 @@ LicenseStatement::LicenseStatement() : StatementNode( - NEWLINE BOLD - "Copyright (c) 2014-2017 Carsten Sonne Larsen " NORMALTEXT NEWLINE - "Copyright (c) 2007 The NetBSD Foundation, Inc." NEWLINE - "Copyright (c) 1990, 1993 The Regents of the University of California." NEWLINE - "All rights reserved." NEWLINE - NEWLINE - "This code is derived from software written by Stephen L. Moshier." NEWLINE - "It is redistributed by the NetBSD Foundation by permission of the author." NEWLINE - NEWLINE - "This code is derived from software contributed to Berkeley by" NEWLINE - "Mike Hibler and Chris Torek." NEWLINE - NEWLINE - "Redistribution and use in source and binary forms, with or without" NEWLINE - "modification, are permitted provided that the following conditions are met:" NEWLINE - NEWLINE - "* Redistributions of source code must retain the above copyright notice, this" NEWLINE - " list of conditions and the following disclaimer." NEWLINE - NEWLINE - "* Redistributions in binary form must reproduce the above copyright notice," NEWLINE - " this list of conditions and the following disclaimer in the documentation" NEWLINE - " and/or other materials provided with the distribution." NEWLINE - NEWLINE - "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"" NEWLINE - "AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE" NEWLINE - "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE" NEWLINE - "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE" NEWLINE - "FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL" NEWLINE - "DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR" NEWLINE - "SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER" NEWLINE - "CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY," NEWLINE - "OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE" NEWLINE - "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." NEWLINE - NEWLINE ITALICS - "Specific details should be found in the source files." NORMALTEXT NEWLINE - NEWLINE) + NEWLINE BOLD + "Copyright (c) 2014-2017 Carsten Sonne Larsen " NORMALTEXT NEWLINE + "Copyright (c) 2007 The NetBSD Foundation, Inc." NEWLINE + "Copyright (c) 1990, 1993 The Regents of the University of California." NEWLINE + "All rights reserved." NEWLINE + NEWLINE + "This code is derived from software written by Stephen L. Moshier." NEWLINE + "It is redistributed by the NetBSD Foundation by permission of the author." NEWLINE + NEWLINE + "This code is derived from software contributed to Berkeley by" NEWLINE + "Mike Hibler and Chris Torek." NEWLINE + NEWLINE + "Redistribution and use in source and binary forms, with or without" NEWLINE + "modification, are permitted provided that the following conditions are met:" NEWLINE + NEWLINE + "* Redistributions of source code must retain the above copyright notice, this" NEWLINE + " list of conditions and the following disclaimer." NEWLINE + NEWLINE + "* Redistributions in binary form must reproduce the above copyright notice," NEWLINE + " this list of conditions and the following disclaimer in the documentation" NEWLINE + " and/or other materials provided with the distribution." NEWLINE + NEWLINE + "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"" NEWLINE + "AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE" NEWLINE + "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE" NEWLINE + "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE" NEWLINE + "FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL" NEWLINE + "DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR" NEWLINE + "SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER" NEWLINE + "CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY," NEWLINE + "OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE" NEWLINE + "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." NEWLINE + NEWLINE ITALICS + "Specific details should be found in the source files." NORMALTEXT NEWLINE + NEWLINE) { } diff --git a/src/main/statement/list.h b/src/main/statement/list.h index 98d8458b..0da8493d 100644 --- a/src/main/statement/list.h +++ b/src/main/statement/list.h @@ -39,7 +39,7 @@ public: explicit ListStatement(const char* directory); ~ListStatement(); char* Execute(); - + private: char* directory; }; diff --git a/src/main/statement/load.cpp b/src/main/statement/load.cpp index c71ed2db..389713b3 100644 --- a/src/main/statement/load.cpp +++ b/src/main/statement/load.cpp @@ -29,7 +29,6 @@ #include "load.h" #include "amath.h" -#include "amath.h" #include "localize/text.h" #include "system/program.h" #include "../parser.h" diff --git a/src/main/statement/load.h b/src/main/statement/load.h index 44dd720d..81685580 100644 --- a/src/main/statement/load.h +++ b/src/main/statement/load.h @@ -38,7 +38,7 @@ public: explicit LoadStatement(const char* file); ~LoadStatement(); char* Execute(); - + private: char* file; }; diff --git a/src/main/statement/memory.cpp b/src/main/statement/memory.cpp index 82772117..5387db39 100644 --- a/src/main/statement/memory.cpp +++ b/src/main/statement/memory.cpp @@ -50,7 +50,7 @@ char* MemoryStatement::Execute() Number* a = new RealNumber(static_cast(blocks)); Number* b = new RealNumber(static_cast(size)); Number* c = new RealNumber(static_cast(peak)); - + NumeralSystem* ns = new DecimalSystem(8); output->Empty(); output->EnsureSize( @@ -66,7 +66,7 @@ char* MemoryStatement::Execute() output->Append(TXTMEMMAXSIZE); output->Append(ns->GetText(c)); output->Append(NEWLINE); - + delete a; delete b; delete c; diff --git a/src/main/statement/node.cpp b/src/main/statement/node.cpp index b6c07cbd..e7a7a06b 100644 --- a/src/main/statement/node.cpp +++ b/src/main/statement/node.cpp @@ -74,4 +74,3 @@ void StatementNode::Detach(SyntaxNode* node) void StatementNode::Replace(SyntaxNode* n, SyntaxNode* x) { } - \ No newline at end of file diff --git a/src/main/statement/node.h b/src/main/statement/node.h index 83c0a7bd..91433182 100644 --- a/src/main/statement/node.h +++ b/src/main/statement/node.h @@ -33,9 +33,9 @@ #include "../nodes.h" /** - * @brief Base class for all statements in a syntax tree. - * - */ +* @brief Base class for all statements in a syntax tree. +* +*/ class StatementNode : public SyntaxNode { public: @@ -49,9 +49,9 @@ public: void Attach(SyntaxNode* node); void Detach(SyntaxNode* node); void Replace(SyntaxNode* n, SyntaxNode* x); - + protected: - char* statementText; + char* statementText; }; #endif diff --git a/src/main/statement/plot.h b/src/main/statement/plot.h index c93fbba2..f7e4674f 100644 --- a/src/main/statement/plot.h +++ b/src/main/statement/plot.h @@ -39,7 +39,7 @@ public: PlotStatement(const char* name, const char* parameter); ~PlotStatement(); char* Execute(); - + private: char* name; char* parameter; diff --git a/src/main/statement/prefs.cpp b/src/main/statement/prefs.cpp index 53d12436..91bef6c1 100644 --- a/src/main/statement/prefs.cpp +++ b/src/main/statement/prefs.cpp @@ -46,18 +46,18 @@ PrefsStatement::PrefsStatement(Symbol argument) char* PrefsStatement::Execute() { bool success; - + if (argument == symsave) { success = Program->Preferences->Keep(); success &= Program->Preferences->Save(); return (success ? HELPPREFSAVE : HELPPREFNOSA); } - + if (argument == symload) { success = Program->Preferences->Load(); - + if (success) { Program->Console->SetPrompt(Program->Preferences->GetPrompt()); @@ -65,9 +65,9 @@ char* PrefsStatement::Execute() Program->Output->SetDigits(Program->Preferences->GetDigits()); return HELPPREFLOAD; } - + return HELPPREFNOLO; } - + return Program->Preferences->GetDescription(); } diff --git a/src/main/statement/prefs.h b/src/main/statement/prefs.h index d79ba5dc..4131ebcc 100644 --- a/src/main/statement/prefs.h +++ b/src/main/statement/prefs.h @@ -44,7 +44,7 @@ public: PrefsStatement(); explicit PrefsStatement(Symbol argument); char* Execute(); - + private: Symbol argument; }; diff --git a/src/main/statement/prompt.h b/src/main/statement/prompt.h index f10ef6d3..e6702eec 100644 --- a/src/main/statement/prompt.h +++ b/src/main/statement/prompt.h @@ -43,7 +43,7 @@ public: PromptStatement(char* prompt); ~PromptStatement(); char* Execute(); - + private: char* prompt; }; diff --git a/src/main/statement/save.cpp b/src/main/statement/save.cpp index 147ad581..00fc5168 100644 --- a/src/main/statement/save.cpp +++ b/src/main/statement/save.cpp @@ -29,7 +29,6 @@ #include "save.h" #include "amath.h" -#include "amath.h" #include "localize/text.h" #include "system/program.h" diff --git a/src/main/statement/save.h b/src/main/statement/save.h index 8c3d7141..50df47e3 100644 --- a/src/main/statement/save.h +++ b/src/main/statement/save.h @@ -38,7 +38,7 @@ public: explicit SaveStatement(const char* file); ~SaveStatement(); char* Execute(); - + private: char* file; }; diff --git a/src/main/statement/show.h b/src/main/statement/show.h index c56f2394..73d26dd4 100644 --- a/src/main/statement/show.h +++ b/src/main/statement/show.h @@ -38,7 +38,7 @@ public: explicit ShowStatement(const char* file); ~ShowStatement(); char* Execute(); - + private: char* file; }; diff --git a/src/main/statement/silent.cpp b/src/main/statement/silent.cpp index 7320fe1e..335bc5c5 100644 --- a/src/main/statement/silent.cpp +++ b/src/main/statement/silent.cpp @@ -28,7 +28,6 @@ */ #include "amath.h" -#include "amathc.h" #include "silent.h" SilentStatement::SilentStatement(StatementNode* statement) : diff --git a/src/main/statement/silent.h b/src/main/statement/silent.h index c7b7963a..9abcdeb8 100644 --- a/src/main/statement/silent.h +++ b/src/main/statement/silent.h @@ -44,13 +44,13 @@ class SilentStatement : public virtual StatementNode public: explicit SilentStatement(StatementNode* statement); ~SilentStatement(); - + char* Execute(); SyntaxNode* GetNext(); void Attach(SyntaxNode* node); void Detach(SyntaxNode* node); void Replace(SyntaxNode* n, SyntaxNode* x); - + private: StatementNode* statement; }; diff --git a/src/main/statement/statements.vcxproj b/src/main/statement/statements.vcxproj new file mode 100644 index 00000000..46d59b2b --- /dev/null +++ b/src/main/statement/statements.vcxproj @@ -0,0 +1,161 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {8C4AB972-1866-4696-9B3D-EAFD25D09BF8} + Win32Proj + + + + StaticLibrary + true + v141 + + + StaticLibrary + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + $(ProjectDir)../..;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Windows + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + $(ProjectDir)../..;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/statement/statements.vcxproj.filters b/src/main/statement/statements.vcxproj.filters new file mode 100644 index 00000000..1b1ddb4e --- /dev/null +++ b/src/main/statement/statements.vcxproj.filters @@ -0,0 +1,177 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/main/token.cpp b/src/main/token.cpp index b9757167..64a67df2 100644 --- a/src/main/token.cpp +++ b/src/main/token.cpp @@ -27,7 +27,6 @@ * */ -#include "amath.h" #include "amathc.h" #include "main/token.h" diff --git a/src/main/userfunction.h b/src/main/userfunction.h index 2439340a..728efbe3 100644 --- a/src/main/userfunction.h +++ b/src/main/userfunction.h @@ -47,9 +47,9 @@ public: UserFunction(const char* name, const char* variable, ExpressionNode* expression); explicit UserFunction(const char* name); ~UserFunction(); - + UserFunction* Next; - + char* GetName() const; char* GetDefitionName() const; char* GetDefitionText() const; @@ -57,14 +57,14 @@ public: Variable* CreateVariable(const char* name); ExpressionNode* GetExpression() const; void SetExpression(ExpressionNode* expression); - + private: char* name; Variable* variable; ExpressionNode* expression; bool chainDelete; friend bool FunctionList::Delete(const char* name, const char* argument); - + void InitializeTexts() const; CharBuffer* defname; CharBuffer* defition; diff --git a/src/real/Makefile b/src/real/Makefile index 085f56b9..126fc0d4 100644 --- a/src/real/Makefile +++ b/src/real/Makefile @@ -1,14 +1,20 @@ -CC = gcc -CFLAGS = -std=c9x -O3 -DWITHTEST -I. -I.. -Wall -AR = ar -RANLIB = ranlib -MKDIR = mkdir -p -DEL = rm -f -INSTALL = install -m 0644 -PREFIX = /usr - -alib = libamath.a -solib = libamath.so +CC = gcc +CFLAGS = -std=c9x -O3 -DWITHTEST -I. -I.. -Wall +AR = ar +RANLIB = ranlib +MKDIR = mkdir -p +DEL = rm -f +INSTALL = install -m 0644 +LDCONFIG = ldconfig +PREFIX = /usr +INSTDIR = ${DESTDIR}${PREFIX}/lib/amath +INSTDIRI = ${DESTDIR}${PREFIX}/include/amath +INSTDIRPC = ${DESTDIR}${PREFIX}/lib/pkgconfig +INSTDIRM = ${DESTDIR}${PREFIX}/share/man/man3 +alib = libamath.a +solib = libamath.so +pkgconfig = amathr.pc +manpage = amathr.3 all: static shared @@ -268,7 +274,7 @@ build: ${MKDIR} shared ${solib}: build shared/acos.o shared/acosh.o shared/acvs.o shared/ahv.o shared/ahvc.o shared/asin.o shared/asinh.o shared/atan.o shared/atan2.o shared/atanh.o shared/aver.o shared/cbrt.o shared/ceil.o shared/copysign.o shared/cos.o shared/cosh.o shared/exp.o shared/expm1.o shared/fabs.o shared/finite.o shared/floor.o shared/fmod.o shared/hypot.o shared/isnan.o shared/kcos.o shared/kremp2.o shared/ksin.o shared/ktan.o shared/log.o shared/log10.o shared/log1p.o shared/pow.o shared/remp2.o shared/round.o shared/scalbn.o shared/sin.o shared/sinh.o shared/sqrt.o shared/tan.o shared/tanh.o shared/trunc.o - ${CC} -shared -fPIC -Wl,-soname,${solib} -o ${solib} shared/acos.o shared/acosh.o shared/acvs.o shared/ahv.o shared/ahvc.o shared/asin.o shared/asinh.o shared/atan.o shared/atan2.o shared/atanh.o shared/aver.o shared/cbrt.o shared/ceil.o shared/copysign.o shared/cos.o shared/cosh.o shared/exp.o shared/expm1.o shared/fabs.o shared/finite.o shared/floor.o shared/fmod.o shared/hypot.o shared/isnan.o shared/kcos.o shared/kremp2.o shared/ksin.o shared/ktan.o shared/log.o shared/log10.o shared/log1p.o shared/pow.o shared/remp2.o shared/round.o shared/scalbn.o shared/sin.o shared/sinh.o shared/sqrt.o shared/tan.o shared/tanh.o shared/trunc.o + ${CC} ${CFLAGS} -shared -s -fPIC -Wl,-soname,${solib}.1.7.0 -o ${solib} shared/acos.o shared/acosh.o shared/acvs.o shared/ahv.o shared/ahvc.o shared/asin.o shared/asinh.o shared/atan.o shared/atan2.o shared/atanh.o shared/aver.o shared/cbrt.o shared/ceil.o shared/copysign.o shared/cos.o shared/cosh.o shared/exp.o shared/expm1.o shared/fabs.o shared/finite.o shared/floor.o shared/fmod.o shared/hypot.o shared/isnan.o shared/kcos.o shared/kremp2.o shared/ksin.o shared/ktan.o shared/log.o shared/log10.o shared/log1p.o shared/pow.o shared/remp2.o shared/round.o shared/scalbn.o shared/sin.o shared/sinh.o shared/sqrt.o shared/tan.o shared/tanh.o shared/trunc.o ${alib}: build static/acos.o static/acosh.o static/acvs.o static/ahv.o static/ahvc.o static/asin.o static/asinh.o static/atan.o static/atan2.o static/atanh.o static/aver.o static/cbrt.o static/ceil.o static/copysign.o static/cos.o static/cosh.o static/exp.o static/expm1.o static/fabs.o static/finite.o static/floor.o static/fmod.o static/hypot.o static/isnan.o static/kcos.o static/kremp2.o static/ksin.o static/ktan.o static/log.o static/log10.o static/log1p.o static/pow.o static/remp2.o static/round.o static/scalbn.o static/sin.o static/sinh.o static/sqrt.o static/tan.o static/tanh.o static/trunc.o ${AR} rcs static/${alib} static/acos.o static/acosh.o static/acvs.o static/ahv.o static/ahvc.o static/asin.o static/asinh.o static/atan.o static/atan2.o static/atanh.o static/aver.o static/cbrt.o static/ceil.o static/copysign.o static/cos.o static/cosh.o static/exp.o static/expm1.o static/fabs.o static/finite.o static/floor.o static/fmod.o static/hypot.o static/isnan.o static/kcos.o static/kremp2.o static/ksin.o static/ktan.o static/log.o static/log10.o static/log1p.o static/pow.o static/remp2.o static/round.o static/scalbn.o static/sin.o static/sinh.o static/sqrt.o static/tan.o static/tanh.o static/trunc.o @@ -276,14 +282,24 @@ ${alib}: build static/acos.o static/acosh.o static/acvs.o static/ahv.o static/a .PHONY: install install: ${alib} ${solib} - ${MKDIR} ${DESTDIR}${PREFIX}/lib - ${INSTALL} static/${alib} ${DESTDIR}${PREFIX}/lib/${alib} - ${INSTALL} ${solib} ${DESTDIR}${PREFIX}/lib/${solib} + ${MKDIR} ${INSTDIR} + ${MKDIR} ${INSTDIRPC} + ${MKDIR} ${INSTDIRI} + ${INSTALL} static/${alib} ${INSTDIR}/${alib} + ${INSTALL} ${solib} ${INSTDIR}/${solib} + ${INSTALL} ${pkgconfig} ${INSTDIRPC}/${pkgconfig} + ${INSTALL} ${manpage} ${INSTDIRM}/${manpage} + ${INSTALL} ../math.h ${INSTDIRI}/amathr.h + ${LDCONFIG} ${INSTDIR} .PHONY: uninstall uninstall: - ${DEL} ${DESTDIR}${PREFIX}/lib/${alib} - ${DEL} ${DESTDIR}${PREFIX}/lib/${solib} + ${DEL} ${INSTDIR}/${alib} + ${DEL} ${INSTDIR}/${solib} + ${DEL} ${INSTDIRPC}/${pkgconfig} + ${DEL} ${INSTDIRM}/${manpage} + ${DEL} ${INSTDIRI}/amathr.h + ${LDCONFIG} clean: ${DEL} static/${alib} ${solib} static/acos.o static/acosh.o static/acvs.o static/ahv.o static/ahvc.o static/asin.o static/asinh.o static/atan.o static/atan2.o static/atanh.o static/aver.o static/cbrt.o static/ceil.o static/copysign.o static/cos.o static/cosh.o static/exp.o static/expm1.o static/fabs.o static/finite.o static/floor.o static/fmod.o static/hypot.o static/isnan.o static/kcos.o static/kremp2.o static/ksin.o static/ktan.o static/log.o static/log10.o static/log1p.o static/pow.o static/remp2.o static/round.o static/scalbn.o static/sin.o static/sinh.o static/sqrt.o static/tan.o static/tanh.o static/trunc.o shared/acos.o shared/acosh.o shared/acvs.o shared/ahv.o shared/ahvc.o shared/asin.o shared/asinh.o shared/atan.o shared/atan2.o shared/atanh.o shared/aver.o shared/cbrt.o shared/ceil.o shared/copysign.o shared/cos.o shared/cosh.o shared/exp.o shared/expm1.o shared/fabs.o shared/finite.o shared/floor.o shared/fmod.o shared/hypot.o shared/isnan.o shared/kcos.o shared/kremp2.o shared/ksin.o shared/ktan.o shared/log.o shared/log10.o shared/log1p.o shared/pow.o shared/remp2.o shared/round.o shared/scalbn.o shared/sin.o shared/sinh.o shared/sqrt.o shared/tan.o shared/tanh.o shared/trunc.o diff --git a/src/real/amathr.3 b/src/real/amathr.3 new file mode 100644 index 00000000..c4f3b799 --- /dev/null +++ b/src/real/amathr.3 @@ -0,0 +1,3517 @@ +.TH "amath/math.h" 3 "Wed Mar 1 2017" "Version 1.7.0" "amath" \" -*- nroff -*- +.ad l +.nh +.SH NAME +math.h \- Functions in math library for handling real numbers + +.SH SYNOPSIS +.br +.PP +.SS "Macros" + +.in +1c +.ti -1c +.RI "#define \fBPI\fP 3\&.14159265358979323846" +.br +.ti -1c +.RI "#define \fBEULERS\fP 2\&.71828182845904523536" +.br +.ti -1c +.RI "#define \fBLOG2\fP 0\&.69314718055994530942" +.br +.ti -1c +.RI "#define \fBsgn\fP(x) (x > 0\&.0 ? 1\&.0 : x < 0\&.0 ? \-1\&.0 : 0\&.0)" +.br +.ti -1c +.RI "#define \fBisgn\fP(x) (x > 0 ? 1 : x < 0 ? \-1 : 0)" +.br +.ti -1c +.RI "#define \fBlog2p\fP(x, y) (y != 1\&.0 ? \fBlog\fP(y)/\fBlog\fP(x) : 0\&.0)" +.br +.ti -1c +.RI "#define \fBabs\fP(x) (x > 0 ? x : \-x)" +.br +.ti -1c +.RI "#define \fBD_INFN\fP 1\&.0e\-308" +.br +.ti -1c +.RI "#define \fBD_INFP\fP 1\&.0e+308" +.br +.in -1c +.SS "Functions" + +.in +1c +.ti -1c +.RI "int \fBisnan\fP (double x)" +.br +.RI "\fIisnan(x) returns 1 is x is nan, else 0\&. \fP" +.ti -1c +.RI "int \fBfinite\fP (double x)" +.br +.RI "\fIFinite or infinite number\&. \fP" +.ti -1c +.RI "double \fBfabs\fP (double x)" +.br +.RI "\fIReturns the absolute value of x\&. \fP" +.ti -1c +.RI "double \fBceil\fP (double x)" +.br +.RI "\fIMathematical ceiling function\&. \fP" +.ti -1c +.RI "double \fBfloor\fP (double x)" +.br +.RI "\fIMathematical floor function\&. \fP" +.ti -1c +.RI "double \fBround\fP (double x)" +.br +.ti -1c +.RI "double \fBtrunc\fP (double x)" +.br +.ti -1c +.RI "double \fBexp\fP (double x)" +.br +.RI "\fIReturns the exponential of x\&. \fP" +.ti -1c +.RI "double \fBsqrt\fP (double x)" +.br +.RI "\fISquare root function\&. \fP" +.ti -1c +.RI "double \fBcbrt\fP (double x)" +.br +.RI "\fICube root function\&. \fP" +.ti -1c +.RI "double \fBlog\fP (double x)" +.br +.RI "\fINatural logarithm function (base e)\&. \fP" +.ti -1c +.RI "double \fBlog10\fP (double x)" +.br +.RI "\fIBase 10 logarithm function\&. \fP" +.ti -1c +.RI "double \fBcos\fP (double x)" +.br +.RI "\fITrigonometric cosine function\&. \fP" +.ti -1c +.RI "double \fBsin\fP (double x)" +.br +.RI "\fITrigonometric sine function\&. \fP" +.ti -1c +.RI "double \fBtan\fP (double x)" +.br +.RI "\fITrigonometric tangent function\&. \fP" +.ti -1c +.RI "double \fBacos\fP (double x)" +.br +.RI "\fIInverse trigonometric cosine function\&. \fP" +.ti -1c +.RI "double \fBasin\fP (double x)" +.br +.RI "\fIInverse trigonometric sine function\&. \fP" +.ti -1c +.RI "double \fBatan\fP (double x)" +.br +.RI "\fIInverse trigonometric tangent function\&. \fP" +.ti -1c +.RI "double \fBcosh\fP (double x)" +.br +.RI "\fIHyperbolic cosine function\&. \fP" +.ti -1c +.RI "double \fBsinh\fP (double x)" +.br +.RI "\fIHyperbolic sine function\&. \fP" +.ti -1c +.RI "double \fBtanh\fP (double x)" +.br +.RI "\fIHyperbolic tangent function\&. \fP" +.ti -1c +.RI "double \fBacosh\fP (double x)" +.br +.RI "\fIInverse hyperbolic cosine function\&. \fP" +.ti -1c +.RI "double \fBasinh\fP (double x)" +.br +.RI "\fIInverse hyperbolic sine function\&. \fP" +.ti -1c +.RI "double \fBatanh\fP (double x)" +.br +.RI "\fIInverse hyperbolic tangent function\&. \fP" +.ti -1c +.RI "double \fBaver\fP (double x)" +.br +.ti -1c +.RI "double \fBacvs\fP (double x)" +.br +.ti -1c +.RI "double \fBahv\fP (double x)" +.br +.ti -1c +.RI "double \fBahvc\fP (double x)" +.br +.ti -1c +.RI "double \fBpow\fP (double x, double y)" +.br +.RI "\fIExpontation function\&. \fP" +.ti -1c +.RI "double \fBfmod\fP (double x, double y)" +.br +.RI "\fIReturn x mod y in exact arithmetic\&. \fP" +.ti -1c +.RI "double \fBatan2\fP (double y, double x)" +.br +.ti -1c +.RI "double \fBhypot\fP (double x, double y)" +.br +.ti -1c +.RI "double \fBlog1p\fP (double x)" +.br +.ti -1c +.RI "double \fBexpm1\fP (double x)" +.br +.ti -1c +.RI "double \fBscalbn\fP (double x, int n)" +.br +.ti -1c +.RI "double \fBcopysign\fP (double x, double y)" +.br +.RI "\fIReturns a value with the magnitude of x and with the sign bit of y\&. \fP" +.ti -1c +.RI "int \fBrempio2\fP (double x, double *y)" +.br +.in -1c +.SH "Detailed Description" +.PP +Functions in math library for handling real numbers\&. + +The library is based on fdlib by Sun Microsystems\&. +.PP +The original library can be downloaded at [netlib\&.org]: http://www.netlib.org/fdlibm/ +.PP +or from mirror site [hensa\&.ac\&.uk]: http://www.hensa.ac.uk/ +.PP +All headers and dates are preserved\&. +.PP +More info on double precision floating point at [Wikipedia]: https://wikipedia.org/wiki/Double-precision_floating-point_format +.PP +Definition in file \fBmath\&.h\fP\&. +.SH "Macro Definition Documentation" +.PP +.SS "#define abs(x) (x > 0 ? x : \-x)" + +.PP +Definition at line 56 of file math\&.h\&. +.SS "#define D_INFN 1\&.0e\-308" + +.PP +Definition at line 58 of file math\&.h\&. +.SS "#define D_INFP 1\&.0e+308" + +.PP +Definition at line 59 of file math\&.h\&. +.SS "#define EULERS 2\&.71828182845904523536" + +.PP +Definition at line 51 of file math\&.h\&. +.SS "#define isgn(x) (x > 0 ? 1 : x < 0 ? \-1 : 0)" + +.PP +Definition at line 54 of file math\&.h\&. +.SS "#define LOG2 0\&.69314718055994530942" + +.PP +Definition at line 52 of file math\&.h\&. +.SS "#define log2p(x, y) (y != 1\&.0 ? \fBlog\fP(y)/\fBlog\fP(x) : 0\&.0)" + +.PP +Definition at line 55 of file math\&.h\&. +.SS "#define PI 3\&.14159265358979323846" + +.PP +Definition at line 50 of file math\&.h\&. +.SS "#define sgn(x) (x > 0\&.0 ? 1\&.0 : x < 0\&.0 ? \-1\&.0 : 0\&.0)" + +.PP +Definition at line 53 of file math\&.h\&. +.SH "Function Documentation" +.PP +.SS "double acos (double x)" + +.PP +Inverse trigonometric cosine function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Method : + acos(x) = pi/2 - asin(x) + acos(-x) = pi/2 + asin(x) +For |x|<=0\&.5 + acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see \fBasin\&.c\fP) +For x>0\&.5 + acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2))) + = 2asin(sqrt((1-x)/2)) + = 2s + 2s*z*R(z) \&.\&.\&.z=(1-x)/2, s=sqrt(z) + = 2f + (2c + 2s*z*R(z)) + where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term + for f so that f+c ~ sqrt(z)\&. +For x<-0\&.5 + acos(x) = pi - 2asin(sqrt((1-|x|)/2)) + = pi - 0\&.5*(s+s*z*R(z)), where z=(1-|x|)/2,s=sqrt(z) +.fi +.PP +.PP +.PP +.nf +Special cases: + if x is NaN, return x itself; + if |x|>1, return NaN with invalid signal\&. +.fi +.PP +.PP +.PP +.nf +Function needed: sqrt +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 96 of file acos\&.c\&. +.PP +References one, pi, pio2_hi, pio2_lo, pS0, pS1, pS2, pS3, pS4, pS5, qS1, qS2, qS3, qS4, and sqrt()\&. +.PP +.nf +97 { +98 double z,p,q,r,w,s,c,df; +99 sword hx,ix; +100 GET_HIGH_WORD(hx,x); +101 ix = hx&0x7fffffff; +102 if(ix>=0x3ff00000) { /* |x| >= 1 */ +103 sword lx; +104 GET_LOW_WORD(lx,x); +105 if(((ix-0x3ff00000)|lx)==0) { /* |x|==1 */ +106 if(hx>0) return 0\&.0; /* acos(1) = 0 */ +107 else return pi+2\&.0*pio2_lo; /* acos(-1)= pi */ +108 } +109 return (x-x)/(x-x); /* acos(|x|>1) is NaN */ +110 } +111 if(ix<0x3fe00000) { /* |x| < 0\&.5 */ +112 if(ix<=0x3c600000) return pio2_hi+pio2_lo;/*if|x|<2**-57*/ +113 z = x*x; +114 p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); +115 q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); +116 r = p/q; +117 return pio2_hi - (x - (pio2_lo-x*r)); +118 } else if (hx<0) { /* x < -0\&.5 */ +119 z = (one+x)*0\&.5; +120 p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); +121 q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); +122 s = sqrt(z); +123 r = p/q; +124 w = r*s-pio2_lo; +125 return pi - 2\&.0*(s+w); +126 } else { /* x > 0\&.5 */ +127 z = (one-x)*0\&.5; +128 s = sqrt(z); +129 df = s; +130 SET_LOW_WORD(df,0); +131 c = (z-df*df)/(s+df); +132 p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); +133 q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); +134 r = p/q; +135 w = r*s+c; +136 return 2\&.0*(df+w); +137 } +138 } +.fi +.SS "double acosh (double x)" + +.PP +Inverse hyperbolic cosine function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Method : + Based on + acosh(x) = log [ x + sqrt(x*x-1) ] + we have + acosh(x) := log(x)+ln2, if x is large; else + acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else + acosh(x) := log1p(t+sqrt(2\&.0*t+t*t)); where t=x-1\&. +.fi +.PP +.PP +.PP +.nf +Special cases: + acosh(x) is NaN with signal if x<1\&. + acosh(NaN) is NaN without signal\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 75 of file acosh\&.c\&. +.PP +References ln2, log1p(), one, and sqrt()\&. +.PP +.nf +76 { +77 double t; +78 sword hx, lx; +79 GET_HIGH_WORD(hx,x); +80 GET_LOW_WORD(lx,x); +81 +82 if(hx<0x3ff00000) { /* x < 1 */ +83 return (x-x)/(x-x); +84 } else if(hx >=0x41b00000) { /* x > 2**28 */ +85 if(hx >=0x7ff00000) { /* x is inf of NaN */ +86 return x+x; +87 } else +88 return log(x)+ln2; /* acosh(huge)=log(2x) */ +89 } else if(((hx-0x3ff00000)|lx)==0) { +90 return 0\&.0; /* acosh(1) = 0 */ +91 } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ +92 t=x*x; +93 return log(2\&.0*x-one/(x+sqrt(t-one))); +94 } else { /* 10\&.98 + asin(x) = pi/2 - 2*(s+s*z*R(z)) + = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo) + For x<=0\&.98, let pio4_hi = pio2_hi/2, then + f = hi part of s; + c = sqrt(z) - f = (z-f*f)/(s+f) \&.\&.\&.f+c=sqrt(z) + and + asin(x) = pi/2 - 2*(s+s*z*R(z)) + = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo) + = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c)) +.fi +.PP +.PP +.PP +.nf +Special cases: + if x is NaN, return x itself; + if |x|>1, return NaN with invalid signal\&. +.fi +.PP +.PP +.PP +.nf +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 104 of file asin\&.c\&. +.PP +References huge, one, pio2_hi, pio2_lo, pio4_hi, pS0, pS1, pS2, pS3, pS4, pS5, qS1, qS2, qS3, qS4, and sqrt()\&. +.PP +.nf +105 { +106 double t,w,p,q,c,r,s; +107 sword hx,ix; +108 GET_HIGH_WORD(hx,x); +109 ix = hx&0x7fffffff; +110 if(ix>= 0x3ff00000) { /* |x|>= 1 */ +111 uword lx; +112 GET_LOW_WORD(lx,x); +113 if(((ix-0x3ff00000)|lx)==0) +114 /* asin(1)=+-pi/2 with inexact */ +115 return x*pio2_hi+x*pio2_lo; +116 return (x-x)/(x-x); /* asin(|x|>1) is NaN */ +117 } else if (ix<0x3fe00000) { /* |x|<0\&.5 */ +118 if(ix<0x3e400000) { /* if |x| < 2**-27 */ +119 if(huge+x>one) { +120 return x;/* return x with inexact if x!=0*/ +121 } else { +122 t = 0; +123 } +124 } else { +125 t = x*x; +126 } +127 +128 p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); +129 q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); +130 w = p/q; +131 return x+x*w; +132 } +133 /* 1> |x|>= 0\&.5 */ +134 w = one-fabs(x); +135 t = w*0\&.5; +136 p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); +137 q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); +138 s = sqrt(t); +139 if(ix>=0x3FEF3333) { /* if |x| > 0\&.975 */ +140 w = p/q; +141 t = pio2_hi-(2\&.0*(s+s*w)-pio2_lo); +142 } else { +143 w = s; +144 SET_LOW_WORD(w,0); +145 c = (t-w*w)/(s+w); +146 r = p/q; +147 p = 2\&.0*s*r-(pio2_lo-2\&.0*c); +148 q = pio4_hi-2\&.0*w; +149 t = pio4_hi-(p-q); +150 } +151 if(hx>0) return t; +152 else return -t; +153 } +.fi +.SS "double asinh (double x)" + +.PP +Inverse hyperbolic sine function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Method : + Based on + asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] + we have + asinh(x) := x if 1+x*x=1, + := sign(x)*(log(x)+ln2)) for large |x|, else + := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else + := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 73 of file asinh\&.c\&. +.PP +References huge, ln2, log1p(), one, and sqrt()\&. +.PP +.nf +74 { +75 double t,w; +76 sword hx,ix; +77 GET_HIGH_WORD(hx,x); +78 ix = hx&0x7fffffff; +79 if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */ +80 if(ix< 0x3e300000) { /* |x|<2**-28 */ +81 if(huge+x>one) return x; /* return x inexact except 0 */ +82 } +83 if(ix>0x41b00000) { /* |x| > 2**28 */ +84 w = log(fabs(x))+ln2; +85 } else if (ix>0x40000000) { /* 2**28 > |x| > 2\&.0 */ +86 t = fabs(x); +87 w = log(2\&.0*t+one/(sqrt(x*x+one)+t)); +88 } else { /* 2\&.0 > |x| > 2**-28 */ +89 t = x*x; +90 w =log1p(fabs(x)+t/(one+sqrt(one+t))); +91 } +92 if(hx>0) return w; +93 else return -w; +94 } +.fi +.SS "double atan (double x)" + +.PP +Inverse trigonometric tangent function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Method + 1\&. Reduce x to positive by atan(x) = -atan(-x)\&. + 2\&. According to the integer k=4t+0\&.25 chopped, t=x, the argument + is further reduced to one of the following intervals and the + arctangent of t is evaluated by the corresponding formula: +.fi +.PP +.PP +.PP +.nf + [0,7/16] atan(x) = t-t^3*(a1+t^2*(a2+\&.\&.\&.(a10+t^2*a11)\&.\&.\&.) + [7/16,11/16] atan(x) = atan(1/2) + atan( (t-0\&.5)/(1+t/2) ) + [11/16\&.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) ) + [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1\&.5)/(1+1\&.5t) ) + [39/16,INF] atan(x) = atan(INF) + atan( -1/t ) +.fi +.PP +.PP +.PP +.nf +Constants: +The hexadecimal values are the intended ones for the following +constants\&. The decimal values may be used, provided that the +compiler will convert from decimal to binary accurately enough +to produce the hexadecimal values shown\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 109 of file atan\&.c\&. +.PP +References aT, atanhi, atanlo, huge, and one\&. +.PP +.nf +110 { +111 double w,s1,s2,z; +112 sword ix,hx,id; +113 +114 GET_HIGH_WORD(hx,x); +115 ix = hx&0x7fffffff; +116 if(ix>=0x44100000) { /* if |x| >= 2^66 */ +117 uword low; +118 +119 GET_LOW_WORD(low,x); +120 if(ix>0x7ff00000|| +121 (ix==0x7ff00000&&(low!=0))) +122 return x+x; /* NaN */ +123 if(hx>0) return atanhi[3]+atanlo[3]; +124 else return -atanhi[3]-atanlo[3]; +125 } +126 if (ix < 0x3fdc0000) { /* |x| < 0\&.4375 */ +127 if (ix < 0x3e200000) { /* |x| < 2^-29 */ +128 if(huge+x>one) return x; /* raise inexact */ +129 } +130 id = -1; +131 } else { +132 x = fabs(x); +133 if (ix < 0x3ff30000) { /* |x| < 1\&.1875 */ +134 if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */ +135 id = 0; +136 x = (2\&.0*x-one)/(2\&.0+x); +137 } else { /* 11/16<=|x|< 19/16 */ +138 id = 1; +139 x = (x-one)/(x+one); +140 } +141 } else { +142 if (ix < 0x40038000) { /* |x| < 2\&.4375 */ +143 id = 2; +144 x = (x-1\&.5)/(one+1\&.5*x); +145 } else { /* 2\&.4375 <= |x| < 2^66 */ +146 id = 3; +147 x = -1\&.0/x; +148 } +149 } +150 } +151 /* end of argument reduction */ +152 z = x*x; +153 w = z*z; +154 /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ +155 s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); +156 s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); +157 if (id<0) return x - x*(s1+s2); +158 else { +159 z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); +160 return (hx<0)? -z:z; +161 } +162 } +.fi +.SS "double atan2 (double y, double x)" + +.PP +Definition at line 86 of file atan2\&.c\&. +.PP +References atan(), pi, pi_lo, pi_o_2, pi_o_4, tiny, and zero\&. +.PP +.nf +87 { +88 double z; +89 sword k,m,hx,hy,ix,iy; +90 uword lx,ly; +91 +92 EXTRACT_WORDS(hx,lx,x); +93 ix = hx&0x7fffffff; +94 EXTRACT_WORDS(hy,ly,y); +95 iy = hy&0x7fffffff; +96 if(((ix|((lx|-lx)>>31))>0x7ff00000)|| +97 ((iy|((ly|-ly)>>31))>0x7ff00000)) /* x or y is NaN */ +98 return x+y; +99 if(((hx-0x3ff00000)|lx)==0) return atan(y); /* x=1\&.0 */ +100 m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */ +101 +102 /* when y = 0 */ +103 if((iy|ly)==0) { +104 switch(m) { +105 case 0: +106 case 1: +107 return y; /* atan(+-0,+anything)=+-0 */ +108 case 2: +109 return pi+tiny;/* atan(+0,-anything) = pi */ +110 case 3: +111 return -pi-tiny;/* atan(-0,-anything) =-pi */ +112 } +113 } +114 /* when x = 0 */ +115 if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; +116 +117 /* when x is INF */ +118 if(ix==0x7ff00000) { +119 if(iy==0x7ff00000) { +120 switch(m) { +121 case 0: +122 return pi_o_4+tiny;/* atan(+INF,+INF) */ +123 case 1: +124 return -pi_o_4-tiny;/* atan(-INF,+INF) */ +125 case 2: +126 return 3\&.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ +127 case 3: +128 return -3\&.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ +129 } +130 } else { +131 switch(m) { +132 case 0: +133 return zero ; /* atan(+\&.\&.\&.,+INF) */ +134 case 1: +135 return -zero ; /* atan(-\&.\&.\&.,+INF) */ +136 case 2: +137 return pi+tiny ; /* atan(+\&.\&.\&.,-INF) */ +138 case 3: +139 return -pi-tiny ; /* atan(-\&.\&.\&.,-INF) */ +140 } +141 } +142 } +143 /* when y is INF */ +144 if(iy==0x7ff00000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; +145 +146 /* compute y/x */ +147 k = (iy-ix)>>20; +148 if(k > 60) z=pi_o_2+0\&.5*pi_lo; /* |y/x| > 2**60 */ +149 else if(hx<0&&k<-60) z=0\&.0; /* |y|/x < -2**60 */ +150 else z=atan(fabs(y/x)); /* safe to do y/x */ +151 switch (m) { +152 case 0: +153 return z ; /* atan(+,+) */ +154 case 1: { +155 uword zh; +156 GET_HIGH_WORD(zh,z); +157 SET_HIGH_WORD(z, zh ^ 0x80000000); +158 } +159 return z ; /* atan(-,+) */ +160 case 2: +161 return pi-(z-pi_lo);/* atan(+,-) */ +162 default: /* case 3 */ +163 return (z-pi_lo)-pi;/* atan(-,-) */ +164 } +165 } +.fi +.SS "double atanh (double x)" + +.PP +Inverse hyperbolic tangent function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Method : + 1\&.Reduced x to positive by atanh(-x) = -atanh(x) + 2\&.For x>=0\&.5 + 1 2x x + atanh(x) = --- * log(1 + -------) = 0\&.5 * log1p(2 * --------) + 2 1 - x 1 - x +.fi +.PP +.PP +.PP +.nf + For x<0\&.5 + atanh(x) = 0\&.5*log1p(2x+2x*x/(1-x)) +.fi +.PP +.PP +.PP +.nf +Special cases: + atanh(x) is NaN if |x| > 1 with signal; + atanh(NaN) is that NaN with no signal; + atanh(+-1) is +-INF with signal\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 81 of file atanh\&.c\&. +.PP +References huge, log1p(), one, and zero\&. +.PP +.nf +82 { +83 double t; +84 sword hx,ix; +85 uword lx; +86 GET_HIGH_WORD(hx,x); +87 GET_LOW_WORD(lx,x); +88 ix = hx&0x7fffffff; +89 if ((ix|((lx|(-lx))>>31))>0x3ff00000) /* |x|>1 */ +90 return (x-x)/(x-x); +91 if(ix==0x3ff00000) +92 return x/zero; +93 if(ix<0x3e300000&&(huge+x)>zero) return x; /* x<2**-28 */ +94 SET_HIGH_WORD(x, ix); /* x <- |x| */ +95 if(ix<0x3fe00000) { /* x < 0\&.5 */ +96 t = x+x; +97 t = 0\&.5*log1p(t+t*x/(one-x)); +98 } else +99 t = 0\&.5*log1p((x+x)/(one-x)); +100 if(hx>=0) return t; +101 else return -t; +102 } +.fi +.SS "double aver (double x)" + +.PP +Definition at line 33 of file aver\&.c\&. +.PP +References atan(), and sqrt()\&. +.PP +.nf +34 { +35 double a = 2\&.0 * x - x * x; +36 double b = sqrt(a); +37 double c = 1\&.0 - x; +38 double d = atan(b / c); +39 +40 return d; +41 } +.fi +.SS "double cbrt (double x)" + +.PP +Cube root function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 67 of file cbrt\&.c\&. +.PP +References B1, B2, C, D, E, F, and G\&. +.PP +.nf +68 { +69 sword hx, lx, ht; +70 double r,s,t=0\&.0,w; +71 uword sign; +72 +73 GET_HIGH_WORD(hx,x); /* high word of x */ +74 sign=hx&0x80000000; /* sign= sign(x) */ +75 hx ^=sign; +76 if(hx>=0x7ff00000) return(x+x); /* cbrt(NaN,INF) is itself */ +77 GET_LOW_WORD(lx, x); +78 if((hx|lx)==0) +79 return(x); /* cbrt(0) is itself */ +80 +81 SET_HIGH_WORD(x,hx); /* x <- |x| */ +82 /* rough cbrt to 5 bits */ +83 if(hx<0x00100000) /* subnormal number */ +84 { +85 SET_HIGH_WORD(t,0x43500000); /* set t= 2**54 */ +86 t*=x; +87 GET_HIGH_WORD(ht,t); +88 SET_HIGH_WORD(t,ht/3+B2); +89 } +90 else +91 SET_HIGH_WORD(t,hx/3+B1); +92 +93 /* new cbrt to 23 bits, may be implemented in single precision */ +94 r=t*t/x; +95 s=C+r*t; +96 t*=G+F/(s+E+D/s); +97 +98 /* chopped to 20 bits and make it larger than cbrt(x) */ +99 SET_LOW_WORD(t,0); +100 GET_HIGH_WORD(ht,t); +101 SET_HIGH_WORD(t,ht + 0x00000001); +102 +103 /* one step newton iteration to 53 bits with error less than 0\&.667 ulps */ +104 s=t*t; /* t*t is exact */ +105 r=x/s; +106 w=t+t; +107 r=(r-t)/(w+r); /* r-s is exact */ +108 t=t+t*r; +109 +110 /* retore the sign bit */ +111 GET_HIGH_WORD(ht,t); +112 SET_HIGH_WORD(t,ht|sign); +113 +114 return(t); +115 } +.fi +.SS "double ceil (double x)" + +.PP +Mathematical ceiling function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Return x rounded toward -inf to integral value +Method: + Bit twiddling\&. +Exception: + Inexact flag raised if x not equal to ceil(x)\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 65 of file ceil\&.c\&. +.PP +References huge\&. +.PP +.nf +66 { +67 sword i0,i1,j0; +68 uword i,j; +69 EXTRACT_WORDS(i0,i1,x); +70 j0 = ((i0>>20)&0x7ff)-0x3ff; +71 if(j0<20) { +72 if(j0<0) { /* raise inexact if x != 0 */ +73 if(huge+x>0\&.0) { /* return 0*sign(x) if |x|<1 */ +74 if(i0<0) { +75 i0=0x80000000; +76 i1=0; +77 } +78 else if((i0|i1)!=0) { +79 i0=0x3ff00000; +80 i1=0; +81 } +82 } +83 } else { +84 i = (0x000fffff)>>j0; +85 if(((i0&i)|i1)==0) return x; /* x is integral */ +86 if(huge+x>0\&.0) { /* raise inexact flag */ +87 if(i0>0) i0 += (0x00100000)>>j0; +88 i0 &= (~i); +89 i1=0; +90 } +91 } +92 } else if (j0>51) { +93 if(j0==0x400) return x+x; /* inf or NaN */ +94 else return x; /* x is integral */ +95 } else { +96 i = ((uword)(0xffffffff))>>(j0-20); +97 if((i1&i)==0) return x; /* x is integral */ +98 if(huge+x>0\&.0) { /* raise inexact flag */ +99 if(i0>0) { +100 if(j0==20) i0+=1; +101 else { +102 j = i1 + (1<<(52-j0)); +103 // NOTICE: Is this a correct cast? +104 if((sword)j<(sword)i1) i0+=1; /* got a carry */ +105 i1 = j; +106 } +107 } +108 i1 &= (~i); +109 } +110 } +111 INSERT_WORDS(x,i0,i1); +112 return x; +113 } +.fi +.SS "double copysign (double x, double y)" + +.PP +Returns a value with the magnitude of x and with the sign bit of y\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP + +.PP +Definition at line 52 of file copysign\&.c\&. +.PP +.nf +53 { +54 uword hx, hy; +55 GET_HIGH_WORD(hx, x); +56 GET_HIGH_WORD(hy, y); +57 SET_HIGH_WORD(x, (hx&0x7fffffff)|(hy&0x80000000)); +58 return x; +59 } +.fi +.SS "double cos (double x)" + +.PP +Trigonometric cosine function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Return cosine function of x\&. +.fi +.PP +.PP +.PP +.nf +kernel function: + __kernel_sin \&.\&.\&. sine function on [-pi/4,pi/4] + __kernel_cos \&.\&.\&. cosine function on [-pi/4,pi/4] + rem_pio2 \&.\&.\&. argument reduction routine +.fi +.PP +.PP +.PP +.nf +Method\&. + Let S,C and T denote the sin, cos and tan respectively on + [-PI/4, +PI/4]\&. Reduce the argument x to y1+y2 = x-k*pi/2 + in [-pi/4 , +pi/4], and let n = k mod 4\&. + We have +.fi +.PP +.PP +.PP +.nf + n sin(x) cos(x) tan(x) + ---------------------------------------------------------- + 0 S C T + 1 C -S -1/T + 2 -S -C T + 3 -C S -1/T + ---------------------------------------------------------- +.fi +.PP +.PP +.PP +.nf +Special cases: + Let trig be any of sin, cos, or tan\&. + trig(+-INF) is NaN, with signals; + trig(NaN) is that NaN; +.fi +.PP +.PP +.PP +.nf +Accuracy: + TRIG(x) returns trig(x) nearly rounded +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 87 of file cos\&.c\&. +.PP +References __kernel_cos(), __kernel_sin(), and rempio2()\&. +.PP +.nf +88 { +89 double y[2],z=0\&.0; +90 sword n, ix; +91 +92 /* High word of x\&. */ +93 GET_HIGH_WORD(ix,x); +94 +95 /* |x| ~< pi/4 */ +96 ix &= 0x7fffffff; +97 if(ix <= 0x3fe921fb) return __kernel_cos(x,z); +98 +99 /* cos(Inf or NaN) is NaN */ +100 else if (ix>=0x7ff00000) return x-x; +101 +102 /* argument reduction needed */ +103 else { +104 n = rempio2(x,y); +105 switch(n&3) { +106 case 0: +107 return __kernel_cos(y[0],y[1]); +108 case 1: +109 return -__kernel_sin(y[0],y[1],1); +110 case 2: +111 return -__kernel_cos(y[0],y[1]); +112 default: +113 return __kernel_sin(y[0],y[1],1); +114 } +115 } +116 } +.fi +.SS "double cosh (double x)" + +.PP +Hyperbolic cosine function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Method : +mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2 + 1\&. Replace x by |x| (cosh(x) = cosh(-x))\&. + 2\&. + [ exp(x) - 1 ]^2 + 0 <= x <= ln2/2 : cosh(x) := 1 + ------------------- + 2*exp(x) +.fi +.PP +.PP +.PP +.nf + exp(x) + 1/exp(x) + ln2/2 <= x <= 22 : cosh(x) := ------------------- + 2 + 22 <= x <= lnovft : cosh(x) := exp(x)/2 + lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2) + ln2ovft < x : cosh(x) := huge*huge (overflow) +.fi +.PP +.PP +.PP +.nf +Special cases: + cosh(x) is |x| if x is +INF, -INF, or NaN\&. + only cosh(0)=1 is exact for finite x\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 84 of file cosh\&.c\&. +.PP +References exp(), expm1(), half, huge, and one\&. +.PP +.nf +85 { +86 double t,w; +87 sword ix; +88 uword lx; +89 +90 /* High word of |x|\&. */ +91 GET_HIGH_WORD(ix,x); +92 ix &= 0x7fffffff; +93 +94 /* x is INF or NaN */ +95 if(ix>=0x7ff00000) return x*x; +96 +97 /* |x| in [0,0\&.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ +98 if(ix<0x3fd62e43) { +99 t = expm1(fabs(x)); +100 w = one+t; +101 if (ix<0x3c800000) return w; /* cosh(tiny) = 1 */ +102 return one+(t*t)/(w+w); +103 } +104 +105 /* |x| in [0\&.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ +106 if (ix < 0x40360000) { +107 t = exp(fabs(x)); +108 return half*t+half/t; +109 } +110 +111 /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ +112 if (ix < 0x40862E42) return half*exp(fabs(x)); +113 +114 /* |x| in [log(maxdouble), overflowthresold] */ +115 lx = *( (((*(unsigned*)&one)>>29)) + (unsigned*)&x); +116 if (ix<0x408633CE || +117 ((ix==0x408633ce)&&(lx<=(unsigned)0x8fb9f87d))) { +118 w = exp(half*fabs(x)); +119 t = half*w; +120 return t*w; +121 } +122 +123 /* |x| > overflowthresold, cosh(x) overflow */ +124 return huge*huge; +125 } +.fi +.SS "double exp (double x)" + +.PP +Returns the exponential of x\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.6 +.RE +.PP +\fBDate:\fP +.RS 4 +04/04/22 +.RE +.PP +.PP +.nf + +Method + 1\&. Argument reduction: + Reduce x to an r so that |r| <= 0\&.5*ln2 ~ 0\&.34658\&. + Given x, find r and integer k such that +.fi +.PP +.PP +.PP +.nf + x = k*ln2 + r, |r| <= 0\&.5*ln2\&. +.fi +.PP +.PP +.PP +.nf + Here r will be represented as r = hi-lo for better + accuracy\&. +.fi +.PP +.PP +.PP +.nf + 2\&. Approximation of exp(r) by a special rational function on + the interval [0,0\&.34658]: + Write + R(r**2) = r*(exp(r)+1)/(exp(r)-1) = 2 + r*r/6 - r**4/360 + \&.\&.\&. + We use a special Remes algorithm on [0,0\&.34658] to generate + a polynomial of degree 5 to approximate R\&. The maximum error + of this polynomial approximation is bounded by 2**-59\&. In + other words, + R(z) ~ 2\&.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5 + (where z=r*r, and the values of P1 to P5 are listed below) + and + | 5 | -59 + | 2\&.0+P1*z+\&.\&.\&.+P5*z - R(z) | <= 2 + | | + The computation of exp(r) thus becomes + 2*r + exp(r) = 1 + ------- + R - r + r*R1(r) + = 1 + r + ----------- (for better accuracy) + 2 - R1(r) + where + 2 4 10 + R1(r) = r - (P1*r + P2*r + \&.\&.\&. + P5*r )\&. +.fi +.PP +.PP +.PP +.nf + 3\&. Scale back to obtain exp(x): + From step 1, we have + exp(x) = 2^k * exp(r) +.fi +.PP +.PP +.PP +.nf +Special cases: + exp(INF) is INF, exp(NaN) is NaN; + exp(-INF) is 0, and + for finite argument, only exp(0)=1 is exact\&. +.fi +.PP +.PP +.PP +.nf +Accuracy: + according to an error analysis, the error is always less than + 1 ulp (unit in the last place)\&. +.fi +.PP +.PP +.PP +.nf +Misc\&. info\&. + For IEEE double + if x > 7\&.09782712893383973096e+02 then exp(x) overflow + if x < -7\&.45133219101941108420e+02 then exp(x) underflow +.fi +.PP +.PP +.PP +.nf +Constants: +The hexadecimal values are the intended ones for the following +constants\&. The decimal values may be used, provided that the +compiler will convert from decimal to binary accurately enough +to produce the hexadecimal values shown\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 134 of file exp\&.c\&. +.PP +References halF, huge, invln2, ln2HI, ln2LO, o_threshold, one, P1, P2, P3, P4, P5, twom1000, and u_threshold\&. +.PP +.nf +135 { +136 double y,hi,lo,c,t; +137 sword k,xsb; +138 uword hx; +139 +140 lo = 0\&.0; +141 hi = 0\&.0; +142 +143 GET_HIGH_WORD(hx,x); /* high word of x */ +144 xsb = (hx>>31)&1; /* sign bit of x */ +145 hx &= 0x7fffffff; /* high word of |x| */ +146 +147 /* filter out non-finite argument */ +148 if(hx >= 0x40862E42) { /* if |x|>=709\&.78\&.\&.\&. */ +149 if(hx>=0x7ff00000) { +150 uword lx; +151 GET_LOW_WORD(lx,x); +152 if(((hx&0xfffff)|lx)!=0) +153 return x+x; /* NaN */ +154 else return (xsb==0)? x:0\&.0; /* exp(+-inf)={inf,0} */ +155 } +156 if(x > o_threshold) return huge*huge; /* overflow */ +157 if(x < u_threshold) return twom1000*twom1000; /* underflow */ +158 } +159 +160 /* argument reduction */ +161 if(hx > 0x3fd62e42) { /* if |x| > 0\&.5 ln2 */ +162 if(hx < 0x3FF0A2B2) { /* and |x| < 1\&.5 ln2 */ +163 hi = x-ln2HI[xsb]; +164 lo=ln2LO[xsb]; +165 k = 1-xsb-xsb; +166 } else { +167 k = (sword)(invln2*x+halF[xsb]); +168 t = k; +169 hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */ +170 lo = t*ln2LO[0]; +171 } +172 x = hi - lo; +173 } +174 else if(hx < 0x3e300000) { /* when |x|<2**-28 */ +175 if(huge+x>one) { +176 return one+x; /* trigger inexact */ +177 } else { +178 k = 0; +179 } +180 } +181 else k = 0; +182 +183 /* x is now in primary range */ +184 t = x*x; +185 c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); +186 if(k==0) return one-((x*c)/(c-2\&.0)-x); +187 else y = one-((lo-(x*c)/(2\&.0-c))-hi); +188 if(k >= -1021) { +189 uword hy; +190 GET_HIGH_WORD(hy, y); +191 SET_HIGH_WORD(y, hy + (k<<20)); /* add k to y's exponent */ +192 return y; +193 } else { +194 uword hy; +195 GET_HIGH_WORD(hy, y); +196 SET_HIGH_WORD(y, hy + ((k+1000)<<20));/* add k to y's exponent */ +197 return y*twom1000; +198 } +199 } +.fi +.SS "double expm1 (double x)" + +.PP +Definition at line 156 of file expm1\&.c\&. +.PP +References huge, invln2, ln2_hi, ln2_lo, o_threshold, one, Q1, Q2, Q3, Q4, Q5, and tiny\&. +.PP +.nf +157 { +158 double y,hi,lo,c,t,e,hxs,hfx,r1; +159 sword k,xsb; +160 uword hx; +161 +162 c = 0\&.0; +163 +164 GET_HIGH_WORD(hx,x); /* high word of x */ +165 xsb = hx&0x80000000; /* sign bit of x */ +166 if(xsb==0) y=x; +167 else y= -x; /* y = |x| */ +168 hx &= 0x7fffffff; /* high word of |x| */ +169 +170 /* filter out huge and non-finite argument */ +171 if(hx >= 0x4043687A) { /* if |x|>=56*ln2 */ +172 if(hx >= 0x40862E42) { /* if |x|>=709\&.78\&.\&.\&. */ +173 if(hx>=0x7ff00000) { +174 uword low; +175 GET_LOW_WORD(low,x); +176 if(((hx&0xfffff)|low)!=0) +177 return x+x; /* NaN */ +178 else return (xsb==0)? x:-1\&.0;/* exp(+-inf)={inf,-1} */ +179 } +180 if(x > o_threshold) return huge*huge; /* overflow */ +181 } +182 if(xsb!=0) { /* x < -56*ln2, return -1\&.0 with inexact */ +183 if(x+tiny<0\&.0) /* raise inexact */ +184 return tiny-one; /* return -1 */ +185 } +186 } +187 +188 /* argument reduction */ +189 if(hx > 0x3fd62e42) { /* if |x| > 0\&.5 ln2 */ +190 if(hx < 0x3FF0A2B2) { /* and |x| < 1\&.5 ln2 */ +191 if(xsb==0) +192 { +193 hi = x - ln2_hi; +194 lo = ln2_lo; +195 k = 1; +196 } +197 else +198 { +199 hi = x + ln2_hi; +200 lo = -ln2_lo; +201 k = -1; +202 } +203 } else { +204 k = (sword)(invln2*x+((xsb==0)?0\&.5:-0\&.5)); +205 t = k; +206 hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ +207 lo = t*ln2_lo; +208 } +209 x = hi - lo; +210 c = (hi-x)-lo; +211 } +212 else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ +213 t = huge+x; /* return x with inexact flags when x!=0 */ +214 return x - (t-(huge+x)); +215 } +216 else k = 0; +217 +218 /* x is now in primary range */ +219 hfx = 0\&.5*x; +220 hxs = x*hfx; +221 r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5)))); +222 t = 3\&.0-r1*hfx; +223 e = hxs*((r1-t)/(6\&.0 - x*t)); +224 if(k==0) return x - (x*e-hxs); /* c is 0 */ +225 else { +226 e = (x*(e-c)-c); +227 e -= hxs; +228 if(k== -1) return 0\&.5*(x-e)-0\&.5; +229 if(k==1) { +230 if(x < -0\&.25) return -2\&.0*(e-(x+0\&.5)); +231 else return one+2\&.0*(x-e); +232 } +233 if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ +234 uword hy; +235 +236 y = one-(e-x); +237 GET_HIGH_WORD(hy,y); +238 SET_HIGH_WORD(y, hy + (k<<20)); /* add k to y's exponent */ +239 return y-one; +240 } +241 t = one; +242 if(k<20) { +243 uword hy; +244 +245 SET_HIGH_WORD(t, 0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */ +246 y = t-(e-x); +247 GET_HIGH_WORD(hy, y); +248 SET_HIGH_WORD(y, hy + (k<<20)); /* add k to y's exponent */ +249 } else { +250 uword hy; +251 +252 SET_HIGH_WORD(t, (0x3ff-k)<<20); /* 2^-k */ +253 y = x-(e+t); +254 y += one; +255 GET_HIGH_WORD(hy, y); +256 SET_HIGH_WORD(y, hy + (k<<20)); /* add k to y's exponent */ +257 } +258 } +259 return y; +260 } +.fi +.SS "double fabs (double x)" + +.PP +Returns the absolute value of x\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP + +.PP +Definition at line 51 of file fabs\&.c\&. +.PP +.nf +52 { +53 uword hx; +54 GET_HIGH_WORD(hx,x); +55 SET_HIGH_WORD(x, hx & 0x7fffffff); +56 return x; +57 } +.fi +.SS "int finite (double x)" + +.PP +Finite or infinite number\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +finite(x) returns 1 is x is finite, else 0\&. NOTICE: No branching! +.PP +Definition at line 53 of file finite\&.c\&. +.PP +.nf +54 { +55 uword hx; +56 GET_HIGH_WORD(hx,x); +57 return (unsigned)((hx&0x7fffffff)-0x7ff00000)>>31; +58 } +.fi +.SS "double floor (double x)" + +.PP +Mathematical floor function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Return x rounded toward -inf to integral value +Method: + Bit twiddling\&. +Exception: + Inexact flag raised if x not equal to floor(x)\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 66 of file floor\&.c\&. +.PP +References huge\&. +.PP +.nf +67 { +68 sword i0,i1,j0; +69 uword i,j; +70 EXTRACT_WORDS(i0,i1,x); +71 j0 = ((i0>>20)&0x7ff)-0x3ff; +72 if(j0<20) { +73 if(j0<0) { /* raise inexact if x != 0 */ +74 if(huge+x>0\&.0) {/* return 0*sign(x) if |x|<1 */ +75 if(i0>=0) { +76 i0=i1=0; +77 } +78 else if(((i0&0x7fffffff)|i1)!=0) +79 { +80 i0=0xbff00000; +81 i1=0; +82 } +83 } +84 } else { +85 i = (0x000fffff)>>j0; +86 if(((i0&i)|i1)==0) return x; /* x is integral */ +87 if(huge+x>0\&.0) { /* raise inexact flag */ +88 if(i0<0) i0 += (0x00100000)>>j0; +89 i0 &= (~i); +90 i1=0; +91 } +92 } +93 } else if (j0>51) { +94 if(j0==0x400) return x+x; /* inf or NaN */ +95 else return x; /* x is integral */ +96 } else { +97 i = ((uword)(0xffffffff))>>(j0-20); +98 if((i1&i)==0) return x; /* x is integral */ +99 if(huge+x>0\&.0) { /* raise inexact flag */ +100 if(i0<0) { +101 if(j0==20) i0+=1; +102 else { +103 j = i1+(1<<(52-j0)); +104 if(j<(uword)i1) i0 +=1 ; /* got a carry */ +105 i1=j; +106 } +107 } +108 i1 &= (~i); +109 } +110 } +111 INSERT_WORDS(x,i0,i1); +112 return x; +113 } +.fi +.SS "double fmod (double x, double y)" + +.PP +Return x mod y in exact arithmetic\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +Method: shift and subtract +.PP +Definition at line 58 of file fmod\&.c\&. +.PP +References one, and Zero\&. +.PP +.nf +59 { +60 sword n,hx,hy,hz,ix,iy,sx,i; +61 uword lx,ly,lz; +62 +63 EXTRACT_WORDS(hx,lx,x); +64 EXTRACT_WORDS(hy,ly,y); +65 sx = hx&0x80000000; /* sign of x */ +66 hx ^=sx; /* |x| */ +67 hy &= 0x7fffffff; /* |y| */ +68 +69 /* purge off exception values */ +70 if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */ +71 ((hy|((ly|-ly)>>31))>0x7ff00000)) /* or y is NaN */ +72 return (x*y)/(x*y); +73 if(hx<=hy) { +74 if((hx>31]; /* |x|=|y| return x*0*/ +77 } +78 +79 /* determine ix = ilogb(x) */ +80 if(hx<0x00100000) { /* subnormal x */ +81 if(hx==0) { +82 for (ix = -1043, i=lx; i>0; i<<=1) ix -=1; +83 } else { +84 for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1; +85 } +86 } else ix = (hx>>20)-1023; +87 +88 /* determine iy = ilogb(y) */ +89 if(hy<0x00100000) { /* subnormal y */ +90 if(hy==0) { +91 for (iy = -1043, i=ly; i>0; i<<=1) iy -=1; +92 } else { +93 for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1; +94 } +95 } else iy = (hy>>20)-1023; +96 +97 /* set up {hx,lx}, {hy,ly} and align y to x */ +98 if(ix >= -1022) +99 hx = 0x00100000|(0x000fffff&hx); +100 else { /* subnormal x, shift x to normal */ +101 n = -1022-ix; +102 if(n<=31) { +103 hx = (hx<>(32-n)); +104 lx <<= n; +105 } else { +106 hx = lx<<(n-32); +107 lx = 0; +108 } +109 } +110 if(iy >= -1022) +111 hy = 0x00100000|(0x000fffff&hy); +112 else { /* subnormal y, shift y to normal */ +113 n = -1022-iy; +114 if(n<=31) { +115 hy = (hy<>(32-n)); +116 ly <<= n; +117 } else { +118 hy = ly<<(n-32); +119 ly = 0; +120 } +121 } +122 +123 /* fix point fmod */ +124 n = ix - iy; +125 while(n--) { +126 hz=hx-hy; +127 lz=lx-ly; +128 if(lx>31); +131 lx = lx+lx; +132 } +133 else { +134 if((hz|lz)==0) /* return sign(x)*0 */ +135 return Zero[(uword)sx>>31]; +136 hx = hz+hz+(lz>>31); +137 lx = lz+lz; +138 } +139 } +140 hz=hx-hy; +141 lz=lx-ly; +142 if(lx=0) { +144 hx=hz; +145 lx=lz; +146 } +147 +148 /* convert back to floating value and restore the sign */ +149 if((hx|lx)==0) /* return sign(x)*0 */ +150 return Zero[(unsigned)sx>>31]; +151 while(hx<0x00100000) { /* normalize x */ +152 hx = hx+hx+(lx>>31); +153 lx = lx+lx; +154 iy -= 1; +155 } +156 if(iy>= -1022) { /* normalize output */ +157 hx = ((hx-0x00100000)|((iy+1023)<<20)); +158 INSERT_WORDS(x,hx|sx,lx); +159 } else { /* subnormal output */ +160 n = -1022 - iy; +161 if(n<=20) { +162 lx = (lx>>n)|((uword)hx<<(32-n)); +163 hx >>= n; +164 } else if (n<=31) { +165 lx = (hx<<(32-n))|(lx>>n); +166 hx = sx; +167 } else { +168 lx = hx>>(n-32); +169 hx = sx; +170 } +171 INSERT_WORDS(x,hx|sx,lx); +172 x *= one; /* create necessary signal */ +173 } +174 return x; /* exact output */ +175 } +.fi +.SS "double hypot (double x, double y)" + +.PP +Definition at line 79 of file hypot\&.c\&. +.PP +References sqrt()\&. +.PP +.nf +80 { +81 double a=x,b=y,t1,t2,y1,y2,w; +82 uword j,k,ha,hb,hx,hy; +83 +84 GET_HIGH_WORD(hx,x); +85 GET_HIGH_WORD(hy,y); +86 ha = hx&0x7fffffff; /* high word of x */ +87 hb = hy&0x7fffffff; /* high word of y */ +88 if(hb > ha) { +89 a=y; +90 b=x; +91 j=ha; +92 ha=hb; +93 hb=j; +94 } +95 else { +96 a=x; +97 b=y; +98 } +99 SET_HIGH_WORD(a,ha); /* a <- |a| */ +100 SET_HIGH_WORD(b,hb); /* b <- |b| */ +101 if((ha-hb)>0x3c00000) { +102 return a+b; /* x/y > 2**60 */ +103 } +104 k=0; +105 if(ha > 0x5f300000) { /* a>2**500 */ +106 if(ha >= 0x7ff00000) { /* Inf or NaN */ +107 uword la, lb; +108 w = a+b; /* for sNaN */ +109 GET_LOW_WORD(la,a); +110 GET_LOW_WORD(lb,b); +111 if(((ha&0xfffff)|la)==0) w = a; +112 if(((hb^0x7ff00000)|lb)==0) w = b; +113 return w; +114 } +115 /* scale a and b by 2**-600 */ +116 ha -= 0x25800000; +117 hb -= 0x25800000; +118 k += 600; +119 SET_HIGH_WORD(a,ha); +120 SET_HIGH_WORD(b,hb); +121 } +122 if(hb < 0x20b00000) { /* b < 2**-500 */ +123 if(hb <= 0x000fffff) { /* subnormal b or 0 */ +124 uword lb; +125 GET_LOW_WORD(lb,b); +126 if((hb|lb)==0) return a; +127 t1=0; +128 SET_HIGH_WORD(t1, 0x7fd00000); /* t1=2^1022 */ +129 b *= t1; +130 a *= t1; +131 k -= 1022; +132 } else { /* scale a and b by 2^600 */ +133 ha += 0x25800000; /* a *= 2^600 */ +134 hb += 0x25800000; /* b *= 2^600 */ +135 k -= 600; +136 +137 SET_HIGH_WORD(a,ha); +138 SET_HIGH_WORD(b,hb); +139 } +140 } +141 /* medium size a and b */ +142 w = a-b; +143 if (w>b) { +144 t1 = 0; +145 SET_HIGH_WORD(t1, ha); +146 t2 = a-t1; +147 w = sqrt(t1*t1-(b*(-b)-t2*(a+t1))); +148 } else { +149 a = a+a; +150 y1 = 0; +151 SET_HIGH_WORD(y1, hb); +152 y2 = b - y1; +153 t1 = 0; +154 SET_HIGH_WORD(t1, ha+0x00100000); +155 t2 = a - t1; +156 w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); +157 } +158 if(k!=0) { +159 uword ht1; +160 +161 t1 = 1\&.0; +162 GET_HIGH_WORD(ht1, t1); +163 SET_HIGH_WORD(t1, ht1 + (k<<20)); +164 return t1*w; +165 } else return w; +166 } +.fi +.SS "int isnan (double x)" + +.PP +isnan(x) returns 1 is x is nan, else 0\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +NOTICE: No branching! +.PP +Definition at line 49 of file isnan\&.c\&. +.PP +.nf +50 { +51 return ((x) != (x)); +52 } +.fi +.SS "double log (double x)" + +.PP +Natural logarithm function (base e)\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.4 +.RE +.PP +\fBDate:\fP +.RS 4 +96/03/07 +.RE +.PP +.PP +.nf + +Method : + 1\&. Argument Reduction: find k and f such that + x = 2^k * (1+f), + where sqrt(2)/2 < 1+f < sqrt(2) \&. +.fi +.PP +.PP +.PP +.nf + 2\&. Approximation of log(1+f)\&. + Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) + = 2s + 2/3 s**3 + 2/5 s**5 + \&.\&.\&.\&.\&., + = 2s + s*R + We use a special Remes algorithm on [0,0\&.1716] to generate + a polynomial of degree 14 to approximate R The maximum error + of this polynomial approximation is bounded by 2**-58\&.45\&. In + other words, + 2 4 6 8 10 12 14 + R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s +Lg6*s +Lg7*s + (the values of Lg1 to Lg7 are listed in the program) + and + | 2 14 | -58\&.45 + | Lg1*s +\&.\&.\&.+Lg7*s - R(z) | <= 2 + | | + Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2\&. + In order to guarantee error in log below 1ulp, we compute log + by + log(1+f) = f - s*(f - R) (if f is not too large) + log(1+f) = f - (hfsq - s*(hfsq+R))\&. (better accuracy) +.fi +.PP +.PP +.PP +.nf + 3\&. Finally, log(x) = k*ln2 + log(1+f)\&. + = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) + Here ln2 is split into two floating point number: + ln2_hi + ln2_lo, + where n*ln2_hi is always exact for |n| < 2000\&. +.fi +.PP +.PP +.PP +.nf +Special cases: + log(x) is NaN with signal if x < 0 (including -INF) ; + log(+INF) is +INF; log(0) is -INF with signal; + log(NaN) is that NaN with no signal\&. +.fi +.PP +.PP +.PP +.nf +Accuracy: + according to an error analysis, the error is always less than + 1 ulp (unit in the last place)\&. +.fi +.PP +.PP +.PP +.nf +Constants: +The hexadecimal values are the intended ones for the following +constants\&. The decimal values may be used, provided that the +compiler will convert from decimal to binary accurately enough +to produce the hexadecimal values shown\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 118 of file log\&.c\&. +.PP +References Lg1, Lg2, Lg3, Lg4, Lg5, Lg6, Lg7, ln2_hi, ln2_lo, two54, and zero\&. +.PP +.nf +119 { +120 double hfsq,f,s,z,R,w,t1,t2,dk; +121 sword k,hx,i,j; +122 uword lx; +123 +124 EXTRACT_WORDS(hx,lx,x); +125 +126 k=0; +127 if (hx < 0x00100000) { /* x < 2**-1022 */ +128 if (((hx&0x7fffffff)|lx)==0) +129 return -two54/zero; /* log(+-0)=-inf */ +130 if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ +131 k -= 54; +132 x *= two54; /* subnormal number, scale up x */ +133 GET_HIGH_WORD(hx,x); /* high word of x */ +134 } +135 if (hx >= 0x7ff00000) return x+x; +136 k += (hx>>20)-1023; +137 hx &= 0x000fffff; +138 i = (hx+0x95f64)&0x100000; +139 SET_HIGH_WORD(x,hx|(i^0x3ff00000)); /* normalize x or x/2 */ +140 k += (i>>20); +141 f = x-1\&.0; +142 if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */ +143 if(f==zero) { +144 if(k==0) +145 return zero; +146 else { +147 dk=(double)k; +148 return dk*ln2_hi+dk*ln2_lo; +149 } +150 } +151 R = f*f*(0\&.5-0\&.33333333333333333*f); +152 if(k==0) return f-R; +153 else { +154 dk=(double)k; +155 return dk*ln2_hi-((R-dk*ln2_lo)-f); +156 } +157 } +158 s = f/(2\&.0+f); +159 dk = (double)k; +160 z = s*s; +161 i = hx-0x6147a; +162 w = z*z; +163 j = 0x6b851-hx; +164 t1= w*(Lg2+w*(Lg4+w*Lg6)); +165 t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); +166 i |= j; +167 R = t2+t1; +168 if(i>0) { +169 hfsq=0\&.5*f*f; +170 if(k==0) return f-(hfsq-s*(hfsq+R)); +171 else +172 return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); +173 } else { +174 if(k==0) return f-s*(f-R); +175 else +176 return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); +177 } +178 } +.fi +.SS "double log10 (double x)" + +.PP +Base 10 logarithm function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Method : + Let log10_2hi = leading 40 bits of log10(2) and + log10_2lo = log10(2) - log10_2hi, + ivln10 = 1/log(10) rounded\&. + Then + n = ilogb(x), + if(n<0) n = n+1; + x = scalbn(x,-n); + log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x)) +.fi +.PP +.PP +.PP +.nf +Note 1: + To guarantee log10(10**n)=n, where 10**n is normal, the rounding + mode must set to Round-to-Nearest\&. +Note 2: + [1/log(10)] rounded to 53 bits has error \&.198 ulps; + log10 is monotonic at all binary break points\&. +.fi +.PP +.PP +.PP +.nf +Special cases: + log10(x) is NaN with signal if x < 0; + log10(+INF) is +INF with no signal; log10(0) is -INF with signal; + log10(NaN) is that NaN with no signal; + log10(10**N) = N for N=0,1,\&.\&.\&.,22\&. +.fi +.PP +.PP +.PP +.nf +Constants: +The hexadecimal values are the intended ones for the following constants\&. +The decimal values may be used, provided that the compiler will convert +from decimal to binary accurately enough to produce the hexadecimal values +shown\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 95 of file log10\&.c\&. +.PP +References ivln10, log10_2hi, log10_2lo, two54, and zero\&. +.PP +.nf +96 { +97 double y,z; +98 sword i,k,hx; +99 uword lx; +100 +101 EXTRACT_WORDS(hx,lx,x); +102 +103 k=0; +104 if (hx < 0x00100000) { /* x < 2**-1022 */ +105 if (((hx&0x7fffffff)|lx)==0) +106 return -two54/zero; /* log(+-0)=-inf */ +107 if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ +108 k -= 54; +109 x *= two54; /* subnormal number, scale up x */ +110 GET_HIGH_WORD(hx, x); /* high word of x */ +111 } +112 if (hx >= 0x7ff00000) return x+x; +113 k += (hx>>20)-1023; +114 i = ((uword)k&0x80000000)>>31; +115 hx = (hx&0x000fffff)|((0x3ff-i)<<20); +116 y = (double)(k+i); +117 SET_HIGH_WORD(x,hx); +118 z = y*log10_2lo + ivln10*log(x); +119 return z+y*log10_2hi; +120 } +.fi +.SS "double log1p (double x)" + +.PP +Definition at line 125 of file log1p\&.c\&. +.PP +References ln2_hi, ln2_lo, Lp1, Lp2, Lp3, Lp4, Lp5, Lp6, Lp7, two54, and zero\&. +.PP +.nf +126 { +127 double hfsq,f,c,s,z,R,u; +128 sword k,hx,hu,ax; +129 +130 f = 0\&.0; +131 c = 0\&.0; +132 hu = 0; +133 +134 GET_HIGH_WORD(hx,x); /* high word of x */ +135 ax = hx&0x7fffffff; +136 +137 k = 1; +138 if (hx < 0x3FDA827A) { /* x < 0\&.41422 */ +139 if(ax>=0x3ff00000) { /* x <= -1\&.0 */ +140 if(x==-1\&.0) return -two54/zero; /* log1p(-1)=+inf */ +141 else return (x-x)/(x-x); /* log1p(x<-1)=NaN */ +142 } +143 if(ax<0x3e200000) { /* |x| < 2**-29 */ +144 if(two54+x>zero /* raise inexact */ +145 &&ax<0x3c900000) /* |x| < 2**-54 */ +146 return x; +147 else +148 return x - x*x*0\&.5; +149 } +150 if(hx>0||hx<=((int)0xbfd2bec3)) { +151 k=0; +152 f=x; +153 hu=1; +154 } /* -0\&.2929= 0x7ff00000) return x+x; +157 if(k!=0) { +158 if(hx<0x43400000) { +159 u = 1\&.0+x; +160 GET_HIGH_WORD(hu,u); /* high word of u */ +161 k = (hu>>20)-1023; +162 c = (k>0)? 1\&.0-(u-x):x-(u-1\&.0);/* correction term */ +163 c /= u; +164 } else { +165 u = x; +166 GET_HIGH_WORD(hu,u); /* high word of u */ +167 k = (hu>>20)-1023; +168 c = 0; +169 } +170 hu &= 0x000fffff; +171 if(hu<0x6a09e) { +172 SET_HIGH_WORD(u, hu|0x3ff00000); /* normalize u */ +173 } else { +174 k += 1; +175 SET_HIGH_WORD(u, hu|0x3fe00000); /* normalize u/2 */ +176 hu = (0x00100000-hu)>>2; +177 } +178 f = u-1\&.0; +179 } +180 hfsq=0\&.5*f*f; +181 if(hu==0) { /* |f| < 2**-20 */ +182 if(f==zero) { +183 if(k==0) return zero; +184 else { +185 c += k*ln2_lo; +186 return k*ln2_hi+c; +187 } +188 } +189 R = hfsq*(1\&.0-0\&.66666666666666666*f); +190 if(k==0) return f-R; +191 else +192 return k*ln2_hi-((R-(k*ln2_lo+c))-f); +193 } +194 s = f/(2\&.0+f); +195 z = s*s; +196 R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); +197 if(k==0) return f-(hfsq-s*(hfsq+R)); +198 else +199 return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); +200 } +.fi +.SS "double pow (double x, double y)" + +.PP +Expontation function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Method: Let x = 2 * (1+f) + 1\&. Compute and return log2(x) in two pieces: + log2(x) = w1 + w2, + where w1 has 53-24 = 29 bit trailing zeros\&. + 2\&. Perform y*log2(x) = n+y' by simulating muti-precision + arithmetic, where |y'|<=0\&.5\&. + 3\&. Return x**y = 2**n*exp(y'*log2) +.fi +.PP +.PP +.PP +.nf +Special cases: + 1\&. (anything) ** 0 is 1 + 2\&. (anything) ** 1 is itself + 3\&. (anything) ** NAN is NAN + 4\&. NAN ** (anything except 0) is NAN + 5\&. +-(|x| > 1) ** +INF is +INF + 6\&. +-(|x| > 1) ** -INF is +0 + 7\&. +-(|x| < 1) ** +INF is +0 + 8\&. +-(|x| < 1) ** -INF is +INF + 9\&. +-1 ** +-INF is NAN + 10\&. +0 ** (+anything except 0, NAN) is +0 + 11\&. -0 ** (+anything except 0, NAN, odd integer) is +0 + 12\&. +0 ** (-anything except 0, NAN) is +INF + 13\&. -0 ** (-anything except 0, NAN, odd integer) is +INF + 14\&. -0 ** (odd integer) = -( +0 ** (odd integer) ) + 15\&. +INF ** (+anything except 0,NAN) is +INF + 16\&. +INF ** (-anything except 0,NAN) is +0 + 17\&. -INF ** (anything) = -0 ** (-anything) + 18\&. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) + 19\&. (-anything except 0 and inf) ** (non-integer) is NAN +.fi +.PP +.PP +.PP +.nf +Accuracy: + pow(x,y) returns x**y nearly rounded\&. In particular + pow(integer,integer) + always returns the correct integer provided it is + representable\&. +.fi +.PP +.PP +.PP +.nf +Constants : +The hexadecimal values are the intended ones for the following +constants\&. The decimal values may be used, provided that the +compiler will convert from decimal to binary accurately enough +to produce the hexadecimal values shown\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 139 of file pow\&.c\&. +.PP +References bp, cp, cp_h, cp_l, dp_h, dp_l, huge, ivln2, ivln2_h, ivln2_l, L1, L2, L3, L4, L5, L6, lg2, lg2_h, lg2_l, one, ovt, P1, P2, P3, P4, P5, scalbn(), sqrt(), tiny, two, two53, and zero\&. +.PP +.nf +140 { +141 double z,ax,z_h,z_l,p_h,p_l; +142 double y1,t1,t2,r,s,t,u,v,w; +143 sword i0,i1,i,j,k,yisint,n; +144 sword hx,hy,ix,iy; +145 uword lx,ly; +146 +147 i0 = ((*(int*)&one)>>29)^1; +148 i1=1-i0; +149 EXTRACT_WORDS(hx,lx,x); +150 EXTRACT_WORDS(hy,ly,y); +151 ix = hx&0x7fffffff; +152 iy = hy&0x7fffffff; +153 +154 /* y==zero: x**0 = 1 */ +155 if((iy|ly)==0) return one; +156 +157 /* +-NaN return x+y */ +158 if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || +159 iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) +160 return x+y; +161 +162 /* determine if y is an odd int when x < 0 +163 * yisint = 0 \&.\&.\&. y is not an integer +164 * yisint = 1 \&.\&.\&. y is an odd int +165 * yisint = 2 \&.\&.\&. y is an even int +166 */ +167 yisint = 0; +168 if(hx<0) { +169 if(iy>=0x43400000) yisint = 2; /* even integer y */ +170 else if(iy>=0x3ff00000) { +171 k = (iy>>20)-0x3ff; /* exponent */ +172 if(k>20) { +173 j = ly>>(52-k); +174 if((uword)(j<<(52-k))==ly) yisint = 2-(j&1); +175 } else if(ly==0) { +176 j = iy>>(20-k); +177 if((j<<(20-k))==iy) yisint = 2-(j&1); +178 } +179 } +180 } +181 +182 /* special value of y */ +183 if(ly==0) { +184 if (iy==0x7ff00000) { /* y is +-inf */ +185 if(((ix-0x3ff00000)|lx)==0) +186 return y - y; /* inf**+-1 is NaN */ +187 else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */ +188 return (hy>=0)? y: zero; +189 else /* (|x|<1)**-,+inf = inf,0 */ +190 return (hy<0)?-y: zero; +191 } +192 if(iy==0x3ff00000) { /* y is +-1 */ +193 if(hy<0) return one/x; +194 else return x; +195 } +196 if(hy==0x40000000) return x*x; /* y is 2 */ +197 if(hy==0x3fe00000) { /* y is 0\&.5 */ +198 if(hx>=0) /* x >= +0 */ +199 return sqrt(x); +200 } +201 } +202 +203 ax = fabs(x); +204 /* special value of x */ +205 if(lx==0) { +206 if(ix==0x7ff00000||ix==0||ix==0x3ff00000) { +207 z = ax; /*x is +-0,+-inf,+-1*/ +208 if(hy<0) z = one/z; /* z = (1/|x|) */ +209 if(hx<0) { +210 if(((ix-0x3ff00000)|yisint)==0) { +211 z = (z-z)/(z-z); /* (-1)**non-int is NaN */ +212 } else if(yisint==1) +213 z = -z; /* (x<0)**odd = -(|x|**odd) */ +214 } +215 return z; +216 } +217 } +218 +219 n = (hx>>31)+1; +220 +221 /* (x<0)**(non-int) is NaN */ +222 if((n|yisint)==0) return (x-x)/(x-x); +223 +224 s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ +225 if((n|(yisint-1))==0) s = -one;/* (-ve)**(odd int) */ +226 +227 /* |y| is huge */ +228 if(iy>0x41e00000) { /* if |y| > 2**31 */ +229 if(iy>0x43f00000) { /* if |y| > 2**64, must o/uflow */ +230 if(ix<=0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; +231 if(ix>=0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; +232 } +233 /* over/underflow if x is not close to one */ +234 if(ix<0x3fefffff) return (hy<0)? s*huge*huge:s*tiny*tiny; +235 if(ix>0x3ff00000) return (hy>0)? s*huge*huge:s*tiny*tiny; +236 /* now |1-x| is tiny <= 2**-20, suffice to compute +237 log(x) by x-x^2/2+x^3/3-x^4/4 */ +238 t = ax-one; /* t has 20 trailing zeros */ +239 w = (t*t)*(0\&.5-t*(0\&.3333333333333333333333-t*0\&.25)); +240 u = ivln2_h*t; /* ivln2_h has 21 sig\&. bits */ +241 v = t*ivln2_l-w*ivln2; +242 t1 = u+v; +243 SET_LOW_WORD(t1,0); +244 t2 = v-(t1-u); +245 } else { +246 double ss,s2,s_h,s_l,t_h,t_l; +247 n = 0; +248 /* take care subnormal number */ +249 if(ix<0x00100000) +250 { +251 ax *= two53; +252 n -= 53; +253 GET_HIGH_WORD(ix,ax); +254 } +255 n += ((ix)>>20)-0x3ff; +256 j = ix&0x000fffff; +257 /* determine interval */ +258 ix = j|0x3ff00000; /* normalize ix */ +259 if(j<=0x3988E) k=0; /* |x|>1)|0x20000000)+0x00080000+(k<<18)); +277 t_l = ax - (t_h-bp[k]); +278 s_l = v*((u-s_h*t_h)-s_h*t_l); +279 /* compute log(ax) */ +280 s2 = ss*ss; +281 r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); +282 r += s_l*(s_h+ss); +283 s2 = s_h*s_h; +284 t_h = 3\&.0+s2+r; +285 SET_LOW_WORD(t_h,0); +286 t_l = r-((t_h-3\&.0)-s2); +287 /* u+v = ss*(1+\&.\&.\&.) */ +288 u = s_h*t_h; +289 v = s_l*t_h+t_l*ss; +290 /* 2/(3log2)*(ss+\&.\&.\&.) */ +291 p_h = u+v; +292 SET_LOW_WORD(p_h,0); +293 p_l = v-(p_h-u); +294 z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ +295 z_l = cp_l*p_h+p_l*cp+dp_l[k]; +296 /* log2(ax) = (ss+\&.\&.)*2/(3*log2) = n + dp_h + z_h + z_l */ +297 t = (double)n; +298 t1 = (((z_h+z_l)+dp_h[k])+t); +299 SET_LOW_WORD(t1,0); +300 t2 = z_l-(((t1-t)-dp_h[k])-z_h); +301 } +302 +303 /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ +304 y1 = y; +305 SET_LOW_WORD(y1,0); +306 p_l = (y-y1)*t1+y*t2; +307 p_h = y1*t1; +308 z = p_l+p_h; +309 EXTRACT_WORDS(j,i,z); +310 if (j>=0x40900000) { /* z >= 1024 */ +311 if(((j-0x40900000)|i)!=0) /* if z > 1024 */ +312 return s*huge*huge; /* overflow */ +313 else { +314 if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ +315 } +316 } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */ +317 if(((j-0xc090cc00)|i)!=0) /* z < -1075 */ +318 return s*tiny*tiny; /* underflow */ +319 else { +320 if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ +321 } +322 } +323 /* +324 * compute 2**(p_h+p_l) +325 */ +326 i = j&0x7fffffff; +327 k = (i>>20)-0x3ff; +328 n = 0; +329 if(i>0x3fe00000) { /* if |z| > 0\&.5, set n = [z+0\&.5] */ +330 n = j+(0x00100000>>(k+1)); +331 k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */ +332 t = zero; +333 SET_HIGH_WORD(t,(n&~(0x000fffff>>k))); +334 n = ((n&0x000fffff)|0x00100000)>>(20-k); +335 if(j<0) n = -n; +336 p_h -= t; +337 } +338 t = p_l+p_h; +339 SET_LOW_WORD(t,0); +340 u = t*lg2_h; +341 v = (p_l-(t-p_h))*lg2+t*lg2_l; +342 z = u+v; +343 w = v-(z-u); +344 t = z*z; +345 t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); +346 r = (z*t1)/(t1-two)-(w+z*w); +347 z = one-(r-z); +348 GET_HIGH_WORD(j,z); +349 j += (n<<20); +350 if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */ +351 else +352 { +353 uword hz; +354 GET_HIGH_WORD(hz,z); +355 SET_HIGH_WORD(z,hz + (n<<20)); +356 } +357 return s*z; +358 } +.fi +.SS "int rempio2 (double x, double * y)" + +.PP +Definition at line 103 of file remp2\&.c\&. +.PP +References __kernel_rem_pio2(), half, invpio2, npio2_hw, pio2_1, pio2_1t, pio2_2, pio2_2t, pio2_3, pio2_3t, two24, two_over_pi, and zero\&. +.PP +.nf +104 { +105 double z = 0\&.,w,t,r,fn; +106 double tx[3]; +107 sword i,j,n,ix,hx; +108 int e0,nx; +109 uword low; +110 +111 GET_HIGH_WORD(hx,x); /* high word of x */ +112 ix = hx&0x7fffffff; +113 if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */ +114 { +115 y[0] = x; +116 y[1] = 0; +117 return 0; +118 } +119 if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ +120 if(hx>0) { +121 z = x - pio2_1; +122 if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ +123 y[0] = z - pio2_1t; +124 y[1] = (z-y[0])-pio2_1t; +125 } else { /* near pi/2, use 33+33+53 bit pi */ +126 z -= pio2_2; +127 y[0] = z - pio2_2t; +128 y[1] = (z-y[0])-pio2_2t; +129 } +130 return 1; +131 } else { /* negative x */ +132 z = x + pio2_1; +133 if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ +134 y[0] = z + pio2_1t; +135 y[1] = (z-y[0])+pio2_1t; +136 } else { /* near pi/2, use 33+33+53 bit pi */ +137 z += pio2_2; +138 y[0] = z + pio2_2t; +139 y[1] = (z-y[0])+pio2_2t; +140 } +141 return -1; +142 } +143 } +144 if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ +145 t = fabs(x); +146 n = (sword) (t*invpio2+half); +147 fn = (double)n; +148 r = t-fn*pio2_1; +149 w = fn*pio2_1t; /* 1st round good to 85 bit */ +150 if(n<32&&ix!=npio2_hw[n-1]) { +151 y[0] = r-w; /* quick check no cancellation */ +152 } else { +153 uword high; +154 +155 j = ix>>20; +156 y[0] = r-w; +157 GET_HIGH_WORD(high, y[0]); +158 i = j-((high>>20)&0x7ff); +159 if(i>16) { /* 2nd iteration needed, good to 118 */ +160 t = r; +161 w = fn*pio2_2; +162 r = t-w; +163 w = fn*pio2_2t-((t-r)-w); +164 y[0] = r-w; +165 GET_HIGH_WORD(high,y[0]); +166 i = j-((high>>20)&0x7ff); +167 if(i>49) { /* 3rd iteration need, 151 bits acc */ +168 t = r; /* will cover all possible cases */ +169 w = fn*pio2_3; +170 r = t-w; +171 w = fn*pio2_3t-((t-r)-w); +172 y[0] = r-w; +173 } +174 } +175 } +176 y[1] = (r-y[0])-w; +177 if(hx<0) { +178 y[0] = -y[0]; +179 y[1] = -y[1]; +180 return -n; +181 } +182 else return n; +183 } +184 /* +185 * all other (large) arguments +186 */ +187 if(ix>=0x7ff00000) { /* x is inf or NaN */ +188 y[0]=y[1]=x-x; +189 return 0; +190 } +191 /* set z = scalbn(|x|,ilogb(x)-23) */ +192 GET_LOW_WORD(low,x); +193 SET_LOW_WORD(z,low); +194 e0 = (sword)(ix>>20)-1046; /* e0 = ilogb(z)-23; */ +195 SET_HIGH_WORD(z,ix - (e0<<20)); +196 for(i=0; i<2; i++) { +197 tx[i] = (double)((sword)(z)); +198 z = (z-tx[i])*two24; +199 } +200 tx[2] = z; +201 nx = 3; +202 while(tx[nx-1]==zero) nx--; /* skip zero term */ +203 n = __kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi); +204 if(hx<0) { +205 y[0] = -y[0]; +206 y[1] = -y[1]; +207 return -n; +208 } +209 return n; +210 } +.fi +.SS "double round (double x)" + +.PP +Definition at line 33 of file round\&.c\&. +.PP +.nf +34 { +35 return x > 0\&.0 ? floor(x + 0\&.5) : ceil(x - 0\&.5); +36 } +.fi +.SS "double scalbn (double x, int n)" + +.PP +Definition at line 60 of file scalbn\&.c\&. +.PP +References huge, tiny, two54, and twom54\&. +.PP +.nf +61 { +62 sword k,hx,lx; +63 EXTRACT_WORDS(hx,lx,x); +64 k = (hx&0x7ff00000)>>20; /* extract exponent */ +65 if (k==0) { /* 0 or subnormal x */ +66 if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ +67 x *= two54; +68 GET_HIGH_WORD(hx,x); +69 k = ((hx&0x7ff00000)>>20) - 54; +70 if (n< -50000) return tiny*x; /*underflow*/ +71 } +72 if (k==0x7ff) return x+x; /* NaN or Inf */ +73 k = k+n; +74 if (k > 0x7fe) return huge*copysign(huge,x); /* overflow */ +75 if (k > 0) /* normal result */ +76 { +77 SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); +78 return x; +79 } +80 if (k <= -54) { +81 if (n > 50000) /* in case integer overflow in n+k */ +82 return huge*copysign(huge,x); /*overflow*/ +83 else return tiny*copysign(tiny,x); /*underflow*/ +84 } +85 k += 54; /* subnormal result */ +86 SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); +87 return x*twom54; +88 } +.fi +.SS "double sin (double x)" + +.PP +Trigonometric sine function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Return sine function of x\&. +.fi +.PP +.PP +.PP +.nf +kernel function: + __kernel_sin \&.\&.\&. sine function on [-pi/4,pi/4] + __kernel_cos \&.\&.\&. cose function on [-pi/4,pi/4] + __ieee754_rem_pio2 \&.\&.\&. argument reduction routine +.fi +.PP +.PP +.PP +.nf +Method\&. + Let S,C and T denote the sin, cos and tan respectively on + [-PI/4, +PI/4]\&. Reduce the argument x to y1+y2 = x-k*pi/2 + in [-pi/4 , +pi/4], and let n = k mod 4\&. + We have +.fi +.PP +.PP +.PP +.nf + n sin(x) cos(x) tan(x) + ---------------------------------------------------------- + 0 S C T + 1 C -S -1/T + 2 -S -C T + 3 -C S -1/T + ---------------------------------------------------------- +.fi +.PP +.PP +.PP +.nf +Special cases: + Let trig be any of sin, cos, or tan\&. + trig(+-INF) is NaN, with signals; + trig(NaN) is that NaN; +.fi +.PP +.PP +.PP +.nf +Accuracy: + TRIG(x) returns trig(x) nearly rounded +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 87 of file sin\&.c\&. +.PP +References __kernel_cos(), __kernel_sin(), and rempio2()\&. +.PP +.nf +88 { +89 double y[2],z=0\&.0; +90 sword n, ix; +91 +92 /* High word of x\&. */ +93 GET_HIGH_WORD(ix,x); +94 +95 /* |x| ~< pi/4 */ +96 ix &= 0x7fffffff; +97 if(ix <= 0x3fe921fb) return __kernel_sin(x,z,0); +98 +99 /* sin(Inf or NaN) is NaN */ +100 else if (ix>=0x7ff00000) return x-x; +101 +102 /* argument reduction needed */ +103 else { +104 n = rempio2(x,y); +105 switch(n&3) { +106 case 0: +107 return __kernel_sin(y[0],y[1],1); +108 case 1: +109 return __kernel_cos(y[0],y[1]); +110 case 2: +111 return -__kernel_sin(y[0],y[1],1); +112 default: +113 return -__kernel_cos(y[0],y[1]); +114 } +115 } +116 } +.fi +.SS "double sinh (double x)" + +.PP +Hyperbolic sine function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Method : +mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2 + 1\&. Replace x by |x| (sinh(-x) = -sinh(x))\&. + 2\&. + E + E/(E+1) + 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x) + 2 +.fi +.PP +.PP +.PP +.nf + 22 <= x <= lnovft : sinh(x) := exp(x)/2 + lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2) + ln2ovft < x : sinh(x) := x*shuge (overflow) +.fi +.PP +.PP +.PP +.nf +Special cases: + sinh(x) is |x| if x is +INF, -INF, or NaN\&. + only sinh(0)=0 is exact for finite x\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 81 of file sinh\&.c\&. +.PP +References exp(), expm1(), one, and shuge\&. +.PP +.nf +82 { +83 double t,w,h; +84 sword ix,jx; +85 uword lx; +86 +87 /* High word of |x|\&. */ +88 GET_HIGH_WORD(jx,x); +89 ix = jx&0x7fffffff; +90 +91 /* x is INF or NaN */ +92 if(ix>=0x7ff00000) return x+x; +93 +94 h = 0\&.5; +95 if (jx<0) h = -h; +96 /* |x| in [0,22], return sign(x)*0\&.5*(E+E/(E+1))) */ +97 if (ix < 0x40360000) { /* |x|<22 */ +98 if (ix<0x3e300000) /* |x|<2**-28 */ +99 if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */ +100 t = expm1(fabs(x)); +101 if(ix<0x3ff00000) return h*(2\&.0*t-t*t/(t+one)); +102 return h*(t+t/(t+one)); +103 } +104 +105 /* |x| in [22, log(maxdouble)] return 0\&.5*exp(|x|) */ +106 if (ix < 0x40862E42) return h*exp(fabs(x)); +107 +108 /* |x| in [log(maxdouble), overflowthresold] */ +109 lx = *( (((*(uword*)&one)>>29)) + (uword*)&x); +110 if (ix<0x408633CE || ((ix==0x408633ce)&&(lx<=(uword)0x8fb9f87d))) { +111 w = exp(0\&.5*fabs(x)); +112 t = h*w; +113 return t*w; +114 } +115 +116 /* |x| > overflowthresold, sinh(x) overflow */ +117 return x*shuge; +118 } +.fi +.SS "double sqrt (double x)" + +.PP +Square root function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Return correctly rounded sqrt\&. + ------------------------------------------ + | Use the hardware sqrt if you have one | + ------------------------------------------ +Method: + Bit by bit method using integer arithmetic\&. (Slow, but portable) + 1\&. Normalization + Scale x to y in [1,4) with even powers of 2: + find an integer k such that 1 <= (y=x*2^(2k)) < 4, then + sqrt(x) = 2^k * sqrt(y) + 2\&. Bit by bit computation + Let q = sqrt(y) truncated to i bit after binary point (q = 1), + i 0 + i+1 2 + s = 2*q , and y = 2 * ( y - q )\&. (1) + i i i i +.fi +.PP +.PP +.PP +.nf + To compute q from q , one checks whether + i+1 i +.fi +.PP +.PP +.PP +.nf + -(i+1) 2 + (q + 2 ) <= y\&. (2) + i + -(i+1) + If (2) is false, then q = q ; otherwise q = q + 2 \&. + i+1 i i+1 i +.fi +.PP +.PP +.PP +.nf + With some algebric manipulation, it is not difficult to see + that (2) is equivalent to + -(i+1) + s + 2 <= y (3) + i i +.fi +.PP +.PP +.PP +.nf + The advantage of (3) is that s and y can be computed by + i i + the following recurrence formula: + if (3) is false +.fi +.PP +.PP +.PP +.nf + s = s , y = y ; (4) + i+1 i i+1 i +.fi +.PP +.PP +.PP +.nf + otherwise, + -i -(i+1) + s = s + 2 , y = y - s - 2 (5) + i+1 i i+1 i i +.fi +.PP +.PP +.PP +.nf + One may easily use induction to prove (4) and (5)\&. + Note\&. Since the left hand side of (3) contain only i+2 bits, + it does not necessary to do a full (53-bit) comparison + in (3)\&. + 3\&. Final rounding + After generating the 53 bits result, we compute one more bit\&. + Together with the remainder, we can decide whether the + result is exact, bigger than 1/2ulp, or less than 1/2ulp + (it will never equal to 1/2ulp)\&. + The rounding mode can be detected by checking whether + huge + tiny is equal to huge, and whether huge - tiny is + equal to huge for some floating point number 'huge' and 'tiny'\&. +.fi +.PP +.PP +.PP +.nf +Special cases: + sqrt(+-0) = +-0 \&.\&.\&. exact + sqrt(inf) = inf + sqrt(-ve) = NaN \&.\&.\&. with invalid signal + sqrt(NaN) = NaN \&.\&.\&. with invalid signal for signaling NaN +.fi +.PP + Other methods : see the \fBsquareroot\fP\&. +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 127 of file sqrt\&.c\&. +.PP +References one, and tiny\&. +.PP +.nf +128 { +129 double z; +130 sword sign = (int)0x80000000; +131 uword r,t1,s1,ix1,q1; +132 sword ix0,s0,q,m,t,i; +133 +134 EXTRACT_WORDS(ix0,ix1,x); +135 +136 /* take care of Inf and NaN */ +137 if((ix0&0x7ff00000)==0x7ff00000) { +138 return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf +139 sqrt(-inf)=sNaN */ +140 } +141 /* take care of zero */ +142 if(ix0<=0) { +143 if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */ +144 else if(ix0<0) +145 return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ +146 } +147 /* normalize x */ +148 m = (ix0>>20); +149 if(m==0) { /* subnormal x */ +150 while(ix0==0) { +151 m -= 21; +152 ix0 |= (ix1>>11); +153 ix1 <<= 21; +154 } +155 for(i=0; (ix0&0x00100000)==0; i++) ix0<<=1; +156 m -= i-1; +157 ix0 |= (ix1>>(32-i)); +158 ix1 <<= i; +159 } +160 m -= 1023; /* unbias exponent */ +161 ix0 = (ix0&0x000fffff)|0x00100000; +162 if(m&1) { /* odd m, double x to make it even */ +163 ix0 += ix0 + ((ix1&sign)>>31); +164 ix1 += ix1; +165 } +166 m >>= 1; /* m = [m/2] */ +167 +168 /* generate sqrt(x) bit by bit */ +169 ix0 += ix0 + ((ix1&sign)>>31); +170 ix1 += ix1; +171 q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ +172 r = 0x00200000; /* r = moving bit from right to left */ +173 +174 while(r!=0) { +175 t = s0+r; +176 if(t<=ix0) { +177 s0 = t+r; +178 ix0 -= t; +179 q += r; +180 } +181 ix0 += ix0 + ((ix1&sign)>>31); +182 ix1 += ix1; +183 r>>=1; +184 } +185 +186 r = sign; +187 while(r!=0) { +188 t1 = s1+r; +189 t = s0; +190 if((t>31); +199 ix1 += ix1; +200 r>>=1; +201 } +202 +203 /* use floating add to find out rounding direction */ +204 if((ix0|ix1)!=0) { +205 z = one-tiny; /* trigger inexact flag */ +206 if (z>=one) { +207 z = one+tiny; +208 if (q1==(uword)0xffffffff) { +209 q1=0; +210 q += 1; +211 } +212 else if (z>one) { +213 if (q1==(uword)0xfffffffe) q+=1; +214 q1+=2; +215 } else +216 q1 += (q1&1); +217 } +218 } +219 ix0 = (q>>1)+0x3fe00000; +220 ix1 = q1>>1; +221 if ((q&1)==1) ix1 |= sign; +222 ix0 += (m <<20); +223 INSERT_WORDS(z,ix0,ix1); +224 return z; +225 } +.fi +.SS "double tan (double x)" + +.PP +Trigonometric tangent function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Return tangent function of x\&. +.fi +.PP +.PP +.PP +.nf +kernel function: + __kernel_tan \&.\&.\&. tangent function on [-pi/4,pi/4] + __rem_pio2 \&.\&.\&. argument reduction routine +.fi +.PP +.PP +.PP +.nf +Method\&. + Let S,C and T denote the sin, cos and tan respectively on + [-PI/4, +PI/4]\&. Reduce the argument x to y1+y2 = x-k*pi/2 + in [-pi/4 , +pi/4], and let n = k mod 4\&. + We have +.fi +.PP +.PP +.PP +.nf + n sin(x) cos(x) tan(x) + ---------------------------------------------------------- + 0 S C T + 1 C -S -1/T + 2 -S -C T + 3 -C S -1/T + ---------------------------------------------------------- +.fi +.PP +.PP +.PP +.nf +Special cases: + Let trig be any of sin, cos, or tan\&. + trig(+-INF) is NaN, with signals; + trig(NaN) is that NaN; +.fi +.PP +.PP +.PP +.nf +Accuracy: + TRIG(x) returns trig(x) nearly rounded +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 86 of file tan\&.c\&. +.PP +References __kernel_tan(), and rempio2()\&. +.PP +.nf +87 { +88 double y[2],z=0\&.0; +89 sword n, ix; +90 +91 /* High word of x\&. */ +92 GET_HIGH_WORD(ix,x); +93 +94 /* |x| ~< pi/4 */ +95 ix &= 0x7fffffff; +96 if(ix <= 0x3fe921fb) return __kernel_tan(x,z,1); +97 +98 /* tan(Inf or NaN) is NaN */ +99 else if (ix>=0x7ff00000) return x-x; /* NaN */ +100 +101 /* argument reduction needed */ +102 else { +103 n = rempio2(x,y); +104 return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even +105 -1 -- n odd */ +106 } +107 } +.fi +.SS "double tanh (double x)" + +.PP +Hyperbolic tangent function\&. +.PP +\fBVersion:\fP +.RS 4 +1\&.3 +.RE +.PP +\fBDate:\fP +.RS 4 +95/01/18 +.RE +.PP +.PP +.nf + +Return the Hyperbolic Tangent of x +.fi +.PP +.PP +.PP +.nf +Method : + x -x + e - e + 0\&. tanh(x) is defined to be ----------- + x -x + e + e + 1\&. reduce x to non-negative by tanh(-x) = -tanh(x)\&. + 2\&. 0 <= x <= 2**-55 : tanh(x) := x*(one+x) + -t + 2**-55 < x <= 1 : tanh(x) := -----; t = expm1(-2x) + t + 2 + 2 + 1 <= x <= 22\&.0 : tanh(x) := 1- ----- ; t=expm1(2x) + t + 2 + 22\&.0 < x <= INF : tanh(x) := 1\&. +.fi +.PP +.PP +.PP +.nf +Special cases: + tanh(NaN) is NaN; + only tanh(0)=0 is exact for finite argument\&. +.fi +.PP + +.PP +\fBCopyright:\fP +.RS 4 +Copyright (C) 1993 by Sun Microsystems, Inc\&. All rights reserved\&. Developed at SunSoft, a Sun Microsystems, Inc\&. business\&. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\&. +.RE +.PP + +.PP +Definition at line 83 of file tanh\&.c\&. +.PP +References expm1(), one, tiny, and two\&. +.PP +.nf +84 { +85 double t,z; +86 sword jx,ix; +87 +88 /* High word of |x|\&. */ +89 GET_HIGH_WORD(jx,x); +90 ix = jx&0x7fffffff; +91 +92 /* x is INF or NaN */ +93 if(ix>=0x7ff00000) { +94 if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ +95 else return one/x-one; /* tanh(NaN) = NaN */ +96 } +97 +98 /* |x| < 22 */ +99 if (ix < 0x40360000) { /* |x|<22 */ +100 if (ix<0x3c800000) /* |x|<2**-55 */ +101 return x*(one+x); /* tanh(small) = small */ +102 if (ix>=0x3ff00000) { /* |x|>=1 */ +103 t = expm1(two*fabs(x)); +104 z = one - two/(t+two); +105 } else { +106 t = expm1(-two*fabs(x)); +107 z= -t/(t+two); +108 } +109 /* |x| > 22, return +-1 */ +110 } else { +111 z = one - tiny; /* raised inexact flag */ +112 } +113 return (jx>=0)? z: -z; +114 } +.fi +.SS "double trunc (double x)" + +.PP +Definition at line 33 of file trunc\&.c\&. +.PP +.nf +34 { +35 return x > 0\&.0 ? floor(x) : ceil(x); +36 } +.fi +.SH "See also" +.PP +amath(1), amathc(3), amathi(3) diff --git a/src/real/amathr.pc b/src/real/amathr.pc new file mode 100644 index 00000000..2990cfb6 --- /dev/null +++ b/src/real/amathr.pc @@ -0,0 +1,10 @@ +prefix=/usr +exec_prefix=${prefix} +includedir=${prefix}/include/amath +libdir=${exec_prefix}/lib + +Name: amath real library +Description: Functions for handling real numbers +Version: 1.7.0 +Cflags: -I${includedir} +Libs: -L${libdir} -lamathr diff --git a/src/real/atan2.c b/src/real/atan2.c index 9b413965..6be87d33 100644 --- a/src/real/atan2.c +++ b/src/real/atan2.c @@ -44,7 +44,7 @@ #include "prim.h" #include "math.h" -#ifdef _WIN32 +#if defined(_MSC_VER) #pragma warning( disable : 4146 ) #endif diff --git a/src/real/atanh.c b/src/real/atanh.c index 10457720..e7ec3257 100644 --- a/src/real/atanh.c +++ b/src/real/atanh.c @@ -44,7 +44,7 @@ #include "prim.h" #include "math.h" -#ifdef _WIN32 +#if defined(_MSC_VER) #pragma warning( disable : 4146 ) #endif diff --git a/src/real/erf.c b/src/real/erf.c deleted file mode 100644 index 252bc742..00000000 --- a/src/real/erf.c +++ /dev/null @@ -1,348 +0,0 @@ -/* @(#)s_erf.c 1.3 95/01/18 */ - -/* - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The origin source code can be obtained from: - * http://www.netlib.org/fdlibm/s_erf.c - * - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -// NOTICE: Not a part of libamath yet - -/* double erf(double x) - * double erfc(double x) - * x - * 2 |\ - * erf(x) = --------- | exp(-t*t)dt - * sqrt(pi) \| - * 0 - * - * erfc(x) = 1-erf(x) - * Note that - * erf(-x) = -erf(x) - * erfc(-x) = 2 - erfc(x) - * - * Method: - * 1. For |x| in [0, 0.84375] - * erf(x) = x + x*R(x^2) - * erfc(x) = 1 - erf(x) if x in [-.84375,0.25] - * = 0.5 + ((0.5-x)-x*R) if x in [0.25,0.84375] - * where R = P/Q where P is an odd poly of degree 8 and - * Q is an odd poly of degree 10. - * -57.90 - * | R - (erf(x)-x)/x | <= 2 - * - * - * Remark. The formula is derived by noting - * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) - * and that - * 2/sqrt(pi) = 1.128379167095512573896158903121545171688 - * is close to one. The interval is chosen because the fix - * point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is - * near 0.6174), and by some experiment, 0.84375 is chosen to - * guarantee the error is less than one ulp for erf. - * - * 2. For |x| in [0.84375,1.25], let s = |x| - 1, and - * c = 0.84506291151 rounded to single (24 bits) - * erf(x) = sign(x) * (c + P1(s)/Q1(s)) - * erfc(x) = (1-c) - P1(s)/Q1(s) if x > 0 - * 1+(c+P1(s)/Q1(s)) if x < 0 - * |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06 - * Remark: here we use the taylor series expansion at x=1. - * erf(1+s) = erf(1) + s*Poly(s) - * = 0.845.. + P1(s)/Q1(s) - * That is, we use rational approximation to approximate - * erf(1+s) - (c = (single)0.84506291151) - * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] - * where - * P1(s) = degree 6 poly in s - * Q1(s) = degree 6 poly in s - * - * 3. For x in [1.25,1/0.35(~2.857143)], - * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1) - * erf(x) = 1 - erfc(x) - * where - * R1(z) = degree 7 poly in z, (z=1/x^2) - * S1(z) = degree 8 poly in z - * - * 4. For x in [1/0.35,28] - * erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0 - * = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6 x >= 28 - * erf(x) = sign(x) *(1 - tiny) (raise inexact) - * erfc(x) = tiny*tiny (raise underflow) if x > 0 - * = 2 - tiny if x<0 - * - * 7. Special case: - * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, - * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, - * erfc/erf(NaN) is NaN - */ - - -#include "fdlibm.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -tiny = 1e-300, - half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ - one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ - two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */ - /* c = (float)0.84506291151 */ - erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */ - /* - * Coefficients for approximation to erf on [0,0.84375] - */ - efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */ - efx8= 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */ - pp0 = 1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */ - pp1 = -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */ - pp2 = -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */ - pp3 = -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */ - pp4 = -2.37630166566501626084e-05, /* 0xBEF8EAD6, 0x120016AC */ - qq1 = 3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */ - qq2 = 6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */ - qq3 = 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ - qq4 = 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ - qq5 = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */ - /* - * Coefficients for approximation to erf in [0.84375,1.25] - */ - pa0 = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ - pa1 = 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ - pa2 = -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */ - pa3 = 3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */ - pa4 = -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */ - pa5 = 3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */ - pa6 = -2.16637559486879084300e-03, /* 0xBF61BF38, 0x0A96073F */ - qa1 = 1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */ - qa2 = 5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */ - qa3 = 7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */ - qa4 = 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */ - qa5 = 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */ - qa6 = 1.19844998467991074170e-02, /* 0x3F888B54, 0x5735151D */ - /* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ - ra0 = -9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */ - ra1 = -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */ - ra2 = -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */ - ra3 = -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */ - ra4 = -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */ - ra5 = -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */ - ra6 = -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */ - ra7 = -9.81432934416914548592e+00, /* 0xC023A0EF, 0xC69AC25C */ - sa1 = 1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */ - sa2 = 1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */ - sa3 = 4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */ - sa4 = 6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */ - sa5 = 4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */ - sa6 = 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */ - sa7 = 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */ - sa8 = -6.04244152148580987438e-02, /* 0xBFAEEFF2, 0xEE749A62 */ - /* - * Coefficients for approximation to erfc in [1/.35,28] - */ - rb0 = -9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */ - rb1 = -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */ - rb2 = -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */ - rb3 = -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */ - rb4 = -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */ - rb5 = -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */ - rb6 = -4.83519191608651397019e+02, /* 0xC07E384E, 0x9BDC383F */ - sb1 = 3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */ - sb2 = 3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */ - sb3 = 1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */ - sb4 = 3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */ - sb5 = 2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */ - sb6 = 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */ - sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ - -#ifdef __STDC__ -double erf(double x) -#else -double erf(x) -double x; -#endif -{ - int hx,ix,i; - double R,S,P,Q,s,y,z,r; - hx = __HI(x); - ix = hx&0x7fffffff; - if(ix>=0x7ff00000) { /* erf(nan)=nan */ - i = ((unsigned)hx>>31)<<1; - return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */ - } - - if(ix < 0x3feb0000) { /* |x|<0.84375 */ - if(ix < 0x3e300000) { /* |x|<2**-28 */ - if (ix < 0x00800000) - return 0.125*(8.0*x+efx8*x); /*avoid underflow */ - return x + efx*x; - } - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - return x + x*y; - } - if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ - s = fabs(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if(hx>=0) return erx + P/Q; - else return -erx - P/Q; - } - if (ix >= 0x40180000) { /* inf>|x|>=6 */ - if(hx>=0) return one-tiny; - else return tiny-one; - } - x = fabs(x); - s = one/(x*x); - if(ix< 0x4006DB6E) { /* |x| < 1/0.35 */ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/0.35 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - z = x; - __LO(z) = 0; - r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); - if(hx>=0) return one-r/x; - else return r/x-one; -} - -#ifdef __STDC__ -double erfc(double x) -#else -double erfc(x) -double x; -#endif -{ - int hx,ix; - double R,S,P,Q,s,y,z,r; - hx = __HI(x); - ix = hx&0x7fffffff; - if(ix>=0x7ff00000) { /* erfc(nan)=nan */ - /* erfc(+-inf)=0,2 */ - return (double)(((unsigned)hx>>31)<<1)+one/x; - } - - if(ix < 0x3feb0000) { /* |x|<0.84375 */ - if(ix < 0x3c700000) /* |x|<2**-56 */ - return one-x; - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - if(hx < 0x3fd00000) { /* x<1/4 */ - return one-(x+x*y); - } else { - r = x*y; - r += (x-half); - return half - r ; - } - } - if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ - s = fabs(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if(hx>=0) { - z = one-erx; - return z - P/Q; - } else { - z = erx+P/Q; - return one+z; - } - } - if (ix < 0x403c0000) { /* |x|<28 */ - x = fabs(x); - s = one/(x*x); - if(ix< 0x4006DB6D) { /* |x| < 1/.35 ~ 2.857143*/ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/.35 ~ 2.857143 */ - if(hx<0&&ix>=0x40180000) return two-tiny;/* x < -6 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - z = x; - __LO(z) = 0; - r = __ieee754_exp(-z*z-0.5625)* - __ieee754_exp((z-x)*(z+x)+R/S); - if(hx>0) return r/x; - else return two-r/x; - } else { - if(hx>0) return tiny*tiny; - else return two-tiny; - } -} diff --git a/src/real/fmod.c b/src/real/fmod.c index 810ef601..7ef4c0ae 100644 --- a/src/real/fmod.c +++ b/src/real/fmod.c @@ -43,7 +43,7 @@ #include "prim.h" -#ifdef _WIN32 +#if defined(_MSC_VER) #pragma warning( disable : 4146 ) #endif diff --git a/src/real/frexp.c b/src/real/frexp.c deleted file mode 100644 index f33cc762..00000000 --- a/src/real/frexp.c +++ /dev/null @@ -1,87 +0,0 @@ -/* @(#)s_frexp.c 1.4 95/01/18 */ - -/* - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The origin source code can be obtained from: - * http://www.netlib.org/fdlibm/s_frexp.c - * - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -// NOTICE: Not a part of libamath yet - -/* - * for non-zero x - * x = frexp(arg,&exp); - * return a double fp quantity x such that 0.5 <= |x| <1.0 - * and the corresponding binary exponent "exp". That is - * arg = x*2^exp. - * If arg is inf, 0.0, or NaN, then frexp(arg,&exp) returns arg - * with *exp=0. - */ - -#include "fdlibm.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ - -#ifdef __STDC__ - double frexp(double x, int *eptr) -#else - double frexp(x, eptr) - double x; int *eptr; -#endif -{ - int hx, ix, lx; - hx = __HI(x); - ix = 0x7fffffff&hx; - lx = __LO(x); - *eptr = 0; - if(ix>=0x7ff00000||((ix|lx)==0)) return x; /* 0,inf,nan */ - if (ix<0x00100000) { /* subnormal */ - x *= two54; - hx = __HI(x); - ix = hx&0x7fffffff; - *eptr = -54; - } - *eptr += (ix>>20)-1022; - hx = (hx&0x800fffff)|0x3fe00000; - __HI(x) = hx; - return x; -} \ No newline at end of file diff --git a/src/real/ksin.c b/src/real/ksin.c index 2288ccbe..a8aeab12 100644 --- a/src/real/ksin.c +++ b/src/real/ksin.c @@ -57,6 +57,7 @@ S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ * @date 95/01/18 * @details * + *
  * Kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854
  * Input x is assumed to be bounded by ~pi/4 in magnitude.
  * Input y is the tail of x.
diff --git a/src/real/kstandard.c b/src/real/kstandard.c
deleted file mode 100644
index 79851e9e..00000000
--- a/src/real/kstandard.c
+++ /dev/null
@@ -1,765 +0,0 @@
-/* @(#)k_standard.c 1.3 95/01/18 */
-
-/*
- * Copyright (c) 2014-2017 Carsten Sonne Larsen 
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The origin source code can be obtained from:
- * http://www.netlib.org/fdlibm/k_standard.c
- * 
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- *
- */
-
-// NOTICE: Not a part of libamath yet
-
-#include "fdlibm.h"
-#include 
-
-#ifndef _USE_WRITE
-#include 			/* fputs(), stderr */
-#define	WRITE2(u,v)	fputs(u, stderr)
-#else	/* !defined(_USE_WRITE) */
-#include 			/* write */
-#define	WRITE2(u,v)	write(2, u, v)
-#undef fflush
-#endif	/* !defined(_USE_WRITE) */
-
-static double zero = 0.0;	/* used as const */
-
-/*
- * Standard conformance (non-IEEE) on exception cases.
- * Mapping:
- *	1 -- acos(|x|>1)
- *	2 -- asin(|x|>1)
- *	3 -- atan2(+-0,+-0)
- *	4 -- hypot overflow
- *	5 -- cosh overflow
- *	6 -- exp overflow
- *	7 -- exp underflow
- *	8 -- y0(0)
- *	9 -- y0(-ve)
- *	10-- y1(0)
- *	11-- y1(-ve)
- *	12-- yn(0)
- *	13-- yn(-ve)
- *	14-- lgamma(finite) overflow
- *	15-- lgamma(-integer)
- *	16-- log(0)
- *	17-- log(x<0)
- *	18-- log10(0)
- *	19-- log10(x<0)
- *	20-- pow(0.0,0.0)
- *	21-- pow(x,y) overflow
- *	22-- pow(x,y) underflow
- *	23-- pow(0,negative)
- *	24-- pow(neg,non-integral)
- *	25-- sinh(finite) overflow
- *	26-- sqrt(negative)
- *      27-- fmod(x,0)
- *      28-- remainder(x,0)
- *	29-- acosh(x<1)
- *	30-- atanh(|x|>1)
- *	31-- atanh(|x|=1)
- *	32-- scalb overflow
- *	33-- scalb underflow
- *	34-- j0(|x|>X_TLOSS)
- *	35-- y0(x>X_TLOSS)
- *	36-- j1(|x|>X_TLOSS)
- *	37-- y1(x>X_TLOSS)
- *	38-- jn(|x|>X_TLOSS, n)
- *	39-- yn(x>X_TLOSS, n)
- *	40-- gamma(finite) overflow
- *	41-- gamma(-integer)
- *	42-- pow(NaN,0.0)
- */
-
-
-#ifdef __STDC__
-double __kernel_standard(double x, double y, int type)
-#else
-double __kernel_standard(x,y,type)
-double x,y;
-int type;
-#endif
-{
-    struct exception exc;
-#ifndef HUGE_VAL	/* this is the only routine that uses HUGE_VAL */
-#define HUGE_VAL inf
-    double inf = 0.0;
-
-    __HI(inf) = 0x7ff00000;	/* set inf to infinite */
-#endif
-
-#ifdef _USE_WRITE
-    (void) fflush(stdout);
-#endif
-    exc.arg1 = x;
-    exc.arg2 = y;
-    switch(type) {
-    case 1:
-        /* acos(|x|>1) */
-        exc.type = DOMAIN;
-        exc.name = "acos";
-        exc.retval = zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if(_LIB_VERSION == _SVID_) {
-                (void) WRITE2("acos: DOMAIN error\n", 19);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 2:
-        /* asin(|x|>1) */
-        exc.type = DOMAIN;
-        exc.name = "asin";
-        exc.retval = zero;
-        if(_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if(_LIB_VERSION == _SVID_) {
-                (void) WRITE2("asin: DOMAIN error\n", 19);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 3:
-        /* atan2(+-0,+-0) */
-        exc.arg1 = y;
-        exc.arg2 = x;
-        exc.type = DOMAIN;
-        exc.name = "atan2";
-        exc.retval = zero;
-        if(_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if(_LIB_VERSION == _SVID_) {
-                (void) WRITE2("atan2: DOMAIN error\n", 20);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 4:
-        /* hypot(finite,finite) overflow */
-        exc.type = OVERFLOW;
-        exc.name = "hypot";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = HUGE;
-        else
-            exc.retval = HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            errno = ERANGE;
-        }
-        break;
-    case 5:
-        /* cosh(finite) overflow */
-        exc.type = OVERFLOW;
-        exc.name = "cosh";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = HUGE;
-        else
-            exc.retval = HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            errno = ERANGE;
-        }
-        break;
-    case 6:
-        /* exp(finite) overflow */
-        exc.type = OVERFLOW;
-        exc.name = "exp";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = HUGE;
-        else
-            exc.retval = HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            errno = ERANGE;
-        }
-        break;
-    case 7:
-        /* exp(finite) underflow */
-        exc.type = UNDERFLOW;
-        exc.name = "exp";
-        exc.retval = zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            errno = ERANGE;
-        }
-        break;
-    case 8:
-        /* y0(0) = -inf */
-        exc.type = DOMAIN;	/* should be SING for IEEE */
-        exc.name = "y0";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = -HUGE;
-        else
-            exc.retval = -HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("y0: DOMAIN error\n", 17);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 9:
-        /* y0(x<0) = NaN */
-        exc.type = DOMAIN;
-        exc.name = "y0";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = -HUGE;
-        else
-            exc.retval = -HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("y0: DOMAIN error\n", 17);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 10:
-        /* y1(0) = -inf */
-        exc.type = DOMAIN;	/* should be SING for IEEE */
-        exc.name = "y1";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = -HUGE;
-        else
-            exc.retval = -HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("y1: DOMAIN error\n", 17);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 11:
-        /* y1(x<0) = NaN */
-        exc.type = DOMAIN;
-        exc.name = "y1";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = -HUGE;
-        else
-            exc.retval = -HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("y1: DOMAIN error\n", 17);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 12:
-        /* yn(n,0) = -inf */
-        exc.type = DOMAIN;	/* should be SING for IEEE */
-        exc.name = "yn";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = -HUGE;
-        else
-            exc.retval = -HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("yn: DOMAIN error\n", 17);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 13:
-        /* yn(x<0) = NaN */
-        exc.type = DOMAIN;
-        exc.name = "yn";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = -HUGE;
-        else
-            exc.retval = -HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("yn: DOMAIN error\n", 17);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 14:
-        /* lgamma(finite) overflow */
-        exc.type = OVERFLOW;
-        exc.name = "lgamma";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = HUGE;
-        else
-            exc.retval = HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            errno = ERANGE;
-        }
-        break;
-    case 15:
-        /* lgamma(-integer) or lgamma(0) */
-        exc.type = SING;
-        exc.name = "lgamma";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = HUGE;
-        else
-            exc.retval = HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("lgamma: SING error\n", 19);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 16:
-        /* log(0) */
-        exc.type = SING;
-        exc.name = "log";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = -HUGE;
-        else
-            exc.retval = -HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("log: SING error\n", 16);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 17:
-        /* log(x<0) */
-        exc.type = DOMAIN;
-        exc.name = "log";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = -HUGE;
-        else
-            exc.retval = -HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("log: DOMAIN error\n", 18);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 18:
-        /* log10(0) */
-        exc.type = SING;
-        exc.name = "log10";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = -HUGE;
-        else
-            exc.retval = -HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("log10: SING error\n", 18);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 19:
-        /* log10(x<0) */
-        exc.type = DOMAIN;
-        exc.name = "log10";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = -HUGE;
-        else
-            exc.retval = -HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("log10: DOMAIN error\n", 20);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 20:
-        /* pow(0.0,0.0) */
-        /* error only if _LIB_VERSION == _SVID_ */
-        exc.type = DOMAIN;
-        exc.name = "pow";
-        exc.retval = zero;
-        if (_LIB_VERSION != _SVID_) exc.retval = 1.0;
-        else if (!matherr(&exc)) {
-            (void) WRITE2("pow(0,0): DOMAIN error\n", 23);
-            errno = EDOM;
-        }
-        break;
-    case 21:
-        /* pow(x,y) overflow */
-        exc.type = OVERFLOW;
-        exc.name = "pow";
-        if (_LIB_VERSION == _SVID_) {
-            exc.retval = HUGE;
-            y *= 0.5;
-            if(xzero) ? HUGE : -HUGE);
-        else
-            exc.retval = ( (x>zero) ? HUGE_VAL : -HUGE_VAL);
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            errno = ERANGE;
-        }
-        break;
-    case 26:
-        /* sqrt(x<0) */
-        exc.type = DOMAIN;
-        exc.name = "sqrt";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = zero;
-        else
-            exc.retval = zero/zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("sqrt: DOMAIN error\n", 19);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 27:
-        /* fmod(x,0) */
-        exc.type = DOMAIN;
-        exc.name = "fmod";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = x;
-        else
-            exc.retval = zero/zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("fmod:  DOMAIN error\n", 20);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 28:
-        /* remainder(x,0) */
-        exc.type = DOMAIN;
-        exc.name = "remainder";
-        exc.retval = zero/zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("remainder: DOMAIN error\n", 24);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 29:
-        /* acosh(x<1) */
-        exc.type = DOMAIN;
-        exc.name = "acosh";
-        exc.retval = zero/zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("acosh: DOMAIN error\n", 20);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 30:
-        /* atanh(|x|>1) */
-        exc.type = DOMAIN;
-        exc.name = "atanh";
-        exc.retval = zero/zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("atanh: DOMAIN error\n", 20);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 31:
-        /* atanh(|x|=1) */
-        exc.type = SING;
-        exc.name = "atanh";
-        exc.retval = x/zero;	/* sign(x)*inf */
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("atanh: SING error\n", 18);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 32:
-        /* scalb overflow; SVID also returns +-HUGE_VAL */
-        exc.type = OVERFLOW;
-        exc.name = "scalb";
-        exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            errno = ERANGE;
-        }
-        break;
-    case 33:
-        /* scalb underflow */
-        exc.type = UNDERFLOW;
-        exc.name = "scalb";
-        exc.retval = copysign(zero,x);
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            errno = ERANGE;
-        }
-        break;
-    case 34:
-        /* j0(|x|>X_TLOSS) */
-        exc.type = TLOSS;
-        exc.name = "j0";
-        exc.retval = zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2(exc.name, 2);
-                (void) WRITE2(": TLOSS error\n", 14);
-            }
-            errno = ERANGE;
-        }
-        break;
-    case 35:
-        /* y0(x>X_TLOSS) */
-        exc.type = TLOSS;
-        exc.name = "y0";
-        exc.retval = zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2(exc.name, 2);
-                (void) WRITE2(": TLOSS error\n", 14);
-            }
-            errno = ERANGE;
-        }
-        break;
-    case 36:
-        /* j1(|x|>X_TLOSS) */
-        exc.type = TLOSS;
-        exc.name = "j1";
-        exc.retval = zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2(exc.name, 2);
-                (void) WRITE2(": TLOSS error\n", 14);
-            }
-            errno = ERANGE;
-        }
-        break;
-    case 37:
-        /* y1(x>X_TLOSS) */
-        exc.type = TLOSS;
-        exc.name = "y1";
-        exc.retval = zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2(exc.name, 2);
-                (void) WRITE2(": TLOSS error\n", 14);
-            }
-            errno = ERANGE;
-        }
-        break;
-    case 38:
-        /* jn(|x|>X_TLOSS) */
-        exc.type = TLOSS;
-        exc.name = "jn";
-        exc.retval = zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2(exc.name, 2);
-                (void) WRITE2(": TLOSS error\n", 14);
-            }
-            errno = ERANGE;
-        }
-        break;
-    case 39:
-        /* yn(x>X_TLOSS) */
-        exc.type = TLOSS;
-        exc.name = "yn";
-        exc.retval = zero;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2(exc.name, 2);
-                (void) WRITE2(": TLOSS error\n", 14);
-            }
-            errno = ERANGE;
-        }
-        break;
-    case 40:
-        /* gamma(finite) overflow */
-        exc.type = OVERFLOW;
-        exc.name = "gamma";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = HUGE;
-        else
-            exc.retval = HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = ERANGE;
-        else if (!matherr(&exc)) {
-            errno = ERANGE;
-        }
-        break;
-    case 41:
-        /* gamma(-integer) or gamma(0) */
-        exc.type = SING;
-        exc.name = "gamma";
-        if (_LIB_VERSION == _SVID_)
-            exc.retval = HUGE;
-        else
-            exc.retval = HUGE_VAL;
-        if (_LIB_VERSION == _POSIX_)
-            errno = EDOM;
-        else if (!matherr(&exc)) {
-            if (_LIB_VERSION == _SVID_) {
-                (void) WRITE2("gamma: SING error\n", 18);
-            }
-            errno = EDOM;
-        }
-        break;
-    case 42:
-        /* pow(NaN,0.0) */
-        /* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */
-        exc.type = DOMAIN;
-        exc.name = "pow";
-        exc.retval = x;
-        if (_LIB_VERSION == _IEEE_ ||
-                _LIB_VERSION == _POSIX_) exc.retval = 1.0;
-        else if (!matherr(&exc)) {
-            errno = EDOM;
-        }
-        break;
-    }
-    return exc.retval;
-}
diff --git a/src/real/ktan.c b/src/real/ktan.c
index 1f216cb6..88a31f46 100644
--- a/src/real/ktan.c
+++ b/src/real/ktan.c
@@ -72,6 +72,7 @@ static const double xxx[] = {
  * @date    04/04/22
  * @details
  *
+ * 
  * Kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
  * Input x is assumed to be bounded by ~pi/4 in magnitude.
  * Input y is the tail of x.
diff --git a/src/real/modf.c b/src/real/modf.c
deleted file mode 100644
index 5c0ccd07..00000000
--- a/src/real/modf.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* @(#)s_modf.c 1.3 95/01/18 */
-
-/*
- * Copyright (c) 2014-2017 Carsten Sonne Larsen 
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The origin source code can be obtained from:
- * http://www.netlib.org/fdlibm/s_modf.c
- * 
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-// NOTICE: Not a part of libamath yet
-
-/*
- * modf(double x, double *iptr)
- * return fraction part of x, and return x's integral part in *iptr.
- * Method:
- *	Bit twiddling.
- *
- * Exception:
- *	No exception.
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-static const double one = 1.0;
-#else
-static double one = 1.0;
-#endif
-
-#ifdef __STDC__
-double modf(double x, double *iptr)
-#else
-double modf(x, iptr)
-double x,*iptr;
-#endif
-{
-    int i0,i1,j0;
-    unsigned i;
-    i0 =  __HI(x);		/* high x */
-    i1 =  __LO(x);		/* low  x */
-    j0 = ((i0>>20)&0x7ff)-0x3ff;	/* exponent of x */
-    if(j0<20) {			/* integer part in high x */
-        if(j0<0) {			/* |x|<1 */
-            __HIp(iptr) = i0&0x80000000;
-            __LOp(iptr) = 0;		/* *iptr = +-0 */
-            return x;
-        } else {
-            i = (0x000fffff)>>j0;
-            if(((i0&i)|i1)==0) {		/* x is integral */
-                *iptr = x;
-                __HI(x) &= 0x80000000;
-                __LO(x)  = 0;	/* return +-0 */
-                return x;
-            } else {
-                __HIp(iptr) = i0&(~i);
-                __LOp(iptr) = 0;
-                return x - *iptr;
-            }
-        }
-    } else if (j0>51) {		/* no fraction part */
-        *iptr = x*one;
-        __HI(x) &= 0x80000000;
-        __LO(x)  = 0;	/* return +-0 */
-        return x;
-    } else {			/* fraction part in low x */
-        i = ((unsigned)(0xffffffff))>>(j0-20);
-        if((i1&i)==0) { 		/* x is integral */
-            *iptr = x;
-            __HI(x) &= 0x80000000;
-            __LO(x)  = 0;	/* return +-0 */
-            return x;
-        } else {
-            __HIp(iptr) = i0;
-            __LOp(iptr) = i1&(~i);
-            return x - *iptr;
-        }
-    }
-}
diff --git a/src/real/nextafter.c b/src/real/nextafter.c
deleted file mode 100644
index 654f884b..00000000
--- a/src/real/nextafter.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* @(#)s_nextafter.c 1.3 95/01/18 */
-
-/*
- * Copyright (c) 2014-2017 Carsten Sonne Larsen 
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The origin source code can be obtained from:
- * http://www.netlib.org/fdlibm/s_nextafter.c
- * 
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-// NOTICE: Not a part of libamath yet
-
-/* IEEE functions
- *	nextafter(x,y)
- *	return the next machine floating-point number of x in the
- *	direction toward y.
- *   Special cases:
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-double nextafter(double x, double y)
-#else
-double nextafter(x,y)
-double x,y;
-#endif
-{
-    int	hx,hy,ix,iy;
-    unsigned lx,ly;
-
-    hx = __HI(x);		/* high word of x */
-    lx = __LO(x);		/* low  word of x */
-    hy = __HI(y);		/* high word of y */
-    ly = __LO(y);		/* low  word of y */
-    ix = hx&0x7fffffff;		/* |x| */
-    iy = hy&0x7fffffff;		/* |y| */
-
-    if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) ||   /* x is nan */
-            ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0))     /* y is nan */
-        return x+y;
-    if(x==y) return x;		/* x=y, return x */
-    if((ix|lx)==0) {			/* x == 0 */
-        __HI(x) = hy&0x80000000;	/* return +-minsubnormal */
-        __LO(x) = 1;
-        y = x*x;
-        if(y==x) return y;
-        else return x;	/* raise underflow flag */
-    }
-    if(hx>=0) {				/* x > 0 */
-        if(hx>hy||((hx==hy)&&(lx>ly))) {	/* x > y, x -= ulp */
-            if(lx==0) hx -= 1;
-            lx -= 1;
-        } else {				/* x < y, x += ulp */
-            lx += 1;
-            if(lx==0) hx += 1;
-        }
-    } else {				/* x < 0 */
-        if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))) { /* x < y, x -= ulp */
-            if(lx==0) hx -= 1;
-            lx -= 1;
-        } else {				/* x > y, x += ulp */
-            lx += 1;
-            if(lx==0) hx += 1;
-        }
-    }
-    hy = hx&0x7ff00000;
-    if(hy>=0x7ff00000) return x+x;	/* overflow  */
-    if(hy<0x00100000) {		/* underflow */
-        y = x*x;
-        if(y!=x) {		/* raise underflow flag */
-            __HI(y) = hx;
-            __LO(y) = lx;
-            return y;
-        }
-    }
-    __HI(x) = hx;
-    __LO(x) = lx;
-    return x;
-}
diff --git a/src/real/prim.h b/src/real/prim.h
index db63be9d..dd3f9d8c 100644
--- a/src/real/prim.h
+++ b/src/real/prim.h
@@ -31,7 +31,7 @@
 #define AMATH_LIB_REAL_PRIM_H
 
 /**
- * @file  prim.h
+ * @file  real/prim.h
  * @brief Primitives in math library for handling real numbers.
  *
  * The library is based on fdlib by Sun Microsystems.
diff --git a/src/real/rint.c b/src/real/rint.c
deleted file mode 100644
index 274eafac..00000000
--- a/src/real/rint.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* @(#)s_rint.c 1.3 95/01/18 */
-
-/*
- * Copyright (c) 2014-2017 Carsten Sonne Larsen 
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The origin source code can be obtained from:
- * http://www.netlib.org/fdlibm/s_rint.c
- * 
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * rint(x)
- * Return x rounded to integral value according to the prevailing
- * rounding mode.
- * Method:
- *	Using floating addition.
- * Exception:
- *	Inexact flag raised if x not equal to rint(x).
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
-TWO52[2]= {
-    4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
-    -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
-};
-
-#ifdef __STDC__
-double rint(double x)
-#else
-double rint(x)
-double x;
-#endif
-{
-    int i0,j0,sx;
-    unsigned i,i1;
-    double w,t;
-    i0 =  __HI(x);
-    sx = (i0>>31)&1;
-    i1 =  __LO(x);
-    j0 = ((i0>>20)&0x7ff)-0x3ff;
-    if(j0<20) {
-        if(j0<0) {
-            if(((i0&0x7fffffff)|i1)==0) return x;
-            i1 |= (i0&0x0fffff);
-            i0 &= 0xfffe0000;
-            i0 |= ((i1|-i1)>>12)&0x80000;
-            __HI(x)=i0;
-            w = TWO52[sx]+x;
-            t =  w-TWO52[sx];
-            i0 = __HI(t);
-            __HI(t) = (i0&0x7fffffff)|(sx<<31);
-            return t;
-        } else {
-            i = (0x000fffff)>>j0;
-            if(((i0&i)|i1)==0) return x; /* x is integral */
-            i>>=1;
-            if(((i0&i)|i1)!=0) {
-                if(j0==19) i1 = 0x40000000;
-                else
-                    i0 = (i0&(~i))|((0x20000)>>j0);
-            }
-        }
-    } else if (j0>51) {
-        if(j0==0x400) return x+x;	/* inf or NaN */
-        else return x;		/* x is integral */
-    } else {
-        i = ((unsigned)(0xffffffff))>>(j0-20);
-        if((i1&i)==0) return x;	/* x is integral */
-        i>>=1;
-        if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20));
-    }
-    __HI(x) = i0;
-    __LO(x) = i1;
-    w = TWO52[sx]+x;
-    return w-TWO52[sx];
-}
diff --git a/src/real/sqrt.c b/src/real/sqrt.c
index 5a463a75..5a057ba9 100644
--- a/src/real/sqrt.c
+++ b/src/real/sqrt.c
@@ -117,7 +117,6 @@ static const double one = 1.0, tiny = 1.0e-300;
  *	sqrt(-ve) = NaN		... with invalid signal
  *	sqrt(NaN) = NaN		... with invalid signal for signaling NaN
  * 
- * Other methods : see the @ref squareroot. * * @copyright Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * @license Developed at SunSoft, a Sun Microsystems, Inc. business. Permission diff --git a/src/system/Makefile b/src/system/Makefile index e5ac3297..cf9e6c5e 100644 --- a/src/system/Makefile +++ b/src/system/Makefile @@ -22,15 +22,6 @@ filesystem_amiga.o: filesystem_amiga.cpp filesystem_stdc.o: filesystem_stdc.cpp ${CXX} ${CXXFLAGS} -c filesystem_stdc.cpp -graph.o: graph.cpp - ${CXX} ${CXXFLAGS} -c graph.cpp - -graph_amiga.o: graph_amiga.cpp - ${CXX} ${CXXFLAGS} -c graph_amiga.cpp - -graph_gtk.o: graph_gtk.cpp - ${CXX} ${CXXFLAGS} -c graph_gtk.cpp - language.o: language.cpp ${CXX} ${CXXFLAGS} -c language.cpp @@ -76,10 +67,10 @@ task_stdc.o: task_stdc.cpp window_amiga.o: window_amiga.cpp ${CXX} ${CXXFLAGS} -c window_amiga.cpp -lib: console.o console_amiga.o console_stdc.o filesystem_amiga.o filesystem_stdc.o graph.o graph_amiga.o graph_gtk.o language.o language_amiga.o language_posix.o language_stdc.o preferences.o preferences_amiga.o preferences_stdc.o proc_amiga.o program.o program_amiga.o program_stdc.o program_test.o task_amiga.o task_stdc.o window_amiga.o - ${AR} rcs libappsystem.a console.o console_amiga.o console_stdc.o filesystem_amiga.o filesystem_stdc.o graph.o graph_amiga.o graph_gtk.o language.o language_amiga.o language_posix.o language_stdc.o preferences.o preferences_amiga.o preferences_stdc.o proc_amiga.o program.o program_amiga.o program_stdc.o program_test.o task_amiga.o task_stdc.o window_amiga.o +lib: console.o console_amiga.o console_stdc.o filesystem_amiga.o filesystem_stdc.o language.o language_amiga.o language_posix.o language_stdc.o preferences.o preferences_amiga.o preferences_stdc.o proc_amiga.o program.o program_amiga.o program_stdc.o program_test.o task_amiga.o task_stdc.o window_amiga.o + ${AR} rcs libappsystem.a console.o console_amiga.o console_stdc.o filesystem_amiga.o filesystem_stdc.o language.o language_amiga.o language_posix.o language_stdc.o preferences.o preferences_amiga.o preferences_stdc.o proc_amiga.o program.o program_amiga.o program_stdc.o program_test.o task_amiga.o task_stdc.o window_amiga.o ${RANLIB} libappsystem.a clean: - ${DEL} libappsystem.a console.o console_amiga.o console_stdc.o filesystem_amiga.o filesystem_stdc.o graph.o graph_amiga.o graph_gtk.o language.o language_amiga.o language_posix.o language_stdc.o preferences.o preferences_amiga.o preferences_stdc.o proc_amiga.o program.o program_amiga.o program_stdc.o program_test.o task_amiga.o task_stdc.o window_amiga.o + ${DEL} libappsystem.a console.o console_amiga.o console_stdc.o filesystem_amiga.o filesystem_stdc.o language.o language_amiga.o language_posix.o language_stdc.o preferences.o preferences_amiga.o preferences_stdc.o proc_amiga.o program.o program_amiga.o program_stdc.o program_test.o task_amiga.o task_stdc.o window_amiga.o diff --git a/src/system/console.cpp b/src/system/console.cpp index db5d9941..ce9b759f 100644 --- a/src/system/console.cpp +++ b/src/system/console.cpp @@ -27,12 +27,11 @@ * */ -#include "amath.h" #include "amath.h" #include "amathc.h" +#include "console.h" +#include "program.h" #include "localize/text.h" -#include "system/console.h" -#include "system/program.h" ConsoleBase::ConsoleBase(const char* prompt) { diff --git a/src/system/console.h b/src/system/console.h index 5763ec2e..b82d011a 100644 --- a/src/system/console.h +++ b/src/system/console.h @@ -36,7 +36,7 @@ * */ -#include "system/thread.h" +#include "thread.h" /** * @brief Abstract base class encapsulating console logic. diff --git a/src/system/console_amiga.cpp b/src/system/console_amiga.cpp index a1a51360..64e86f7a 100644 --- a/src/system/console_amiga.cpp +++ b/src/system/console_amiga.cpp @@ -29,8 +29,8 @@ #include "amath.h" #include "amathc.h" +#include "console_amiga.h" #include "main/evaluator.h" -#include "system/console_amiga.h" #ifdef AMIGA #include diff --git a/src/system/console_amiga.h b/src/system/console_amiga.h index 60590c57..7368bb2a 100644 --- a/src/system/console_amiga.h +++ b/src/system/console_amiga.h @@ -38,7 +38,7 @@ #include "amath.h" #include "amathc.h" -#include "system/console.h" +#include "console.h" #ifdef AMIGA diff --git a/src/system/console_stdc.cpp b/src/system/console_stdc.cpp index 79c46082..2d88c769 100644 --- a/src/system/console_stdc.cpp +++ b/src/system/console_stdc.cpp @@ -29,9 +29,11 @@ #include "amath.h" #include "amathc.h" +#include "console.h" +#include "console_stdc.h" #include "lib/charval.h" +#include "lib/aengine.h" #include "main/evaluator.h" -#include "system/console_stdc.h" #if !defined(AMIGA) #include diff --git a/src/system/console_stdc.h b/src/system/console_stdc.h index 877378ae..035d9d1e 100644 --- a/src/system/console_stdc.h +++ b/src/system/console_stdc.h @@ -38,9 +38,9 @@ #include "amath.h" #include "amathc.h" +#include "console.h" #include "lib/charval.h" #include "lib/aengine.h" -#include "system/console.h" #if !defined(AMIGA) diff --git a/src/system/filesystem_amiga.cpp b/src/system/filesystem_amiga.cpp index 71a4450a..41571bc7 100644 --- a/src/system/filesystem_amiga.cpp +++ b/src/system/filesystem_amiga.cpp @@ -29,10 +29,10 @@ #include "amath.h" #include "amathc.h" +#include "program.h" +#include "filesystem_amiga.h" #include "lib/charbuf.h" #include "localize/text.h" -#include "system/program.h" -#include "system/filesystem_amiga.h" #ifdef AMIGA #include diff --git a/src/system/filesystem_amiga.h b/src/system/filesystem_amiga.h index 7b437dd2..29da6792 100644 --- a/src/system/filesystem_amiga.h +++ b/src/system/filesystem_amiga.h @@ -38,7 +38,7 @@ #include "amath.h" #include "amathc.h" -#include "system/filesystem.h" +#include "filesystem.h" #ifdef AMIGA diff --git a/src/system/filesystem_stdc.cpp b/src/system/filesystem_stdc.cpp index 92c89000..b2048044 100644 --- a/src/system/filesystem_stdc.cpp +++ b/src/system/filesystem_stdc.cpp @@ -30,11 +30,11 @@ #include "amath.h" #include "amathc.h" +#include "program.h" +#include "filesystem.h" +#include "filesystem_stdc.h" #include "lib/charbuf.h" #include "localize/text.h" -#include "system/program.h" -#include "system/filesystem.h" -#include "system/filesystem_stdc.h" #if !defined(AMIGA) #include diff --git a/src/system/filesystem_stdc.h b/src/system/filesystem_stdc.h index 39733139..3abd6f1f 100644 --- a/src/system/filesystem_stdc.h +++ b/src/system/filesystem_stdc.h @@ -38,8 +38,8 @@ #include "amath.h" #include "amathc.h" +#include "filesystem.h" #include "lib/charbuf.h" -#include "system/filesystem.h" #if !defined(AMIGA) diff --git a/src/system/graph_amiga.cpp b/src/system/graph_amiga.cpp deleted file mode 100644 index bfe9b9b4..00000000 --- a/src/system/graph_amiga.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/*- - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Project homepage: - * http://amath.innolan.net - * - */ - -#include "amath.h" -#include "amathc.h" -#include "lib/real.h" -#include "main/fgrid.h" -#include "main/functions.h" -#include "system/graph_amiga.h" - -#if 0 - -#ifdef AMIGA -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -AmigaGraphWindow::AmigaGraphWindow() : - GraphWindow() -{ - window = nullptr; -} - -AmigaGraphWindow::~AmigaGraphWindow() -{ - if (window != nullptr) { - CloseWindow(window); - } -} - -void AmigaGraphWindow::OpenGraphWindow(UserFunction* function) -{ - grid = new Grid(function); - - window = OpenWindowTags(NULL, - WA_Left, 20, WA_Top, 20, - WA_Width, width, WA_Height, height, - WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_REFRESHWINDOW, - WA_Flags, WFLG_SIZEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_ACTIVATE | - WFLG_SMART_REFRESH, - WA_Title, (BYTE*)function->GetDefitionName(), - TAG_DONE); - - grid->SetScreenBounderues(0, width - 15, 0, height - 15); - grid->SetFunctionBounderies(min, max); - DrawAxis(); -} - -void AmigaGraphWindow::CloseGraphWindow() -{ - //TODO: Implement -} - -void AmigaGraphWindow::DrawGraph(UserFunction* function) -{ - RastPort *rp = window->RPort; - SetAPen(rp, (ULONG)17); - bool first = true; - - RealNumber *parameter = new RealNumber(); - double x = min; - double y; - double step = grid->GetHorizontalResolution(); - - int screenX; - int screenY; - - while (x < max) { - parameter->SetRealValue(x); - function->GetVariable()->AssignValue(parameter); - Number *res = function->GetExpression()->Evaluate(); - y = res->GetRealValue(); - - grid->GetScreenCoordinates(x, &screenX, y, &screenY); - if (screenX != -1 && screenY != -1) { - if (first) { - Move(rp, screenX, height - screenY); - first = false; - } else { - Draw(rp, screenX, height - screenY); - } - } - - x = x + step; - } -} - -void AmigaGraphWindow::DrawAxis() -{ - const int arrow = 4; - int xstart, ystart; - int xend, yend; - - RastPort *rp = window->RPort; - SetAPen(rp, (ULONG)17); - - grid->GetXAxis(&xstart, &xend, &ystart, ¥d); - Move(rp, xstart, height - ystart); - Draw(rp, xend, height - yend); - - Draw(rp, xend - arrow, height - yend + arrow); - Move(rp, xend, height - yend); - Draw(rp, xend - arrow, height - yend - arrow); - - grid->GetYAxis(&xstart, &xend, &ystart, ¥d); - Move(rp, xstart, height - ystart); - Draw(rp, xend, height - yend); - - Draw(rp, xend - arrow, height - yend + arrow); - Move(rp, xend, height - yend); - Draw(rp, xend + arrow, height - yend + arrow); -} - -#endif - -#endif diff --git a/src/system/graph_amiga.h b/src/system/graph_amiga.h deleted file mode 100644 index 8222f779..00000000 --- a/src/system/graph_amiga.h +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Project homepage: - * http://amath.innolan.net - * - */ - -#ifndef AMATH_AMIGA_GRAPH_WINDOW_H -#define AMATH_AMIGA_GRAPH_WINDOW_H - -/** - * @file graph_amiga.h - * @brief Amiga OS specific graph window. - * - */ - -#if 0 - -#include "clib.h" -#include "lib/real.h" -#include "lib/fgrid.h" -#include "main/functions.h" -#include "system/graph.h" - -#ifdef AMIGA -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class AmigaGraphWindow : public GraphWindow { -public: - AmigaGraphWindow(); - ~AmigaGraphWindow(); - - void OpenGraphWindow(UserFunction* function); - void CloseGraphWindow(); - void DrawGraph(UserFunction* function); - -private: - void DrawAxis(); - - static const int width = 400; - static const int height = 300; - - static const double min = -5.0; - static const double max = +5.0; - - Window *window; -}; - -#endif -#endif -#endif diff --git a/src/system/graph_gtk.cpp b/src/system/graph_gtk.cpp deleted file mode 100644 index d39af0d2..00000000 --- a/src/system/graph_gtk.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/*- - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Project homepage: - * http://amath.innolan.net - * - */ - -#ifdef GTK -#include -#include "system/graph_gtk.h" - -GtkGraphWindow::GtkGraphWindow(UserFunction* function) -{ - -} - -GtkGraphWindow::~GtkGraphWindow() -{ - -} - -/* Backing pixmap for drawing area */ -static GdkPixmap *pixmap = NULL; - -/* Create a new backing pixmap of the appropriate size */ -static gboolean configure_event( GtkWidget *widget, - GdkEventConfigure *event ) -{ - if (pixmap) - g_object_unref (pixmap); - - pixmap = gdk_pixmap_new (widget->window, - widget->allocation.width, - widget->allocation.height, - -1); - - gdk_draw_rectangle (pixmap, - widget->style->white_gc, - TRUE, - 0, 0, - widget->allocation.width, - widget->allocation.height); - - return TRUE; -} - -/* Redraw the screen from the backing pixmap */ -static gboolean expose_event( GtkWidget *widget, - GdkEventExpose *event ) -{ - gdk_draw_drawable (widget->window, - widget->style->fg_gc[gtk_widget_get_state (widget)], - pixmap, - event->area.x, event->area.y, - event->area.x, event->area.y, - event->area.width, event->area.height); - - return FALSE; -} - -/* Draw a rectangle on the screen */ -static void draw_brush( GtkWidget *widget, - gdouble x, - gdouble y) -{ - GdkRectangle update_rect; - - update_rect.x = x - 5; - update_rect.y = y - 5; - update_rect.width = 10; - update_rect.height = 10; - - gdk_draw_rectangle (pixmap, - widget->style->black_gc, - TRUE, - update_rect.x, update_rect.y, - update_rect.width, update_rect.height); - - gtk_widget_queue_draw_area (widget, - update_rect.x, update_rect.y, - update_rect.width, update_rect.height); -} - -static gboolean button_press_event( GtkWidget *widget, - GdkEventButton *event ) -{ - if (event->button == 1 && pixmap != NULL) - draw_brush (widget, event->x, event->y); - - return TRUE; -} - -/* -static gboolean motion_notify_event( GtkWidget *widget, - GdkEventMotion *event ) -{ - int x, y; - GdkModifierType state; - - if (event->is_hint) - gdk_window_get_pointer (event->window, &x, &y, &state); - else - { - x = event->x; - y = event->y; - state = event->state; - } - - if (state & GDK_BUTTON1_MASK && pixmap != NULL) - draw_brush (widget, x, y); - - return TRUE; -} -*/ - -//void quit () -//{ -// exit (0); -//} - -void GtkGraphWindow::DrawGraph() -{ - GtkWidget *window; - GtkWidget *drawing_area; - GtkWidget *vbox; - - GtkWidget *button; - - gtk_init (NULL, NULL); - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_set_name (window, "Test Input"); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (window), vbox); - gtk_widget_show (vbox); - - g_signal_connect (window, "destroy", - G_CALLBACK (gtk_main_quit), NULL); - - /* Create the drawing area */ - - drawing_area = gtk_drawing_area_new (); - gtk_widget_set_size_request (GTK_WIDGET (drawing_area), 200, 200); - gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0); - - gtk_widget_show (drawing_area); - - /* Signals used to handle backing pixmap */ - - //g_signal_connect (drawing_area, "expose_event", - // G_CALLBACK (expose_event), NULL); - //g_signal_connect (drawing_area, "configure_event", - // G_CALLBACK (configure_event), NULL); - - /* Event signals */ - - //g_signal_connect (drawing_area, "motion_notify_event", - // G_CALLBACK (motion_notify_event), NULL); - //g_signal_connect (drawing_area, "button_press_event", - // G_CALLBACK (button_press_event), NULL); - - gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK - | GDK_LEAVE_NOTIFY_MASK - | GDK_BUTTON_PRESS_MASK - | GDK_POINTER_MOTION_MASK - | GDK_POINTER_MOTION_HINT_MASK); - - /* The following call enables tracking and processing of extension - events for the drawing area */ - gtk_widget_set_extension_events (drawing_area, GDK_EXTENSION_EVENTS_CURSOR); - - /* .. And some buttons */ - button = gtk_button_new_with_label ("Input Dialog"); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - - //g_signal_connect (button, "clicked", - // G_CALLBACK (create_input_dialog), NULL); - gtk_widget_show (button); - - button = gtk_button_new_with_label ("Quit"); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - - g_signal_connect_swapped (button, "clicked", - G_CALLBACK (gtk_widget_destroy), - window); - gtk_widget_show (button); - - gtk_widget_show (window); - - gtk_main (); -} -#endif diff --git a/src/system/language.cpp b/src/system/language.cpp index c3152094..1979731a 100644 --- a/src/system/language.cpp +++ b/src/system/language.cpp @@ -29,6 +29,8 @@ #include "amath.h" #include "amathc.h" +#include "program.h" +#include "language.h" #include "localize/lex.h" #include "localize/help.h" #include "localize/kword.h" @@ -36,8 +38,6 @@ #include "localize/text.h" #include "localize/tags.h" #include "localize/ialias.h" -#include "system/language.h" -#include "system/program.h" Language::Language() { diff --git a/src/system/language_amiga.cpp b/src/system/language_amiga.cpp index dc979627..fd2e5664 100644 --- a/src/system/language_amiga.cpp +++ b/src/system/language_amiga.cpp @@ -29,14 +29,14 @@ #include "amath.h" #include "amathc.h" +#include "program.h" +#include "language_amiga.h" #include "localize/lex.h" #include "localize/help.h" #include "localize/text.h" #include "localize/ident.h" #include "localize/kword.h" #include "localize/tags.h" -#include "system/program.h" -#include "system/language_amiga.h" #ifdef AMIGA #include @@ -174,4 +174,3 @@ bool AmigaLanguage::Validate(char c) //#define CLOSEQUOTE 46 /* end of quoted block */ #endif - diff --git a/src/system/language_amiga.h b/src/system/language_amiga.h index 25d31042..7182e794 100644 --- a/src/system/language_amiga.h +++ b/src/system/language_amiga.h @@ -30,11 +30,11 @@ #ifndef AMATH_LANGUAGE_AMIGA_H #define AMATH_LANGUAGE_AMIGA_H +#include "language.h" #include "localize/lex.h" #include "localize/help.h" #include "localize/text.h" #include "localize/kword.h" -#include "system/language.h" class AmigaLanguage : public Language { diff --git a/src/system/language_posix.cpp b/src/system/language_posix.cpp index 42ed083e..e1af6179 100644 --- a/src/system/language_posix.cpp +++ b/src/system/language_posix.cpp @@ -26,17 +26,17 @@ * http://amath.innolan.net * */ - + #include "amath.h" #include "amathc.h" +#include "program.h" +#include "language_posix.h" #include "localize/lex.h" #include "localize/tags.h" #include "localize/help.h" #include "localize/text.h" #include "localize/ident.h" #include "localize/kword.h" -#include "system/program.h" -#include "system/language_posix.h" #ifdef UNIX #include diff --git a/src/system/language_posix.h b/src/system/language_posix.h index 44c9e8ae..3740fc42 100644 --- a/src/system/language_posix.h +++ b/src/system/language_posix.h @@ -32,11 +32,11 @@ #include "amath.h" #include "amathc.h" +#include "language.h" #include "localize/lex.h" #include "localize/help.h" #include "localize/text.h" #include "localize/kword.h" -#include "system/language.h" #ifdef UNIX #include diff --git a/src/system/language_stdc.cpp b/src/system/language_stdc.cpp index 55995818..1d3e7c40 100644 --- a/src/system/language_stdc.cpp +++ b/src/system/language_stdc.cpp @@ -29,15 +29,15 @@ #include "amath.h" #include "amathc.h" +#include "program.h" +#include "language_stdc.h" +#include "filesystem_stdc.h" #include "localize/lex.h" #include "localize/tags.h" #include "localize/help.h" #include "localize/text.h" #include "localize/ident.h" #include "localize/kword.h" -#include "system/program.h" -#include "system/language_stdc.h" -#include "system/filesystem_stdc.h" #if !defined(AMIGA) @@ -259,4 +259,4 @@ void StandardLanguage::SkipComments() while (skipping); } -#endif \ No newline at end of file +#endif diff --git a/src/system/language_stdc.h b/src/system/language_stdc.h index 0eed0e6d..74691a50 100644 --- a/src/system/language_stdc.h +++ b/src/system/language_stdc.h @@ -32,9 +32,9 @@ #include "amath.h" #include "amathc.h" +#include "language.h" #include "localize/help.h" #include "localize/text.h" -#include "system/language.h" #if !defined(AMIGA) diff --git a/src/system/preferences.cpp b/src/system/preferences.cpp index e692b227..c81df64c 100644 --- a/src/system/preferences.cpp +++ b/src/system/preferences.cpp @@ -29,6 +29,7 @@ #include "amath.h" #include "amathc.h" +#include "preferences.h" #include "lib/numb.h" #include "lib/real.h" #include "lib/ntext.h" @@ -36,7 +37,6 @@ #include "main/lexer.h" #include "main/nodes.h" #include "main/parser.h" -#include "system/preferences.h" PreferencesBase::PreferencesBase() { diff --git a/src/system/preferences_amiga.cpp b/src/system/preferences_amiga.cpp index 5bc2a2bb..70cffe99 100644 --- a/src/system/preferences_amiga.cpp +++ b/src/system/preferences_amiga.cpp @@ -30,8 +30,8 @@ #include "amath.h" #include "amathc.h" #include "lib/charbuf.h" -#include "system/preferences.h" -#include "system/preferences_amiga.h" +#include "preferences.h" +#include "preferences_amiga.h" #ifdef AMIGA #include diff --git a/src/system/preferences_amiga.h b/src/system/preferences_amiga.h index aa2a4640..0c552d48 100644 --- a/src/system/preferences_amiga.h +++ b/src/system/preferences_amiga.h @@ -30,7 +30,7 @@ #ifndef AMATH_PREFERENCES_AMIGA_H #define AMATH_PREFERENCES_AMIGA_H -#include "system/preferences.h" +#include "preferences.h" class AmigaPreferences : public PreferencesBase { diff --git a/src/system/preferences_stdc.cpp b/src/system/preferences_stdc.cpp index 069eebb8..b9c2459e 100644 --- a/src/system/preferences_stdc.cpp +++ b/src/system/preferences_stdc.cpp @@ -30,8 +30,8 @@ #include "amath.h" #include "amathc.h" #include "lib/charbuf.h" -#include "system/preferences.h" -#include "system/preferences_stdc.h" +#include "preferences.h" +#include "preferences_stdc.h" #if !defined(AMIGA) #include @@ -41,8 +41,8 @@ static const char *tempname = "/tmp/amath.prefs"; static const char *permname = "/usr/local/etc/amath.conf"; #else -static const char *tempname = "amath.prefs"; -static const char *permname = "amath.conf"; +static const char* tempname = "amath.prefs"; +static const char* permname = "amath.conf"; #endif bool StandardPreferences::Load() @@ -103,4 +103,3 @@ bool StandardPreferences::SavePrefs(const char* name) } #endif - diff --git a/src/system/preferences_stdc.h b/src/system/preferences_stdc.h index 63ec102e..4e22f942 100644 --- a/src/system/preferences_stdc.h +++ b/src/system/preferences_stdc.h @@ -32,7 +32,7 @@ #include "amath.h" #include "amathc.h" -#include "system/preferences.h" +#include "preferences.h" #if !defined(AMIGA) diff --git a/src/system/proc_amiga.cpp b/src/system/proc_amiga.cpp index b16f0b90..083a4e19 100644 --- a/src/system/proc_amiga.cpp +++ b/src/system/proc_amiga.cpp @@ -29,9 +29,9 @@ #include "amath.h" #include "amathc.h" -#include "system/task.h" -#include "system/thread.h" -#include "system/proc_amiga.h" +#include "task.h" +#include "thread.h" +#include "proc_amiga.h" #ifdef WITHTEST #ifdef AMIGA @@ -55,16 +55,16 @@ AmigaProcess::AmigaProcess() AmigaProcess::~AmigaProcess() { - /* - if (proc != nullptr) { - Forbid(); - DeleteTask(proc); - Permit(); - } - */ +/* +if (proc != nullptr) { + Forbid(); + DeleteTask(proc); + Permit(); +} +*/ - // See: http://eab.abime.net/showthread.php?t=73783 - // And AROS Stack swap: http://en.wikibooks.org/wiki/Aros/Developer/Docs/Examples/StackSwap +// See: http://eab.abime.net/showthread.php?t=73783 +// And AROS Stack swap: http://en.wikibooks.org/wiki/Aros/Developer/Docs/Examples/StackSwap Forbid(); FreeSignal(signal); Permit(); diff --git a/src/system/program.cpp b/src/system/program.cpp index f749b10b..8dab6b0f 100644 --- a/src/system/program.cpp +++ b/src/system/program.cpp @@ -29,22 +29,22 @@ #include "amath.h" #include "amathc.h" +#include "program.h" +#include "language.h" +#include "language_stdc.h" +#include "language_amiga.h" +#include "language_posix.h" +#include "filesystem.h" +#include "filesystem_stdc.h" +#include "filesystem_amiga.h" +#include "preferences.h" +#include "preferences_stdc.h" +#include "preferences_amiga.h" #include "lib/numb.h" #include "lib/ntext.h" #include "lib/integer.h" #include "main/values.h" #include "main/functionlist.h" -#include "system/program.h" -#include "system/language.h" -#include "system/language_stdc.h" -#include "system/language_amiga.h" -#include "system/language_posix.h" -#include "system/filesystem.h" -#include "system/filesystem_stdc.h" -#include "system/filesystem_amiga.h" -#include "system/preferences.h" -#include "system/preferences_stdc.h" -#include "system/preferences_amiga.h" Program::Program() { diff --git a/src/system/program.h b/src/system/program.h index 85030366..8b409603 100644 --- a/src/system/program.h +++ b/src/system/program.h @@ -36,14 +36,14 @@ * */ +#include "console.h" +#include "language.h" +#include "filesystem.h" +#include "preferences.h" #include "lib/numb.h" #include "lib/ntext.h" #include "main/values.h" #include "main/functionlist.h" -#include "system/console.h" -#include "system/language.h" -#include "system/filesystem.h" -#include "system/preferences.h" /** * @brief Master control class. diff --git a/src/system/program_amiga.cpp b/src/system/program_amiga.cpp index 9b870aaa..a077b7d3 100644 --- a/src/system/program_amiga.cpp +++ b/src/system/program_amiga.cpp @@ -29,16 +29,16 @@ #include "amath.h" #include "amathc.h" +#include "console.h" +#include "filesystem.h" +#include "program_amiga.h" +#include "console_amiga.h" +#include "window_amiga.h" +#include "language_amiga.h" +#include "filesystem_amiga.h" +#include "preferences_amiga.h" #include "lib/charbuf.h" #include "main/evaluator.h" -#include "system/console.h" -#include "system/filesystem.h" -#include "system/program_amiga.h" -#include "system/console_amiga.h" -#include "system/window_amiga.h" -#include "system/language_amiga.h" -#include "system/filesystem_amiga.h" -#include "system/preferences_amiga.h" #ifdef AMIGA #define ARGS_FORMAT "SHELL/S,INPUT/F" @@ -116,5 +116,3 @@ void AmigaProgram::Exit() } #endif - - diff --git a/src/system/program_amiga.h b/src/system/program_amiga.h index 522a8549..f301c353 100644 --- a/src/system/program_amiga.h +++ b/src/system/program_amiga.h @@ -27,7 +27,7 @@ * */ -#include "system/program.h" +#include "program.h" struct RDArgs; diff --git a/src/system/program_stdc.cpp b/src/system/program_stdc.cpp index d107cde3..dcef6368 100644 --- a/src/system/program_stdc.cpp +++ b/src/system/program_stdc.cpp @@ -29,13 +29,11 @@ #include "amath.h" #include "amathc.h" +#include "program_stdc.h" +#include "console_stdc.h" +#include "preferences_stdc.h" #include "lib/charbuf.h" #include "main/evaluator.h" -#include "system/program_stdc.h" -#include "system/console_stdc.h" -#include "system/language_stdc.h" -#include "system/filesystem_stdc.h" -#include "system/preferences_stdc.h" #if !defined(AMIGA) #include @@ -114,4 +112,4 @@ void StandardProgram::Exit() Console->Exit(); } -#endif \ No newline at end of file +#endif diff --git a/src/system/program_stdc.h b/src/system/program_stdc.h index 1d5162d5..79b33fb4 100644 --- a/src/system/program_stdc.h +++ b/src/system/program_stdc.h @@ -29,8 +29,8 @@ #include "amath.h" #include "amathc.h" +#include "program.h" #include "lib/charbuf.h" -#include "system/program.h" #if !defined(AMIGA) diff --git a/src/system/program_test.cpp b/src/system/program_test.cpp index 2456ccd1..106ddb98 100644 --- a/src/system/program_test.cpp +++ b/src/system/program_test.cpp @@ -30,9 +30,9 @@ #ifdef WITHTEST #include "amath.h" #include "amathc.h" +#include "program_test.h" #include "lib/charbuf.h" #include "main/evaluator.h" -#include "system/program_test.h" #include TestProgram::TestProgram(bool silent) @@ -42,7 +42,7 @@ TestProgram::TestProgram(bool silent) pass = 0; fail = 0; - // Ignore type of locale fraction point. +// Ignore type of locale fraction point. delete Input; Input = new DecimalSystem(Preferences->GetDigits(), '.'); @@ -219,7 +219,7 @@ void TestProgram::RunTestset02() TestExpression("sin(pi/2)", "sin(pi/2) = 1"); TestExpression("tan(pi)", "tan(pi) = 0"); TestExpression("tan(-pi)", "tan(-pi) = 0"); - //TestExpression("tan(pi/2)", "tan(pi/2) = Inf"); // FAIL + TestExpression("tan(pi/2)", "tan(pi/2) = Inf"); // FAIL TestExpression("sin(1/12*pi)", "sin(1/12*pi) = 0.25881904510252"); TestExpression("sin(11/12*pi)", "sin(11/12*pi) = 0.25881904510252"); TestExpression("sin(1/6*pi)", "sin(1/6*pi) = 0.5"); @@ -536,7 +536,7 @@ void TestProgram::RunTestset08() TestExpression("1i-1.0i", "1i-1i = 0"); TestExpression("1.0i-1.0i", "1i-1i = 0"); - // Mul, Div ... +// Mul, Div ... } void TestProgram::RunTestset09() diff --git a/src/system/program_test.h b/src/system/program_test.h index 4ad452d6..fb5f8f55 100644 --- a/src/system/program_test.h +++ b/src/system/program_test.h @@ -33,7 +33,7 @@ * */ -#include "system/program.h" +#include "program.h" /** * @brief Test control class. diff --git a/src/system/system.vcxproj b/src/system/system.vcxproj new file mode 100644 index 00000000..435d2f4b --- /dev/null +++ b/src/system/system.vcxproj @@ -0,0 +1,158 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {E3FD8E6B-8056-4579-8DE5-A2F0458D896A} + Win32Proj + + + + StaticLibrary + true + v141 + + + StaticLibrary + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + + WITHTEST;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + $(ProjectDir)..;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Windows + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + $(ProjectDir)..;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/system/system.vcxproj.filters b/src/system/system.vcxproj.filters new file mode 100644 index 00000000..149465bb --- /dev/null +++ b/src/system/system.vcxproj.filters @@ -0,0 +1,168 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/system/task.h b/src/system/task.h index d94841a8..f3fcace6 100644 --- a/src/system/task.h +++ b/src/system/task.h @@ -36,7 +36,7 @@ * */ -#include "system/thread.h" +#include "thread.h" /** * @brief Abstract base class encapsulating a system thread. diff --git a/src/system/task_amiga.cpp b/src/system/task_amiga.cpp index 5afa4ec9..dcf7f6dd 100644 --- a/src/system/task_amiga.cpp +++ b/src/system/task_amiga.cpp @@ -29,8 +29,8 @@ #include "amath.h" #include "amathc.h" -#include "system/thread.h" -#include "system/task_amiga.h" +#include "thread.h" +#include "task_amiga.h" #ifdef AMIGA #include diff --git a/src/system/task_amiga.h b/src/system/task_amiga.h index fcc6a713..682034c3 100644 --- a/src/system/task_amiga.h +++ b/src/system/task_amiga.h @@ -38,8 +38,8 @@ #include "amath.h" #include "amathc.h" -#include "system/task.h" -#include "system/thread.h" +#include "task.h" +#include "thread.h" #ifdef AMIGA #include diff --git a/src/system/task_stdc.cpp b/src/system/task_stdc.cpp index 3276afd7..0845fe3b 100644 --- a/src/system/task_stdc.cpp +++ b/src/system/task_stdc.cpp @@ -29,8 +29,8 @@ #include "amath.h" #include "amathc.h" -#include "system/thread.h" -#include "system/task_stdc.h" +#include "thread.h" +#include "task_stdc.h" #if defined(UNIX) || defined(HAIKU) #include diff --git a/src/system/task_stdc.h b/src/system/task_stdc.h index d5207d46..a025222e 100644 --- a/src/system/task_stdc.h +++ b/src/system/task_stdc.h @@ -31,7 +31,7 @@ #define AMATH_STANDARD_TASK /** - * @file ctask.h + * @file task_stdc.h * @brief CLib compliant thread handling. * */ @@ -40,8 +40,8 @@ #include "amathc.h" #ifndef AMIGA -#include "system/task.h" -#include "system/thread.h" +#include "task.h" +#include "thread.h" /** * @brief Encapsulates calls to POSIX task. diff --git a/src/system/window_amiga.cpp b/src/system/window_amiga.cpp index 41a4b30e..fcd01bcb 100644 --- a/src/system/window_amiga.cpp +++ b/src/system/window_amiga.cpp @@ -29,9 +29,9 @@ #include "amath.h" #include "amathc.h" +#include "window_amiga.h" #include "lib/aengine.h" #include "main/evaluator.h" -#include "system/window_amiga.h" #ifdef AMIGA #include diff --git a/src/system/window_amiga.h b/src/system/window_amiga.h index d01744d9..5442c165 100644 --- a/src/system/window_amiga.h +++ b/src/system/window_amiga.h @@ -39,8 +39,8 @@ #include "amath.h" #include "amathc.h" +#include "console.h" #include "lib/aengine.h" -#include "system/console.h" #ifdef AMIGA #include diff --git a/text/help.cd b/text/help.cd index 2777367b..c4656c46 100644 --- a/text/help.cd +++ b/text/help.cd @@ -5,7 +5,7 @@ ; ## ---------------------------------- ; ## ; ## Generate code with: -; ## flexcat help.cd ../../src/localize/help.h=help.sd +; ## flexcat help.cd ../src/localize/help.h=help.sd ; ## ; ################################################################################### ; ## Copyright (c) 2014-2017 Carsten Sonne Larsen @@ -32,102 +32,111 @@ ; ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; ## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ################################################################################### +; message ID (ID number/min. string length/max. string length) +; native string +; ################################################################################### ; Introduction table - Symbol(0) symzero (/500/) -Enter command or expression to evaluate.#NEWLINE##SYNTAXHIGHLIGHT#Example: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#More help is available for designated topics.#NEWLINE#-------------------------------------------------#NEWLINE#functions Base functions.#NEWLINE#trigon Trigonometric functions.#NEWLINE#hyper Hyperbolic functions.#NEWLINE#complex Syntax for complex numbers.#NEWLINE#statements Available statements.#NEWLINE#operators Supported operators.#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: help trigon#NEWLINE# +Enter command or expression to evaluate.#NEWLINE##SYNTAXHIGHLIGHT#Example: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#More help is available for designated topics.#NEWLINE#-------------------------------------------------#NEWLINE#functions Base functions.#NEWLINE#trigon Trigonometric functions.#NEWLINE#hyper Hyperbolic functions.#NEWLINE#early Early trigonometric functions.#NEWLINE#complex Syntax for complex numbers.#NEWLINE#statements Available statements.#NEWLINE#operators Supported operators.#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: help trigon#NEWLINE# ; Table of operators symoperator (/400/) --------------------------------------------------#NEWLINE# + Mathematical addition.#NEWLINE# - Mathematical subtraction.#NEWLINE# * Mathematical multiplication.#NEWLINE# / Mathematical division.#NEWLINE# ^ Mathematical exponentiation.#NEWLINE# = Assignment of variable values.#NEWLINE# | Absolute value of number. #NEWLINE#-------------------------------------------------#NEWLINE# +-------------------------------------------------#NEWLINE# + Mathematical addition.#NEWLINE# - Mathematical subtraction.#NEWLINE# * Mathematical multiplication.#NEWLINE# / Mathematical division.#NEWLINE# ^ Mathematical exponentiation.#NEWLINE# = Assignment of variable values.#NEWLINE# | Absolute value of number. #NEWLINE#-------------------------------------------------#NEWLINE# ; Table of functions symfunction (/500/) -------------------------------------------------#NEWLINE#abs Absolute value of number.#NEWLINE#sgn Mathematical signum function.#NEWLINE#round Round to nearest integer number.#NEWLINE#trunc Discard fraction part of number.#NEWLINE#floor Mathematical floor function.#NEWLINE#ceil Mathematical ceiling function.#NEWLINE#sqrt Square root function (exp 1/2).#NEWLINE#cbrt Cube root function (exp 1/3).#NEWLINE#lb Binary logarithm function (base 2).#NEWLINE#ln Natural logarithm function (base e).#NEWLINE#lg Common logarithm function (base 10).#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: round(1.55)#NORMALTEXT##NEWLINE# ; Table of trigonometric functions symtrigon (/500/) --------------------------------------------------#NEWLINE#sin Trigonometric sine function.#NEWLINE#cos Trigonometric cosine function.#NEWLINE#tan Trigonometric tangent function.#NEWLINE#cot Trigonometric cotangent function.#NEWLINE#sec Trigonometric secant function.#NEWLINE#csc Trigonometric cosecant function.#NEWLINE#asin Inverse trigonometric sine function.#NEWLINE#acos Inverse trigonometric cosine function.#NEWLINE#atan Inverse trigonometric tangent function.#NEWLINE#acot Inverse trigonometric cotangent function.#NEWLINE#asec Inverse trigonometric secant function.#NEWLINE#acsc Inverse trigonometric cosecant function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE# +-------------------------------------------------#NEWLINE#sin Trigonometric sine function.#NEWLINE#cos Trigonometric cosine function.#NEWLINE#tan Trigonometric tangent function.#NEWLINE#cot Trigonometric cotangent function.#NEWLINE#sec Trigonometric secant function.#NEWLINE#csc Trigonometric cosecant function.#NEWLINE#exsec Trigonometric exsecant function.#NEWLINE#excsc Trigonometric excosecant function.#NEWLINE#asin Inverse trigonometric sine function.#NEWLINE#acos Inverse trigonometric cosine function.#NEWLINE#atan Inverse trigonometric tangent function.#NEWLINE#acot Inverse trigonometric cotangent function.#NEWLINE#asec Inverse trigonometric secant function.#NEWLINE#acsc Inverse trigonometric cosecant function.#NEWLINE#exsec Inverse trigonometric exsecant function.#NEWLINE#excsc Inverse trigonometric excosecant function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE# ; Table of hyperbolic functions symhyper (/500/) -------------------------------------------------#NEWLINE#sinh Hyperbolic sine function.#NEWLINE#cosh Hyperbolic cosine function.#NEWLINE#tanh Hyperbolic tangent function.#NEWLINE#coth Hyperbolic cotangent function.#NEWLINE#sech Hyperbolic secant function.#NEWLINE#csch Hyperbolic cosecant function. #NEWLINE#asinh Inverse hyperbolic sine function.#NEWLINE#acosh Inverse hyperbolic cosine function.#NEWLINE#atanh Inverse hyperbolic tangent function.#NEWLINE#acoth Inverse hyperbolic cotangent function.#NEWLINE#asech Inverse hyperbolic secant function.#NEWLINE#acsch Inverse hyperbolic cosecant function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE# -; Table of statements -symstatement (/1000/) ----------------------------------------------------------#NEWLINE#clear Clear console window.#NEWLINE#def Define function.#NEWLINE#delete Delete variable or function.#NEWLINE#digits Set number of significant digits.#NEWLINE#eval Evaluate arithmetic expression.#NEWLINE#execute Execute statements in a file.#NEWLINE#functions Show list of user defined functions.#NEWLINE#input Change numeral input system (experimental).#NEWLINE#help Show basic help text.#NEWLINE#output Change numeral output system (experimental).#NEWLINE#list Show content of a directory.#NEWLINE#show Show content of a file.#NEWLINE#load Load variable and functions from file.#NEWLINE#save Save variable and functions to file.#NEWLINE#variables Show list of variables.#NEWLINE#version Show version string.#NEWLINE#memory Show internal memory usage.#NEWLINE#exit Exit program.#NEWLINE#---------------------------------------------------------#NEWLINE#The def and eval statements are optional. Functions and#NEWLINE#variables statements can be shorten to funcs and vars.#NEWLINE# +; Table of early trigonometric functions +symearly (/500/) +-------------------------------------------------#NEWLINE#ver Versed sine function.#NEWLINE#vcs Versed cosine function.#NEWLINE#cvs Coversed sine function.#NEWLINE#cvc Coversed cosine function.#NEWLINE#hv Haversed sine function.#NEWLINE#hvc Haversed cosine function.#NEWLINE#hcv Hacoversed sine function.#NEWLINE#hcc Hacoversed cosine function.#NEWLINE#aver Inverse versed sine function.#NEWLINE#avcs Inverse versed cosine function.#NEWLINE#acvs Inverse coversed sine function.#NEWLINE#acvc Inverse coversed cosine function.#NEWLINE#ahv Inverse haversed sine function.#NEWLINE#ahvc Inverse haversed cosine function.#NEWLINE#ahcv Inverse hacoversed sine function.#NEWLINE#ahcc Inverse hacoversed cosine function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE# ; Help for complex numbers -symcomplex (/200/) +symcomplex (/20/) Expressions with complex numbers are written using an i to denote#NEWLINE#the imaginary value. Complex numbers can seamlessly be mixed with#NEWLINE#real numbers.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: 2+3i#NEWLINE#Example: 2+3.2i*cos(-1i)+5/7#NEWLINE# ; Help for clear statement -symclear (/40/) +symclear (/20/) The clear statement erases all text in the console window.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: clear#NEWLINE# ; Help for def statement -symdef (/200/) +symdef (/20/) The def statement is used to define functions. When defining a function#NEWLINE#it is possible to omit the def keyword. Defined functions can be shown#NEWLINE#using the functions statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: def f(x)=2*x+3#NEWLINE#Optional syntax: f(x)=2*x+3#NEWLINE# ; Help for delete statement -symdelete (/250/) +symdelete (/20/) The delete statement can delete variable and functions. To delete a#NEWLINE#single variable or functions use the name of the function or variable.#NEWLINE#To delete all functions or variables specify either the variable or#NEWLINE#function keyword.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: delete f(x)#NEWLINE#Syntax: delete variables#NEWLINE# ; Help for digits statement -symdigits (/150/) +symdigits (/20/) The digits statement defines the displayed number of significant digits.#NEWLINE#To show current configuration use the digits statement without specifying#NEWLINE#the number.#NEWLINE# #SYNTAXHIGHLIGHT#Syntax: digits 7#NEWLINE# ; Help for eval statement -symeval (/80/) +symeval (/20/) The eval statement evaluates an expression. When evaluating an expression#NEWLINE#it is possible to omit the eval keyword.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: eval 2.4*x+3.2#NEWLINE#Optional syntax: 2.4*x+3.2#NEWLINE# ; Help for execute statement -symexecute (/40/) +symexecute (/20/) The execute statement reads the content of a file and execute all statements.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: execute "savedfile"#NEWLINE# ; Help for input statement -syminput (/120/) +syminput (/20/) The input statement either changes or shows the how numeral input is interpreted.#NEWLINE#Possible input systems are: binary, octal, decimal and hexadecimal. Default is#NEWLINE#decimal. To use positional systems with other bases specify the base number.#NEWLINE#Numeral output system can be modified using the output statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: input hexadecimal#NEWLINE#Syntax: input 4#NEWLINE# ; Help for help statement -symhelp (/50/) +symhelp (/20/) The help statement can be used to display help about topics and statements.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: help variables#NEWLINE# ; Help for output statement -symoutput (/120/) +symoutput (/20/) The output statement either changes or shows the how numeral output is shown.#NEWLINE#Possible output systems are: binary, octal, decimal and hexadecimal. Default#NEWLINE#is decimal. To use positional systems with other bases specify the base number.#NEWLINE#Numeral input system can be modified using the input statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: output octal#NEWLINE# ; Help for list statement -symlist (/40/) +symlist (/20/) No description is available for the list statement.#NEWLINE# ; Help for show statement -symshow (/40/) +symshow (/20/) The show statement displays the content of a file.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: show "filetosee"#NEWLINE# ; Help for load statement -symload (/80/) +symload (/20/) The load statement retrieves a set of defined variables and functions from#NEWLINE#a file. Variables and functions can be saved using the save statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: load "savedwork"#NEWLINE# ; Help for save statement -symsave (/80/) +symsave (/20/) The save statement saves defined variables and functions to a file in a#NEWLINE#plain text format. Saved variables and functions can be retrieved using#NEWLINE#the load statement.#NEWLINE# #SYNTAXHIGHLIGHT#Syntax: save "worktokeep"#NEWLINE# ; Help for version statement -symversion (/40/) +symversion (/20/) Show which version of amath is running.#NEWLINE# +; Help for about statement +symabout (/40/) +Show various information about the running version of amath.#NEWLINE# +; Help for license statement +symlicense (/20/) +Show license details.#NEWLINE# ; Help for memory statement -symmem (/40/) +symmem (/20/) Show internal memory usage together with maximum usage.#NEWLINE# ; Help for prefs statement -symprefs (/40/) +symprefs (/20/) There is no help for prefs statement now.#NEWLINE# ; Help for variable statement -symvariable (/40/) +symvariable (/20/) The variable statement shows a list of variables in memory.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: variables#NEWLINE##NORMALTEXT#optional syntax: vars#NEWLINE# ; Help for exit statement -symexit (/40/) +symexit (/20/) The exit statement shuts down amath.#NEWLINE##SYNTAXHIGHLIGHT#Syntax: exit#NEWLINE# ; Help for constant epsilon -syme (/40/) +syme (/20/) Euler's number is base of the exponential function which equals its own#NEWLINE#derivative. It is approximately equal to 2.71828.#NEWLINE##SYNTAXHIGHLIGHT#Example: ln(e)#NEWLINE# ; Help for constant pi -sympi (/40/) +sympi (/20/) Pi is the ratio of the circumference of a circle to its diameter. Being an#NEWLINE#irrational number, pi cannot be expressed exactly as a common fraction.#NEWLINE#The value of pi is commonly approximated as #SYNTAXHIGHLIGHT#3.14159#NORMALTEXT#.#NEWLINE# ; Help for imaginary unit -symi (/40/) +symi (/20/) The imaginary unit is denoted and commonly referred to as i.#NEWLINE#The imaginary unit is a number, which when multiplied#NEWLINE#by itself gives -1.#NEWLINE# ; Help for ins variable -symins (/40/) +symins (/20/) No help is available for the ins variable#NEWLINE# ; Help for binary keyword -symbin (/40/) +symbin (/20/) No help is available for the binary keyword#NEWLINE ; Help for octal keyword -symoct (/40/) +symoct (/20/) No help is available for the octal keyword#NEWLINE ; Help for decimal keyword -symdec (/40/) +symdec (/20/) No help is available for the decimal keyword#NEWLINE ; Help for hexadecimal keyword -symhex (/40/) +symhex (/20/) No help is available for the hexadecimal keyword#NEWLINE \ No newline at end of file diff --git a/text/help.sd b/text/help.sd index 28560dc5..4ca75d7b 100644 --- a/text/help.sd +++ b/text/help.sd @@ -1,5 +1,5 @@ ##stringtype C -/* +/*- * Copyright (c) 2014-2017 Carsten Sonne Larsen * All rights reserved. * @@ -26,27 +26,32 @@ * Generated with FlexCat. For more information, see: * http://sourceforge.net/projects/flexcat/ * + * Project homepage: + * http://amath.innolan.net + * */ #ifndef AMATH_LOCALIZE_HELP_H #define AMATH_LOCALIZE_HELP_H /** - * @file help.h + * @file localize/help.h * @brief Help texts for statement. - * + * */ #include "amath.h" -#include "platform.h" +#include "amathc.h" +#include "amatht.h" #include "localize/lex.h" #define symzero Symbol(0) -struct helptextdef { +struct helptextdef +{ int id; Symbol symbol; - const char *text; + const char* text; }; static const helptextdef helptexts[] = { diff --git a/text/ident.cd b/text/ident.cd index 88979a63..583de577 100644 --- a/text/ident.cd +++ b/text/ident.cd @@ -5,7 +5,7 @@ ; ## ------------------------------------------ ; ## ; ## Generate code with: -; ## flexcat ident.cd ../../src/localize/ident.h=ident.sd +; ## flexcat ident.cd ../src/localize/ident.h=ident.sd ; ## ; ################################################################################### ; ## Copyright (c) 2014-2017 Carsten Sonne Larsen @@ -32,73 +32,116 @@ ; ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; ## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ################################################################################### -abs (/40/) +; message ID (ID number/min. string length/max. string length) +; native string +; ################################################################################### +abs (/20/) No help is available for this function.#NEWLINE# -sgn (/40/) +sgn (/20/) No help is available for this function.#NEWLINE# -round (/40/) +round (/20/) No help is available for this function.#NEWLINE# -trunc (/10/) +trunc (/20/) No help is available for this function.#NEWLINE# -floor (/10/) +floor (/20/) No help is available for this function.#NEWLINE# -ceil (/10/) +ceil (/20/) No help is available for this function.#NEWLINE# -sqr (/10/) +sqr (/20/) No help is available for this function.#NEWLINE# -cbr (/10/) +cbr (/20/) No help is available for this function.#NEWLINE# -lb (/10/) +lb (/20/) No help is available for this function.#NEWLINE# -ln (/10/) +ln (/20/) No help is available for this function.#NEWLINE# -lg (/10/) +lg (/20/) No help is available for this function.#NEWLINE# -sin (/10/) +sin (/20/) No help is available for this function.#NEWLINE# -cos (/10/) +cos (/20/) No help is available for this function.#NEWLINE# -tan (/10/) +tan (/20/) No help is available for this function.#NEWLINE# -cot (/10/) +cot (/20/) No help is available for this function.#NEWLINE# -sec (/10/) +sec (/20/) No help is available for this function.#NEWLINE# -csc (/10/) +csc (/20/) No help is available for this function.#NEWLINE# -asin (/10/) +asin (/20/) No help is available for this function.#NEWLINE# -acos (/10/) +acos (/20/) No help is available for this function.#NEWLINE# -atan (/10/) +atan (/20/) No help is available for this function.#NEWLINE# -acot (/10/) +acot (/20/) No help is available for this function.#NEWLINE# -asec (/10/) +asec (/20/) No help is available for this function.#NEWLINE# -acsc (/10/) +acsc (/20/) No help is available for this function.#NEWLINE# -sinh (/10/) +sinh (/20/) No help is available for this function.#NEWLINE# -cosh (/10/) +cosh (/20/) No help is available for this function.#NEWLINE# -tanh (/10/) +tanh (/20/) No help is available for this function.#NEWLINE# -coth (/10/) +coth (/20/) No help is available for this function.#NEWLINE# -sech (/10/) +sech (/20/) No help is available for this function.#NEWLINE# -csch (/10/) +csch (/20/) No help is available for this function.#NEWLINE# -asinh (/10/) +asinh (/20/) No help is available for this function.#NEWLINE# -acosh (/10/) +acosh (/20/) No help is available for this function.#NEWLINE# -atanh (/10/) +atanh (/20/) No help is available for this function.#NEWLINE# -acoth (/10/) +acoth (/20/) No help is available for this function.#NEWLINE# -asech (/10/) +asech (/20/) No help is available for this function.#NEWLINE# -acsch (/10/) +acsch (/20/) No help is available for this function.#NEWLINE# +ver (/20/) +The versed sine is an early appearing trigonometric function.#NEWLINE#It is equal to one minus the cosine.#NEWLINE#ver(x) = 1 - cos(x)#NEWLINE# +vcs (/20/) +The versed cosine is an early appearing trigonometric function.#NEWLINE#It is equal to one plus the cosine.#NEWLINE#ver(x) = 1 + cos(x)#NEWLINE# +cvs (/20/) +The coversed sine is an early appearing trigonometric function.#NEWLINE#It is equal to one minus the sine.#NEWLINE#ver(x) = 1 - sin(x)#NEWLINE# +cvc (/20/) +The coversed cosine is an early appearing trigonometric function.#NEWLINE#It is equal to one plus the sine.#NEWLINE#cvc(x) = 1 + sin(x)#NEWLINE# +hv (/20/) +No help is available for the haversed sine function.#NEWLINE# +hvc (/20/) +No help is available for the haversed cosine function.#NEWLINE# +hcv (/20/) +No help is available for the hacoversed sine function.#NEWLINE# +hcc (/20/) +No help is available for the hacoversed cosine function.#NEWLINE# +aver (/20/) +No help is available for this function.#NEWLINE# +avcs (/20/) +No help is available for this function.#NEWLINE# +acvs (/20/) +No help is available for this function.#NEWLINE# +acvc (/20/) +No help is available for this function.#NEWLINE# +ahv (/20/) +No help is available for this function.#NEWLINE# +ahvc (/20/) +No help is available for this function.#NEWLINE# +ahcv (/20/) +The inverse hacoversed sine is not implemented in this version of amath.#NEWLINE# +ahcc (/20/) +The inverse hacoversed cosine is not implemented in this version of amath.#NEWLINE# +exsec (/20/) +No help is available for the exsecant function.#NEWLINE# +excsc (/20/) +No help is available for the excosecant function.#NEWLINE# +aexsec (/20/) +No help is available for the inverse exsecant function.#NEWLINE# +aexcsc (/20/) +No help is available for the inverse excosecant function.#NEWLINE# \ No newline at end of file diff --git a/text/ident.sd b/text/ident.sd index 52b888b0..4fa555c0 100644 --- a/text/ident.sd +++ b/text/ident.sd @@ -1,5 +1,5 @@ ##stringtype C -/* +/*- * Copyright (c) 2014-2017 Carsten Sonne Larsen * All rights reserved. * @@ -26,25 +26,23 @@ * Generated with FlexCat. For more information, see: * http://sourceforge.net/projects/flexcat/ * + * Project homepage: + * http://amath.innolan.net + * */ #ifndef AMATH_LOCALIZE_IDENT_H #define AMATH_LOCALIZE_IDENT_H /** - * @file ident.h + * @file localize/ident.h * @brief Help texts for built-in functions. - * + * */ #include "amath.h" -#include "platform.h" - -struct identhelpdef { - int id; - const char *ident; - const char *text; -}; +#include "amathc.h" +#include "amatht.h" static const identhelpdef identtexts[] = { { %d, "%i", %s }, diff --git a/text/keyword.cd b/text/keyword.cd index 7a524c8a..c3d4aa93 100644 --- a/text/keyword.cd +++ b/text/keyword.cd @@ -5,7 +5,7 @@ ; ## ------------------------------- ; ## ; ## Generate code with: -; ## flexcat kword.cd ../../src/localize/kword.h=kword.sd +; ## flexcat keyword.cd ../src/localize/kword.h=keyword.sd ; ## ; ################################################################################### ; ## Copyright (c) 2014-2017 Carsten Sonne Larsen @@ -95,6 +95,9 @@ hyper (//) symhyper hyperbolic (//) symhyper +;######### Early keyword +early (//) +symearly ;######### HelpStatement help (//) symhelp diff --git a/text/keyword.sd b/text/keyword.sd index 2bebea10..ecaff948 100644 --- a/text/keyword.sd +++ b/text/keyword.sd @@ -1,5 +1,5 @@ ##stringtype none -/* +/*- * Copyright (c) 2014-2017 Carsten Sonne Larsen * All rights reserved. * @@ -26,29 +26,33 @@ * Generated with FlexCat. For more information, see: * http://sourceforge.net/projects/flexcat/ * + * Project homepage: + * http://amath.innolan.net + * */ #ifndef AMATH_LOCALIZE_KEYWORD_H #define AMATH_LOCALIZE_KEYWORD_H /** - * @file kword.h + * @file localize/kword.h * @brief Keywords used by lexer. * */ #include "amath.h" -#include "platform.h" +#include "amathc.h" #include "localize/lex.h" /** * @brief Character representation of keyword tied with its symbol. * */ -struct keyworddef { +struct keyworddef +{ int id; Symbol symbol; - const char *name; + const char* name; }; static const keyworddef keywords[] = { diff --git a/text/text.cd b/text/text.cd index 570e62fd..2682a6d9 100644 --- a/text/text.cd +++ b/text/text.cd @@ -5,7 +5,7 @@ ; ## --------------------- ; ## ; ## Generate code with: -; ## flexcat text.cd ../../src/localize/text.h=text.sd +; ## flexcat text.cd ../src/localize/text.h=text.sd ; ## ; ################################################################################### ; ## Copyright (c) 2014-2017 Carsten Sonne Larsen @@ -34,6 +34,46 @@ ; ################################################################################### INTROMSG (/4/) #NORMALTEXT##BOLD##STARTMSG##NEWLINE##NORMALTEXT##COLOR02#Type help to show info.#NEWLINE# +STATEMENTLINE (/4/) +---------------------------------------------------------#NEWLINE# +STATEMENTCLEAR (/4/) +clear Clear console window.#NEWLINE# +STATEMENTDEF (/4/) +def Define function.#NEWLINE# +STATEMENTDELETE (/4/) +delete Delete variable or function.#NEWLINE# +STATEMENTDIGITS (/4/) +digits Set number of significant digits.#NEWLINE# +STATEMENTEVAL (/4/) +eval Evaluate arithmetic expression.#NEWLINE# +STATEMENTEXECUTE (/4/) +execute Execute statements in a file.#NEWLINE# +STATEMENTFUNCS (/4/) +functions Show list of user defined functions.#NEWLINE# +STATEMENTINPUT (/4/) +input Change numeral input system.#NEWLINE# +STATEMENTHELP (/4/) +help Show basic help text.#NEWLINE# +STATEMENTOUTPUT (/4/) +output Change numeral output system.#NEWLINE# +STATEMENTLIST (/4/) +list Show content of a directory.#NEWLINE# +STATEMENTSHOW (/4/) +show Show content of a file.#NEWLINE# +STATEMENTLOAD (/4/) +load Load variable and functions from file.#NEWLINE# +STATEMENTSAVE (/4/) +save Save variable and functions to file.#NEWLINE# +STATEMENTVARS (/4/) +variables Show list of variables.#NEWLINE# +STATEMENTVERSION (/4/) +version Show version string.#NEWLINE# +STATEMENTMEMORY (/4/) +memory Show internal memory usage.#NEWLINE# +STATEMENTEXIT (/4/) +exit Exit program.#NEWLINE# +STATEMENTFOOTER (/4/) +The def and eval statements are optional. Functions and#NEWLINE#variables statements can be shorten to funcs and vars.#NEWLINE# TXTLISTDIRHEADER (/4/) Type Name#NEWLINE#-----------------------------------------------#NEWLINE# TXTLISTDIRTFILE (/4/) diff --git a/text/text.sd b/text/text.sd index a5fd9345..41fce094 100644 --- a/text/text.sd +++ b/text/text.sd @@ -1,5 +1,5 @@ ##stringtype C -/* +/*- * Copyright (c) 2014-2017 Carsten Sonne Larsen * All rights reserved. * @@ -26,26 +26,27 @@ * Generated with FlexCat. For more information, see: * http://sourceforge.net/projects/flexcat/ * + * Project homepage: + * http://amath.innolan.net + * */ #ifndef AMATH_LOCALIZE_TEXT_H #define AMATH_LOCALIZE_TEXT_H /** - * @file text.h + * @file localize/text.h * @brief Static texts in amath. - * + * */ +#include "main.h" #include "amath.h" -#include "platform.h" +#include "amathc.h" +#include "amatht.h" +#include "system/program.h" -#define %i Program->Language->GetText(%d) - -struct textdef { - int id; - const char *text; -}; +#define %i (Program->Language->GetText(%d)) static const textdef textdefs[] = { { %d, %s }, /* %i */ diff --git a/utext/dk-help.dict b/utext/dk-help.dict deleted file mode 100644 index 9052fadd..00000000 --- a/utext/dk-help.dict +++ /dev/null @@ -1,111 +0,0 @@ -## version $VER: amath-help.catalog 1.60 (09.04.2015) Danish -## language dansk -## codeset 0 -; ############################################################################# -; Copyright (c) 2014-2017 Carsten Sonne Larsen -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; -; * Redistributions of source code must retain the above copyright notice, this -; list of conditions and the following disclaimer. -; -; * Redistributions in binary form must reproduce the above copyright notice, -; this list of conditions and the following disclaimer in the documentation -; and/or other materials provided with the distribution. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -; ############################################################################# -; ### flexcat catalog/help.cd NEWCTFILE catalog/danish/amath-help.ct -; flexcat catalog/help.cd catalog/danish/amath-help.ct CATALOG catalog/danish/amath-help.catalog -; ############################################################################# -symzero -Indtast kommando eller udtryk.#NEWLINE##SYNTAXHIGHLIGHT#Eksempel: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#Mere hj�lp er tilg�ngelig i udvalgte omr�der#NEWLINE#-------------------------------------------------#NEWLINE#funktioner Grundl�ggende funktioner.#NEWLINE#trigo Trigonometriske funktioner.#NEWLINE#hyper Hyperbolske funktioner.#NEWLINE#kompleks Komplekse tal.#NEWLINE#kommandoer Underst�ttede kommondoer.#NEWLINE#operatorer Underst�ttede operatorer.#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Eksemple: hj�lp trigo#NEWLINE# -symoperator --------------------------------------------------#NEWLINE# + Matematik addition.#NEWLINE# - Matematik subtraktion.#NEWLINE# * Matematik multiplikation.#NEWLINE# / Matematik division.#NEWLINE# ^ Matematik potensopl�ftning.#NEWLINE# = Tildeling af variabel v�rdi.#NEWLINE# | Absolutte eller numerisk v�rdi.#NEWLINE#-------------------------------------------------#NEWLINE# -symfunction --------------------------------------------------#NEWLINE#abs Absolutte eller numerisk v�rdi.#NEWLINE#sgn Matematik signum funktion.#NEWLINE#round Afrund til n�rmeste heltal.#NEWLINE#trunc Fjern decimaler.#NEWLINE#floor Afrund i positiv retning.#NEWLINE#ceil Afrund i negativ retning.#NEWLINE#sqrt Kvadratrodsfunktion (exponent 1/2).#NEWLINE#cbrt Kubikrods (exponent 1/3).#NEWLINE#lb Bin�r logaritme funktion (grundtal 2).#NEWLINE#ln Naturlig logaritme funktion (grundtal e).#NEWLINE#lg 10-talslogaritme funktion (grundtal 10).#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Eksempel: round(1.55)#NORMALTEXT##NEWLINE# -symtrigon --------------------------------------------------#NEWLINE#sin Trigonometrisk sinus funktion.#NEWLINE#cos Trigonometrisk cosinus funktion.#NEWLINE#tan Trigonometrisk tangent funktion.#NEWLINE#cot Trigonometrisk cotangent funktion.#NEWLINE#sec Trigonometrisk secant funktion.#NEWLINE#csc Trigonometrisk cosecant funktion.#NEWLINE#asin Invers trigonometrisk sinus funktion.#NEWLINE#acos Invers trigonometrisk cosinus funktion.#NEWLINE#atan Invers trigonometrisk tangent funktion.#NEWLINE#acot Invers trigonometrisk cotangent funktion.#NEWLINE#asec Invers trigonometrisk secant funktion.#NEWLINE#acsc Invers trigonometrisk cosecant funktion.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse funktioner kan prefixes med ar eller arc #NEWLINE#i stedet for a.#NEWLINE# -symhyper --------------------------------------------------#NEWLINE#sinh Hyperbolsk sinus funktion.#NEWLINE#cosh Hyperbolsk cosinus funktion.#NEWLINE#tanh Hyperbolsk tangent funktion.#NEWLINE#coth Hyperbolsk cotangent funktion.#NEWLINE#sech Hyperbolsk secant funktion.#NEWLINE#csch Hyperbolsk cosecant funktion. #NEWLINE#asinh Invers hyperbolsk sinus funktion.#NEWLINE#acosh Invers hyperbolsk cosinus funktion.#NEWLINE#atanh Invers hyperbolsk tangent funktion.#NEWLINE#acoth Invers hyperbolsk cotangent funktion.#NEWLINE#asech Invers hyperbolsk secant funktion.#NEWLINE#acsch Invers hyperbolsk cosecant funktion.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse funktioner kan prefixes med ar eller arc #NEWLINE#i stedet for a.#NEWLINE# -; Table of statements -symstatement -----------------------------------------------------------------------#NEWLINE#ryd Ryd konsol vindue.#NEWLINE#definer Definer funktion.#NEWLINE#slet Slet variabler og funktioner.#NEWLINE#cifre Angiv antal betydende cifre.#NEWLINE#beregn Beregn aritmetiske udtryk.#NEWLINE#k�r Afvikel kommondoer i en fil.#NEWLINE#funktioner Vis liste med brugerdefinerede funktioner.#NEWLINE#ind Skift numerisk talsystem ved l�sning (eksperimentelt).#NEWLINE#hj�lp Vis grundl�ggende hj�lpetekst.#NEWLINE#ud Skift numerisk talsystem ved skrivning (eksperimentelt).#NEWLINE#list Vis indholdet af en mappe.#NEWLINE#vis Vis indholdet af en fil.#NEWLINE#hent Hent variabler og funktioner fra en fil.#NEWLINE#gem Gem variabler og funktioner til en fil.#NEWLINE#variabler Vis variabler i hukommelsen.#NEWLINE#version Vis infomation om denne version.#NEWLINE#hukommelse Vis internt hukommelsesforbrug.#NEWLINE#afslut Afslut program.#NEWLINE#----------------------------------------------------------------------#NEWLINE#Det er valgfrit at angive definer og beregn kommandoerne. Kommandoerne#NEWLINE#funktioner og variabler kan forkortes til funk og var.#NEWLINE# -symcomplex -Udtryk med komplekse tal skrives ved at angive i#NEWLINE#sammen med den imagin�re talv�rdi. Komplekse tal#NEWLINE#kan blandes med reelle tal.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: 2+3i#NEWLINE#Eksempel: 2+3.2i*cos(-1i)+5/7#NEWLINE# -symclear -Ryd kommandoen sletter alt tekst i konsol vinduet.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: ryd#NEWLINE# -symdef -Definer kommandoen bruges til at definere funktioner med. Det er ikke#NEWLINE#strengt n�dvendigt at angive kommandoen, n�r en funktion skal defineres.#NEWLINE#Allerede definerede funktioner kan vises med kommandoen #SYNTAXHIGHLIGHT#funtioner#NORMAL#.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: definer f(x)=2*x+3#NEWLINE#Alternativ syntaks: f(x)=2*x+3#NEWLINE# -; Help for delete statement -symdelete -The delete statement can delete variable and funktions. To delete a#NEWLINE#single variable or funktions use the name of the funktion or variable.#NEWLINE#To delete all funktions or variables specify either the variable or#NEWLINE#funktion keyword.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: delete f(x)#NEWLINE#Syntaks: delete variables#NEWLINE# -; Help for digits statement -symdigits -The digits statement defines the displayed number of significant digits.#NEWLINE#To show current configuration use the digits statement without specifying#NEWLINE#the number.#NEWLINE# #SYNTAXHIGHLIGHT#Syntaks: digits 7#NEWLINE# -; Help for eval statement -symeval -The eval statement evaluates an expression. When evaluating an expression#NEWLINE#it is possible to omit the eval keyword.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: eval 2.4*x+3.2#NEWLINE#Optional syntax: 2.4*x+3.2#NEWLINE# -; Help for execute statement -symexecute -The execute statement reads the content of a file and execute all statements.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: execute "savedfile"#NEWLINE# -; Help for input statement -syminput -The input statement either changes or shows the how numeral input is interpreted.#NEWLINE#Possible input systems are: binary, octal, decimal and hexadecimal. Default is#NEWLINE#decimal. To use positional systems with other bases specify the base number.#NEWLINE#Numeral output system can be modified using the output statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: input hexadecimal#NEWLINE#Syntaks: input 4#NEWLINE# -; Help for help statement -symhelp -The help statement can be used to display help about topics and statements.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: help variables#NEWLINE# -; Help for output statement -symoutput -The output statement either changes or shows the how numeral output is shown.#NEWLINE#Possible output systems are: binary, octal, decimal and hexadecimal. Default#NEWLINE#is decimal. To use positional systems with other bases specify the base number.#NEWLINE#Numeral input system can be modified using the input statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: output octal#NEWLINE# -; Help for list statement -symlist -No description is available for the list statement.#NEWLINE# -symshow -Vis kommandoen kan bruges til at vise indholdet af en fil, der �nskes k�rt.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: vis "mitscript"#NEWLINE# -; Help for load statement -symload -The load statement retrieves a set of defined variables and funktions from#NEWLINE#a file. Variables and funktions can be saved using the save statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: load "savedwork"#NEWLINE# -; Help for save statement -symsave -Med gem kommando kan variabler og funktioner i hukommelsen gemmes til en fil.#NEWLINE#Gemte variabler og funktion kan indl�stet igen med #SYNTAXHIGHLIGHT#hent#NORMAL# kommandoen.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: gem "mitarbejde"#NEWLINE# -symversion -Viser hvilken version af amath der k�rer.#NEWLINE# -symmem -Viser internt hukommelsesforbrug. Programkoden er ikke medregnet.#NEWLINE# -; Help for prefs statement -symprefs -There is no help for prefs statement now.#NEWLINE# -symvariable -Variabler kommandoen viser en list af definerede variabler i hukommelsen.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: variabler#NEWLINE#Alternativ syntaks: var#NEWLINE# -symexit -Afslut kommandoen lukker amath programmet.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: afslut#NEWLINE# -; Help for constant epsilon -syme -Euler's number is base of the exponential funktion which equals its own#NEWLINE#derivative. It is approximately equal to 2.71828.#NEWLINE##SYNTAXHIGHLIGHT#Example: ln(e)#NEWLINE# -; Help for constant pi -sympi -Pi is the ratio of the circumference of a circle to its diameter. Being an#NEWLINE#irrational number, pi cannot be expressed exactly as a common fraction.#NEWLINE#The value of pi is commonly approximated as #SYNTAXHIGHLIGHT#3.14159#NORMALTEXT#.#NEWLINE# -symi -Den imagin�re enhen refereres og angives almindelig vis som i.#NEWLINE#Den imagin�re enhen et tal, som n�r det ganges med sig selv,#NEWLINE#giver resultatet -1.#NEWLINE# -symins -Den sidst udregnede v�rdi kan benyttes i n�ste udtryk ved hj�lp af #SYNTAXHIGHLIGHT#ins#NORMAL# variablen.#NEWLINE##SYNTAXHIGHLIGHT#Eksemple: ins*0,25#NEWLINE# -symbin -Der er ikke nogen hj�lp tilg�ngelig om bin�r n�gleordet.#NEWLINE -symoct -Der er ikke nogen hj�lp tilg�ngelig om oktal n�gleordet.#NEWLINE -symdec -Der er ikke nogen hj�lp tilg�ngelig om decimal n�gleordet.#NEWLINE -symhex -Der er ikke nogen hj�lp tilg�ngelig om hexadecimal n�gleordet.#NEWLINE diff --git a/utext/dk-ident.dict b/utext/dk-ident.dict deleted file mode 100644 index d9765530..00000000 --- a/utext/dk-ident.dict +++ /dev/null @@ -1,81 +0,0 @@ -## version $VER: amath-ident.catalog 1.60 (08.04.2015) Danish -## language dansk -## codeset 0 -; ############################################################################# -; ## Help texts for built-in functions in amath -; ## ------------------------------------------ -; ## -; ## This file is published under Creative Common License. See: -; ## http://creativecommons.org/licenses/by-sa/3.0/ -; ## Parts of the content came from wikipedia.org -; ############################################################################# -abs -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -sgn -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -round -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -trunc -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -floor -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -ceil -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -sqr -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -cbr -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -lb -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -ln -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -lg -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -sin -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -cos -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -tan -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -cot -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -sec -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -csc -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -asin -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -acos -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -atan -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -acot -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -asec -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -acsc -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -sinh -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -cosh -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -tanh -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -coth -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -sech -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -csch -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -asinh -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -acosh -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -atanh -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -acoth -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -asech -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# -acsch -Der er ikke nogen hj‘lp tilg‘ngelig om den funktion.#NEWLINE# diff --git a/utext/dk-keyword.dict b/utext/dk-keyword.dict deleted file mode 100644 index 25459fba..00000000 --- a/utext/dk-keyword.dict +++ /dev/null @@ -1,155 +0,0 @@ -## version $VER: amath-keyword.catalog 1.60 (08.04.2015) Danish -## language dansk -## codeset 0 -;############################################################################# -; Copyright (c) 2014-2017 Carsten Sonne Larsen -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; -; * Redistributions of source code must retain the above copyright notice, this -; list of conditions and the following disclaimer. -; -; * Redistributions in binary form must reproduce the above copyright notice, -; this list of conditions and the following disclaimer in the documentation -; and/or other materials provided with the distribution. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -;############################################################################# -;######### ClearStatement -clear -ryd -;######### FunctionDefinition statement -def -definer -;######### DeleteStatement and keyword -delete -slet -;######### Eulers Number keyword -e -e -;######### Complex i keyword -i -i -;######### pi keyword -pi -pi -;######### ins variable keyword -ins -ins -;######### EvalStatement -eval -beregn -;######### DrawStatement -draw -tegn -;######### PlotStatement -plot -plot -;######### ExecuteStatement -execute -k�r -;######### ExitStatement -exit -afslut -quit -slut -;######### Statements keyword -statements -kommandoer -;######### Operators keyword -operators -operatorer -;######### Complex keyword -complex -kompleks -;######### Function keyword -funcs -funk -functions -funktioner -;######### Trigonometric keyword -trigon -trigo -trigonometric -trigonometri -;######### Hyperbolic keyword -hyper -hyper -hyperbolic -hyperbolsk -;######### HelpStatement -help -hj�lp -;######### PromptStatement -prompt -prompt -;######### VersionStatement -version -version -;######### MemoryStatement -mem -hukommelse -memory -hukommelse -;######### PrefsStatement -prefs -pr�f -preferences -pr�ferencer -;######### ListStatement and keyword -list -list -;######### LoadStatement and keyword -load -hent -;######### SaveStatement and keyword -save -gem -;######### ShowStatement and keyword -show -vis -;######### ListVariablesStatement and keyword -vars -var -variables -variabler -;######### DigitsStatement -digits -cifre -;######### InputStatement -input -ind -;######### OutputStatement -output -ud -;######### Binary keyword -bin -bin -binary -bin�r -;######### Octal keyword -oct -okt -octal -oktal -;######### Decimal keyword -dec -dec -decimal -decimal -;######### Hexadecimal keyword -hex -hex -hexadecimal -hexadecimal diff --git a/utext/dk-text.dict b/utext/dk-text.dict deleted file mode 100644 index b0ef4800..00000000 --- a/utext/dk-text.dict +++ /dev/null @@ -1,96 +0,0 @@ -## version $VER: amath-text.catalog 1.60 (08.04.2015) Danish -## language dansk -## codeset 0 -; ############################################################################# -; Copyright (c) 2014-2017 Carsten Sonne Larsen -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; -; * Redistributions of source code must retain the above copyright notice, this -; list of conditions and the following disclaimer. -; -; * Redistributions in binary form must reproduce the above copyright notice, -; this list of conditions and the following disclaimer in the documentation -; and/or other materials provided with the distribution. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -; ############################################################################# -INTROMSG -#NORMALTEXT##BOLD##STARTMSG##NEWLINE##NORMALTEXT##COLOR02#Skriv hj�lp for at f� vist uddybende information.#NEWLINE# -TXTLISTDIRHEADER - Type Navn#NEWLINE#-----------------------------------------------#NEWLINE# -TXTLISTDIRTFILE -[fil] -TXTLISTDIRTDIR -[mappe] -TXTLISTDIRTUNKNOWN -[ukendt] -TXTMEMBLOCKS -Allokerede blokke: #SPACE# -TXTMEMSIZE -Hukommelsesforbrug:#SPACE# -TXTMEMMAXSIZE -H�jeste forbrug: #SPACE# -HELPNOHELP -Der er ingen hj�lp tilg�ngelig om det emne.#NEWLINE# -HELPSYNTAX -Syntaktiske fejl:#SPACE# -HELPUERROR -Uventet fejl:#SPACE# -HELPVARNDEF -Variablen er ikke defineret:#SPACE# -HELPFUNNDEF -Funktionen er ikke defineret:#SPACE# -HELPFUNRDEF -Funktionen er allerede defineret:#SPACE# -HELPPNUMERA -Grundtallet skal v�re mellem 2 og 32:#SPACE# -HELPPDIGITS -Antal betydende cifre skal v�re mellem 0 og 15:#SPACE# -HELPINPUSHOW -Talsystemet n�r computeren l�ser ind er#SPACE# -HELPOUTPSHOW -Talsystemet n�r computeren skriver ud er#SPACE# -HELPINPUSETT -Talsystemet ved indl�sning �ndret til#SPACE# -HELPOUTPSETT -Talsystemet ved udskrivning �ndret til#SPACE# -HELPDIGISETT -Antal betydende cifre �ndret til#SPACE# -HELPDIGISHOW -Antal betydende cifre der vises er#SPACE# -HELPVARSNDEF -Der er ikke defineret nogle variabler.#NEWLINE# -HELPFUNCNDEF -Der er ikke defineret nogle funktioner.#NEWLINE# -HELPLOADSUCC -Variabler og funktioner indl�st fra fil.#NEWLINE# -HELPSAVESUCC -Variabler og funktioner gemt til fil.#NEWLINE# -HELPSAVEFAIL -Kan ikke gemme fil.#NEWLINE# -HELPSAVENOTH -Der er ikke noget og gemme.#NEWLINE# -HELPPREFLOAD -Pr�ferencer blev indl�st.#NEWLINE# -HELPPREFNOLO -Kunne ikke indl�ses pr�ferencer.#NEWLINE# -HELPPREFSAVE -Pr�ferencer blev gemt.#NEWLINE# -HELPPREFNOSA -Kunne ikke gemme pr�ferencer.#NEWLINE# -MSGNODIR -Mappen kan ikke �bnes:#SPACE# -MSGNOFILE -Filen kan ikke �bnes.#NEWLINE#