1
0
Fork 0

add approx_eq to math.nas and is_regular_file io.nas

This commit is contained in:
Henning Stahlke 2020-04-07 22:45:35 +02:00 committed by James Turner
parent d2d1fead76
commit 2a48a3012b
2 changed files with 10 additions and 0 deletions

View file

@ -28,6 +28,12 @@ var is_directory = func(path) {
else return 0;
};
var is_regular_file = func(path) {
var tmp = stat(path);
if (tmp != nil and tmp[11] == "reg") return 1;
else return 0;
};
# <path> the path that should be searched for subdirectories
# returns a vector of subdirectory names
var subdirectories = func(path) {

View file

@ -43,3 +43,7 @@ var mod = func(n, m) {
var _iln10 = 1/ln(10);
var log10 = func(x) { ln(x) * _iln10 }
var approx_eq = func (a,b, d = 0.000001) {
return (abs(a-b) < d);
}