No this is not possible. No matter what they write in the source 5 or 5.0 it'll be represented as 5.
Vyacheslav Egorov On Oct 16, 2012 9:31 PM, "Brandon Harvey" <[email protected]> wrote: > I'd like to be able to do printf / snprintf style string formatting, on > the C++ side, using numbers obtained from v8. However, I'm not sure how to > know whether to use %f or %d (etc.) in any given case. I'd like to be able > to reflect the intent of the Javascript writer -- if they wrote 5.0, I'd > like to use %f, and if they wrote 5, I'd like to use %d. > > Brandon > > On Monday, October 15, 2012 10:22:52 PM UTC-7, Vyacheslav Egorov wrote: >> >> There are no integers in JavaScript so semantically they are identical. >> It's an implementation detail that 5.0 is sometimes represented as 5. Why >> do you want to distinguish them? >> >> Vyacheslav Egorov >> On Oct 16, 2012 5:25 AM, "Brandon Harvey" <[email protected]> wrote: >> >>> I'd like to be able to know whether not a particular Local<Value> >>> (passed to me as part of any Arguments list) refers to an integral number >>> (e.g. 5) or a floating-point style number (e.g. 5.0). Is there any way to >>> make that distinction? >>> >>> -- >>> v8-users mailing list >>> [email protected] >>> http://groups.google.com/**group/v8-users<http://groups.google.com/group/v8-users> >> >> -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
