
BASIC comparison sheet Functions Page 14
Vendor
Model
Syntax remarks
Precision of mathematical functions
Strings
Concatenation
Substrings
Length
ASCII to string
String to ASCII
Number to string
String to number
Expression evaluation
Search substring
Case conversion
Repeat string
Numbers
Absolute Value
Sign
Integer part
Fractional part
Largest integer below or equal
Smallest integer above or equal
PI
Other constants
Maximum
Minimum
Arithmetic
Implied multiplication AB=A*B
Integer division
Modulo
Remainder
Reduction
Percentage
Logic
Comparisons
Result of 1=1
Logical operators
Number of bits
Priority of NOT
Conversions
HEX format for integers
HEX display
Deg/min/sec to decimal
Number to deg/min/sec
Degrees to radians
Radians to degrees
Polar to rectangular
Rectangular to polar
More conversions
Round to d decimal places.
Examples round to cents.
Workarounds for positive x only!
Power x
y
Functions
HP TI Tandy Radio Shack Canon Epson
HP-75 HP-71 TI-74 CC-40 TRS-80 Model 100 X-07 HX-20
All function arguments need parentheses. All function arguments need parentheses.
REAL Default precision Double precision Single precision (most)
string1 & string2 string1 + string2
SEG$(string,start,length)
LEN(string) LEN(string)
CHR$(code) CHR$(code)
NUM(char) ASC(char) ASC(char)
STR$(expression) STR$(expression)
VAL(string), string must be valid number.
Numeric expressions not supported.
POS(string,substring)
UPRC$(string) N/A N/A
N/A RPT$(string,count) SPACE$(length), STRING$(length,code or char) only single character is supported.
ABS(x) ABS(x)
SGN(x) SGN(x)
IP(x) SGN(x) * INT(ABS(x)) FIX(x)
FP(x) SGN(x) * (ABS(x) – INT(ABS(x))) x – FIX(x)
INT(x), FLOOR(x) INT(x) INT(x)
CEIL(x) -INT(-x) -INT(-x)
N/A
PI
4*ATN(1)
Result is double precision Result is single precision
VER$, INF N/A N/A
MAX(a,b) -(a > b) * a - (a <= b) * b -(a > b) * a - (a <= b) * b
MIN(a,b) -(a > b) * b - (a <= b) * a -(a > b) * b - (a <= b) * a
No No
x ^ y x ^ y
a DIV b, a \ b INT(a / b) a \ b (Yen symbol on X-07)
MOD(a,b) a – b * INT(a / b) a – b * INT(a / b)
RMD(a,b) SGN(a) * (ABS(a) – ABS(b) * INT(ABS(a/b))) a MOD b
N/A RED(a,b) N/A N/A
a * p / 100 p % a a * p / 100 a * p / 100
<, <=, =<, >, >=, =>, =, <>, >< <, <=, =<, >, >=, =>, =, <>, ><
1 -1 -1
NOT, AND, OR, EXOR NOT, AND, OR, XOR NOT, AND, OR, XOR, EQV, IMP
16, signed 16, signed
Low Low
N/A
HTD("0")-HTD("FFFFF")
N/A N/A
&H0-&HFFFF
&nnnnn, &Onnnnn denote octal
N/A N/A N/A
RAD(d) d / 180 * PI d / 180 * PI (PI must be defined)
DEG(r) r / PI * 180 r / PI * 180 (PI must be defined)
N/A In MATH Module N/A CINT, CDBL, CSNG convert between integer, double or single precision.
String[from,to]
<to> defaults to end of string.
Can also be on left side of assignment: Substring
is cut and replacement inserted.
LEFT$(string,length)
RIGHT$(string$,length)
MID$(string,start,length)
VAL(string), string must be valid expression.
Numeric expressions are evaluated.
VAL(string), string must be valid number.
NUMERIC(string) tests if string is a number.
Numeric expressions not supported.
INSTR(start,string,substring)
IP(x * 10^d + 0.5) / 10^d,
IP(X*100+0.5)/100
INT(x * 10^d + 0.5) / 10^d,
INT(X*100+0.5)/100
INT(x * 10^d + 0.5) / 10^d,
INT(X*100+0.5)/100
Display only: PRINT USING"DDD.DD";X
Display only: PRINT USING "###.##";X
USING works for current line only.
Display only: PRINT USING "###.##";X
USING works for current line only.
FIX d, SCI d, ENG d set
display precision
VER$, INF, NAN, EPS,
MINREAL, MAXREAL
CALL VERSION(V) returns BASIC
version.
MAXRAM returns highest available
RAM address.
<, <=, =<, >, >=, =>, =, <>, ><, #
HP-71 only: ? (unordered, IEEE math)
See HP-75.
The HP-IL module adds
BINCMP(n),
BINAND(n,m),
BINIOR(n,m),
BINEOR(n,m) and
BIT(n,b) for 20 bit
integers.
Logical only: nonzero
values mapped to 1
High, expressions need
parentheses.
DTH$(n), n<2
20
,
0-padded to 5 digits.
HEX$(n), n<2
16
HEX$(n), n<2
16
OCT$(n) returns octal string
Only in CALC
mode
x=r * COS θ, y=r * SIN θ x=r * COS θ, y=r * SIN θ
r=SQR(x*x + y*y), θ=ACOS(x / r)
Keyboard function in TI-74 CALC mode.
r=SQR(x*x + y*y), θ=ACOS(x / r)
Comentarios a estos manuales