• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSNI eval function returning float

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys, I have a problem, I'm in need of using eval function from inside gtw, that calculates my function gives as String, for example Math.cos(5+9); and returning float.
I have been trying around with


However I can't make it work even for int numbers, not even for 5+2. Any idea how to fix that?
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Kowalski wrote:
However I can't make it work even for int numbers, ...


ItDoesntWorkIsUseless
What is the expected behavior and what is the observed behavior. Please TellTheDetails

Looking at the code you posted (mind you I do not work with JS), if I think logically, then I would say there is no "myVar" defined which you are trying to return.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you're trying to evaluate this, if I understand it correctly:



I would expect that to assign a string with three characters to the "myVar" variable. I wouldn't expect that coercing that string to int would produce 7, either. But the fix should be pretty clear, shouldn't it?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic