Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad parsing numbers beginning by 9 (ESP32) #9

Closed
radovan76 opened this issue Nov 16, 2019 · 1 comment
Closed

bad parsing numbers beginning by 9 (ESP32) #9

radovan76 opened this issue Nov 16, 2019 · 1 comment

Comments

@radovan76
Copy link

code:

#include "elk.h"
struct js *js;
char buff[100];
void setup() {
  Serial.begin(115200);
  void* m=malloc(10000);
  js = js_create(m, 10000);
  js_eval(js, "let num1=0;", 0);
  char buff2[10];
  for(int i=0;i<200;i++) Serial.printf("%d = %s\n",i,js_fmt(js,js_eval(js,itoa(i,buff2,10),0),buff,100));
  Serial.printf("num89: %s\n",js_fmt(js,js_eval(js,"89",0),buff,100));
  Serial.printf("num90: %s\n",js_fmt(js,js_eval(js,"90",0),buff,100));
  Serial.printf("num99: %s\n",js_fmt(js,js_eval(js,"99",0),buff,100));
  Serial.printf("num100: %s\n",js_fmt(js,js_eval(js,"100",0),buff,100));
}
void loop() {}

output:

01:58:15.506 -> 0 = 0
01:58:15.506 -> 1 = 1
01:58:15.506 -> 2 = 2
01:58:15.506 -> 3 = 3
01:58:15.506 -> 4 = 4
01:58:15.506 -> 5 = 5
01:58:15.506 -> 6 = 6
01:58:15.506 -> 7 = 7
01:58:15.506 -> 8 = 8
01:58:15.506 -> 9 = undefined
01:58:15.506 -> 10 = 10
01:58:15.506 -> 11 = 11
01:58:15.506 -> 12 = 12
01:58:15.506 -> 13 = 13
01:58:15.506 -> 14 = 14
01:58:15.506 -> 15 = 15
01:58:15.506 -> 16 = 16
01:58:15.506 -> 17 = 17
01:58:15.506 -> 18 = 18
01:58:15.506 -> 19 = 19
01:58:15.506 -> 20 = 20
01:58:15.506 -> 21 = 21
01:58:15.506 -> 22 = 22
01:58:15.506 -> 23 = 23
01:58:15.506 -> 24 = 24
01:58:15.506 -> 25 = 25
01:58:15.506 -> 26 = 26
01:58:15.506 -> 27 = 27
01:58:15.506 -> 28 = 28
01:58:15.506 -> 29 = 29
01:58:15.506 -> 30 = 30
01:58:15.506 -> 31 = 31
01:58:15.506 -> 32 = 32
01:58:15.506 -> 33 = 33
01:58:15.506 -> 34 = 34
01:58:15.506 -> 35 = 35
01:58:15.506 -> 36 = 36
01:58:15.506 -> 37 = 37
01:58:15.506 -> 38 = 38
01:58:15.506 -> 39 = 39
01:58:15.506 -> 40 = 40
01:58:15.506 -> 41 = 41
01:58:15.506 -> 42 = 42
01:58:15.506 -> 43 = 43
01:58:15.506 -> 44 = 44
01:58:15.506 -> 45 = 45
01:58:15.506 -> 46 = 46
01:58:15.506 -> 47 = 47
01:58:15.506 -> 48 = 48
01:58:15.506 -> 49 = 49
01:58:15.506 -> 50 = 50
01:58:15.506 -> 51 = 51
01:58:15.506 -> 52 = 52
01:58:15.506 -> 53 = 53
01:58:15.506 -> 54 = 54
01:58:15.506 -> 55 = 55
01:58:15.506 -> 56 = 56
01:58:15.506 -> 57 = 57
01:58:15.506 -> 58 = 58
01:58:15.506 -> 59 = 59
01:58:15.506 -> 60 = 60
01:58:15.506 -> 61 = 61
01:58:15.506 -> 62 = 62
01:58:15.506 -> 63 = 63
01:58:15.506 -> 64 = 64
01:58:15.506 -> 65 = 65
01:58:15.506 -> 66 = 66
01:58:15.506 -> 67 = 67
01:58:15.506 -> 68 = 68
01:58:15.506 -> 69 = 69
01:58:15.506 -> 70 = 70
01:58:15.506 -> 71 = 71
01:58:15.506 -> 72 = 72
01:58:15.506 -> 73 = 73
01:58:15.506 -> 74 = 74
01:58:15.506 -> 75 = 75
01:58:15.506 -> 76 = 76
01:58:15.506 -> 77 = 77
01:58:15.506 -> 78 = 78
01:58:15.506 -> 79 = 79
01:58:15.506 -> 80 = 80
01:58:15.506 -> 81 = 81
01:58:15.506 -> 82 = 82
01:58:15.506 -> 83 = 83
01:58:15.506 -> 84 = 84
01:58:15.506 -> 85 = 85
01:58:15.559 -> 86 = 86
01:58:15.559 -> 87 = 87
01:58:15.559 -> 88 = 88
01:58:15.559 -> 89 = 89
01:58:15.559 -> 90 = undefined
01:58:15.559 -> 91 = undefined
01:58:15.559 -> 92 = undefined
01:58:15.559 -> 93 = undefined
01:58:15.559 -> 94 = undefined
01:58:15.559 -> 95 = undefined
01:58:15.559 -> 96 = undefined
01:58:15.559 -> 97 = undefined
01:58:15.559 -> 98 = undefined
01:58:15.559 -> 99 = undefined
01:58:15.559 -> num89: 89
01:58:15.559 -> num90: undefined
01:58:15.559 -> num99: undefined
01:58:15.559 -> num100: 100
@cpq
Copy link
Member

cpq commented Nov 24, 2019

Fixed in 0.0.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants