Mercurial > octave-nkf
comparison src/data.cc @ 3321:6923abb04e16
[project @ 1999-10-26 18:15:30 by jwe]
author | jwe |
---|---|
date | Tue, 26 Oct 1999 18:15:41 +0000 |
parents | b6c74a0772b5 |
children | 8c6b4de3bdc8 |
comparison
equal
deleted
inserted
replaced
3320:b0b71d14dab9 | 3321:6923abb04e16 |
---|---|
795 | 795 |
796 return retval; | 796 return retval; |
797 } | 797 } |
798 | 798 |
799 DEFUN (is_matrix, args, , | 799 DEFUN (is_matrix, args, , |
800 "is_matrix (x): return nonzero if x can be considered a matrix") | 800 "-*- texinfo -*-\n\ |
801 @deftypefn {Usage} {} is_matrix (@var{a})\n\ | |
802 Return 1 if @var{a} is a matrix. Otherwise, return 0.\n\ | |
803 @end deftypefn\n\ | |
804 ") | |
801 { | 805 { |
802 double retval = 0.0; | 806 double retval = 0.0; |
803 | 807 |
804 if (args.length () == 1) | 808 if (args.length () == 1) |
805 { | 809 { |
1184 } | 1188 } |
1185 | 1189 |
1186 void | 1190 void |
1187 symbols_of_data (void) | 1191 symbols_of_data (void) |
1188 { | 1192 { |
1193 | |
1194 #define IMAGINARY_DOC_STRING "-*- texinfo -*-\n\ | |
1195 @defvr {Built-in Variable} I\n\ | |
1196 @defvrx {Built-in Variable} J\n\ | |
1197 @defvrx {Built-in Variable} i\n\ | |
1198 @defvrx {Built-in Variable} j\n\ | |
1199 A pure imaginary number, defined as\n\ | |
1200 @iftex\n\ | |
1201 @tex\n\ | |
1202 $\\sqrt{-1}$.\n\ | |
1203 @end tex\n\ | |
1204 @end iftex\n\ | |
1205 @ifinfo\n\ | |
1206 @code{sqrt (-1)}.\n\ | |
1207 @end ifinfo\n\ | |
1208 The @code{I} and @code{J} forms are true constants, and cannot be\n\ | |
1209 modified. The @code{i} and @code{j} forms are like ordinary variables,\n\ | |
1210 and may be used for other purposes. However, unlike other variables,\n\ | |
1211 they once again assume their special predefined values if they are\n\ | |
1212 cleared @xref{Status of Variables}.\n\ | |
1213 @end defvr" | |
1214 | |
1215 #define INFINITY_DOC_STRING "-*- texinfo -*-\n\ | |
1216 @defvr {Built-in Variable} Inf\n\ | |
1217 @defvrx {Built-in Variable} inf\n\ | |
1218 Infinity. This is the result of an operation like 1/0, or an operation\n\ | |
1219 that results in a floating point overflow.\n\ | |
1220 @end defvr" | |
1221 | |
1222 #define NAN_DOC_STRING "-*- texinfo -*-\n\ | |
1223 @defvr {Built-in Variable} NaN\n\ | |
1224 @defvrx {Built-in Variable} nan\n\ | |
1225 Not a number. This is the result of an operation like\n\ | |
1226 @iftex\n\ | |
1227 @tex\n\ | |
1228 $0/0$, or $\\infty - \\infty$,\n\ | |
1229 @end tex\n\ | |
1230 @end iftex\n\ | |
1231 @ifinfo\n\ | |
1232 0/0, or @samp{Inf - Inf},\n\ | |
1233 @end ifinfo\n\ | |
1234 or any operation with a NaN.\n\ | |
1235 \n\ | |
1236 Note that NaN always compares not equal to NaN. This behavior is\n\ | |
1237 specified by the IEEE standard for floating point arithmetic. To\n\ | |
1238 find NaN values, you must use the @code{isnan} function.\n\ | |
1239 @end defvr" | |
1240 | |
1189 DEFCONST (I, Complex (0.0, 1.0), | 1241 DEFCONST (I, Complex (0.0, 1.0), |
1190 "sqrt (-1)"); | 1242 IMAGINARY_DOC_STRING); |
1191 | 1243 |
1192 DEFCONST (Inf, octave_Inf, | 1244 DEFCONST (Inf, octave_Inf, |
1193 "infinity"); | 1245 INFINITY_DOC_STRING); |
1194 | 1246 |
1195 DEFCONST (J, Complex (0.0, 1.0), | 1247 DEFCONST (J, Complex (0.0, 1.0), |
1196 "sqrt (-1)"); | 1248 IMAGINARY_DOC_STRING); |
1197 | 1249 |
1198 DEFCONST (NaN, octave_NaN, | 1250 DEFCONST (NaN, octave_NaN, |
1199 "not a number"); | 1251 NAN_DOC_STRING); |
1200 | 1252 |
1201 #if defined (M_E) | 1253 #if defined (M_E) |
1202 double e_val = M_E; | 1254 double e_val = M_E; |
1203 #else | 1255 #else |
1204 double e_val = exp (1.0); | 1256 double e_val = exp (1.0); |
1205 #endif | 1257 #endif |
1206 | 1258 |
1207 DEFCONST (e, e_val, | 1259 DEFCONST (e, e_val, |
1208 "exp (1)"); | 1260 "-*- texinfo -*-\n\ |
1261 @defvr {Built-in Variable} e\n\ | |
1262 The base of natural logarithms. The constant\n\ | |
1263 @iftex\n\ | |
1264 @tex\n\ | |
1265 $e$\n\ | |
1266 @end tex\n\ | |
1267 @end iftex\n\ | |
1268 @ifinfo\n\ | |
1269 @var{e}\n\ | |
1270 @end ifinfo\n\ | |
1271 satisfies the equation\n\ | |
1272 @iftex\n\ | |
1273 @tex\n\ | |
1274 $\\log (e) = 1$.\n\ | |
1275 @end tex\n\ | |
1276 @end iftex\n\ | |
1277 @ifinfo\n\ | |
1278 @code{log} (@var{e}) = 1.\n\ | |
1279 @end ifinfo\n\ | |
1280 @end defvr"); | |
1209 | 1281 |
1210 DEFCONST (eps, DBL_EPSILON, | 1282 DEFCONST (eps, DBL_EPSILON, |
1211 "machine precision"); | 1283 "-*- texinfo -*-\n\ |
1284 @defvr {Built-in Variable} eps\n\ | |
1285 The machine precision. More precisely, @code{eps} is the largest\n\ | |
1286 relative spacing between any two adjacent numbers in the machine's\n\ | |
1287 floating point system. This number is obviously system-dependent. On\n\ | |
1288 machines that support 64 bit IEEE floating point arithmetic, @code{eps}\n\ | |
1289 is approximately\n\ | |
1290 @ifinfo\n\ | |
1291 2.2204e-16.\n\ | |
1292 @end ifinfo\n\ | |
1293 @iftex\n\ | |
1294 @tex\n\ | |
1295 $2.2204\\times10^{-16}$.\n\ | |
1296 @end tex\n\ | |
1297 @end iftex\n\ | |
1298 @end defvr"); | |
1212 | 1299 |
1213 DEFCONST (false, false, | 1300 DEFCONST (false, false, |
1214 "logical false value"); | 1301 "logical false value"); |
1215 | 1302 |
1216 DEFCONST (i, Complex (0.0, 1.0), | 1303 DEFCONST (i, Complex (0.0, 1.0), |
1217 "sqrt (-1)"); | 1304 IMAGINARY_DOC_STRING); |
1218 | 1305 |
1219 DEFCONST (inf, octave_Inf, | 1306 DEFCONST (inf, octave_Inf, |
1220 "infinity"); | 1307 INFINITY_DOC_STRING); |
1221 | 1308 |
1222 DEFCONST (j, Complex (0.0, 1.0), | 1309 DEFCONST (j, Complex (0.0, 1.0), |
1223 "sqrt (-1)"); | 1310 IMAGINARY_DOC_STRING); |
1224 | 1311 |
1225 DEFCONST (nan, octave_NaN, | 1312 DEFCONST (nan, octave_NaN, |
1226 "not a number"); | 1313 NAN_DOC_STRING); |
1227 | 1314 |
1228 #if defined (M_PI) | 1315 #if defined (M_PI) |
1229 double pi_val = M_PI; | 1316 double pi_val = M_PI; |
1230 #else | 1317 #else |
1231 double pi_val = 4.0 * atan (1.0); | 1318 double pi_val = 4.0 * atan (1.0); |
1232 #endif | 1319 #endif |
1233 | 1320 |
1234 DEFCONST (pi, pi_val, | 1321 DEFCONST (pi, pi_val, |
1235 "ratio of the circumference of a circle to its diameter"); | 1322 "-*- texinfo -*-\n\ |
1323 @defvr {Built-in Variable} pi\n\ | |
1324 The ratio of the circumference of a circle to its diameter.\n\ | |
1325 Internally, @code{pi} is computed as @samp{4.0 * atan (1.0)}.\n\ | |
1326 @end defvr"); | |
1236 | 1327 |
1237 DEFCONST (realmax, DBL_MAX, | 1328 DEFCONST (realmax, DBL_MAX, |
1238 "realmax (): return largest representable floating point number"); | 1329 "-*- texinfo -*-\n\ |
1330 @defvr {Built-in Variable} realmax\n\ | |
1331 The largest floating point number that is representable. The actual\n\ | |
1332 value is system-dependent. On machines that support 64 bit IEEE\n\ | |
1333 floating point arithmetic, @code{realmax} is approximately\n\ | |
1334 @ifinfo\n\ | |
1335 1.7977e+308\n\ | |
1336 @end ifinfo\n\ | |
1337 @iftex\n\ | |
1338 @tex\n\ | |
1339 $1.7977\\times10^{308}$.\n\ | |
1340 @end tex\n\ | |
1341 @end iftex\n\ | |
1342 @end defvr"); | |
1239 | 1343 |
1240 DEFCONST (realmin, DBL_MIN, | 1344 DEFCONST (realmin, DBL_MIN, |
1241 "realmin (): return smallest representable floating point number"); | 1345 "-*- texinfo -*-\n\ |
1346 @defvr {Built-in Variable} realmin\n\ | |
1347 The smallest floating point number that is representable. The actual\n\ | |
1348 value is system-dependent. On machines that support 64 bit IEEE\n\ | |
1349 floating point arithmetic, @code{realmin} is approximately\n\ | |
1350 @ifinfo\n\ | |
1351 2.2251e-308\n\ | |
1352 @end ifinfo\n\ | |
1353 @iftex\n\ | |
1354 @tex\n\ | |
1355 $2.2251\\times10^{-308}$.\n\ | |
1356 @end tex\n\ | |
1357 @end iftex\n\ | |
1358 @end defvr"); | |
1242 | 1359 |
1243 DEFVAR (treat_neg_dim_as_zero, 0.0, treat_neg_dim_as_zero, | 1360 DEFVAR (treat_neg_dim_as_zero, 0.0, treat_neg_dim_as_zero, |
1244 "convert negative dimensions to zero"); | 1361 "convert negative dimensions to zero"); |
1245 | 1362 |
1246 DEFCONST (true, true, | 1363 DEFCONST (true, true, |