*Here is sample:*

auto isolate = v8::Isolate::GetCurrent();

Local<ObjectTemplate> global = ObjectTemplate::New(isolate);

global->Set(v8_str(isolate, "i"), Number::New(isolate, *4*));

Local<Context> context = Context::New(isolate, nullptr, global);
Context::Scope context_scope(context);

auto i = context->Global()->Get(context, v8_str(isolate, 
"i")).ToLocalChecked();

std::cout << "i: " << i->NumberValue() << std::endl;

*out:*

*i: 4*


*But replace:*
global->Set(v8_str(isolate, "i"), Number::New(isolate, 4));

with

global->Set(v8_str(isolate, "i"), Number::New(isolate, 4.4));

*and out:*

i: nan

Why??

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to