change error printing from errnum to errsym

When printing an error, calc used to print the errnum (error number):

    ; 1/0
	    Error 10001

Calc now prints the errsym (errsym):

    ; 1/0
	    Error E_DIVBYZERO

Added errsym E_LN_3 for ln(0).
Added errsym E_LOG_5 for log(0).
Added errsym E_LOG2_4 for log2(0).
Added errsym E_LOGN_6 for logn(0,base).
This commit is contained in:
Landon Curt Noll
2023-10-03 22:12:14 -07:00
parent db582d6e34
commit 42129a3672
22 changed files with 113 additions and 44 deletions

View File

@@ -18,7 +18,7 @@ DESCRIPTION
EXAMPLE
; print acsc(0), acsc(0.5), acsc(1)
Error 10454 1.57079632679489661923-1.31695789692481670863i 1.57079632679489661923
Error E_ACSC_3 1.57079632679489661923-1.31695789692481670863i 1.57079632679489661923
; print acsc(-0.5), acsc(-1)
-1.57079632679489661923+1.31695789692481670863i -1.57079632679489661923

View File

@@ -23,7 +23,7 @@ EXAMPLE
1.57079632679489661923 0.72972765622696636345 0.52359877559829887308
; print aexcsc(-0.5), aexcsc(-1)
1.57079632679489661923-1.31695789692481670863i Error 10454
1.57079632679489661923-1.31695789692481670863i Error E_AEXCSC_3
; print aexcsc(.5, 1e-5), aexcsc(.5, 1e-10), aexcsc(.5, 1e-15)
0.72973 0.7297276562 0.729727656226966

View File

@@ -23,7 +23,7 @@ EXAMPLE
0 0.84106867056793025578 1.04719755119659774615
; print aexsec(-0.5), aexsec(-1)
1.31695789692481670863i Error 10453
1.31695789692481670863i Error E_AEXSEC_3
; print aexsec(.5, 1e-5), aexsec(.5, 1e-10), aexsec(.5, 1e-15), aexsec(.5, 1e-20)
0.84107 0.8410686706 0.84106867056793 0.84106867056793025578

View File

@@ -18,7 +18,7 @@ DESCRIPTION
EXAMPLE
; print asec(0), asec(0.5), asec(1)
Error 10453 1.31695789692481670863i 0
Error E_ASEC_3 1.31695789692481670863i 0
; print asec(-0.5), asec(-1)
3.14159265358979323846-1.31695789692481670863i 3.14159265358979323846

View File

@@ -28,7 +28,7 @@ EXAMPLE
chunksize = 256, maxsize = 256, datalen = 3
010203
; blocks(2)
Error 10211
Error E_BLOCKS_2
; strerror()
"Non-allocated index number for blocks"
@@ -41,7 +41,7 @@ LINK LIBRARY
SEE ALSO
blk, blkfree
## Copyright (C) 1999,2021 Landon Curt Noll
## Copyright (C) 1999,2021,2023 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -73,13 +73,13 @@ EXAMPLE
; print custom("sysinfo", "baseb")
Calc was built with custom functions disabled
Error 10195
Error E_NO_C_ARG
If calc compiled with ALLOW_CUSTOM= -DCUSTOM and is invoked without -C:
; print custom("sysinfo", "baseb")
Calc must be run with a -C argument to use custom function
Error 10194
Error E_NO_C_ARG
If calc compiled with ALLOW_CUSTOM= -DCUSTOM and is invoked with -C:

View File

@@ -36,7 +36,7 @@ EXAMPLE
0
; a = 1/0; b = 2 + ""; c = error(27); d = newerror("a");
; print errcount(), a, errcount(), errmax();
4 Error 10001 4 10
4 Error E_DIVBYZERO 4 10
LIMITS
0 <= num < 2^32

View File

@@ -20,7 +20,7 @@ DESCRIPTION
EXAMPLE
; errmax(2)
0
20
; errcount()
0
; a = 1/0; b = 2 + ""; c = error(27); d = newerror("alpha");

View File

@@ -111,7 +111,7 @@ EXAMPLE
; print errcount(), errmax()
1 20
; print a
Error 10009
Error E_INV
; print iserror(a)
10009
; print strerror(a)

View File

@@ -28,7 +28,7 @@ EXAMPLE
; fgetstr(f)
; fputstr(f, "Gamma")
Error 72
Error E_FPUTSTR_3
LIMITS
none
@@ -39,7 +39,7 @@ LINK LIBRARY
SEE ALSO
fgetstr, fgetfield, fgets, fputs, fopen, files, fprintf
## Copyright (C) 1999-2006 Landon Curt Noll
## Copyright (C) 1999-2006,2023 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -31,7 +31,7 @@ EXAMPLE
Number: 1
; freestatics()
; f(1)
Error 10005
Error E_MUL
; strerror(.)
"Bad arguments for *"
@@ -44,7 +44,7 @@ LINK LIBRARY
SEE ALSO
free, freeglobals, freeredc
## Copyright (C) 1999 Landon Curt Noll
## Copyright (C) 1999,2023 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -28,7 +28,7 @@ EXAMPLE
"Leonard Euler"
; !chmod u-w /tmp/junk
; freopen(f, "w")
Error 10013
Error E_FRAC
LIMITS
none
@@ -40,7 +40,7 @@ SEE ALSO
errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen,
fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt
## Copyright (C) 1999-2006,2021 Landon Curt Noll
## Copyright (C) 1999-2006,2021,2023 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -40,7 +40,7 @@ EXAMPLE
; iserror(e1)
20000
; error(20000)
Error 20000
Error E_20000
; strerror(error(20000))
"triangle side length <= 0"
; strerror(e1);

View File

@@ -228,7 +228,7 @@ EXAMPLE
"No-type-change destination for assign"
; B = 45
; swap(A,B)
Error 10372
Error E_SWAP_2
; strerror()
"No-assign-to-or-from argument for swap"
; protect(A,-64)
@@ -244,21 +244,21 @@ EXAMPLE
; B = list(5,6,7,8)
; protect(A,16)
; copy(B,A)
Error 10226
Error E_COPY_14
; strerror()
"No-copy-to destination variable"
; A = list(1,2,3)
; protect(A,32)
; append(A,4)
Error 10402
Error E_LIST_4
; strerror()
"No-relocate for list append"
; A = blk(0,5)
; copy("abc", A)
; copy("de",A)
Error 10229
Error E_COPY_17
; strerror()
"No-relocate destination variable"
@@ -266,7 +266,7 @@ EXAMPLE
; protect(A,0)
; protect(*A, 16)
; copy("abc", A)
Error 10228
Error E_COPY_16
; strerror()
"No-copy-to destination named block"
@@ -279,7 +279,7 @@ LINK LIBRARY
SEE ALSO
assign, copy, blk, error, errno, strerror
## Copyright (C) 1999-2006,2021 Landon Curt Noll
## Copyright (C) 1999-2006,2021,2023 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -22,7 +22,7 @@ EXAMPLE
; scan(a, 0, c, d)
; 2+3 b=a^2 3+4i 3+"a"
; print a,b,c,d
5 25 3+4i Error 3
5 25 3+4i Error E_ADD
LIMITS
The number of arguments is not to exceed 1024.
@@ -33,7 +33,7 @@ LINK LIBRARY
SEE ALSO
fscan, strscan, fscanf, strscanf, scanf, printf, fprintf
## Copyright (C) 1999-2006 Landon Curt Noll
## Copyright (C) 1999-2006,2023 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License