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

1e crashes with java.lang.NumberFormatException: For input string: "" #190

Closed
vanniktech opened this issue Dec 28, 2018 · 3 comments
Closed

Comments

@vanniktech
Copy link

I'd expect 1e to print 2.71828182846 instead I'm getting an exception:

java.lang.NumberFormatException: For input string: ""
    at java.lang.Integer.parseInt(Integer.java:627)
    at java.lang.Integer.parseInt(Integer.java:650)
    at java.math.BigDecimal.<init>(BigDecimal.java:336)
    at java.math.BigDecimal.<init>(BigDecimal.java:444)
    at com.udojava.evalex.Expression$59.eval(Expression.java:1363)
    at com.udojava.evalex.Expression.eval(Expression.java:1398)
    at com.udojava.evalex.Expression.eval(Expression.java:1273)
@RobertZenz
Copy link
Collaborator

There is no implicit multiplication, you have to specify a multiplication. See #64.

@vanniktech
Copy link
Author

My problem is similar to the one from @flashtek. The input is coming from a user and he'd expect it to be multiplied.

E.g. What about A5BSIN(2) - is this a function named A5BSIN or an expression A5SIN(2) ?

If a function with a name A5BSIN is defined then it should take precedence. Otherwise A*5*SIN(2) as long as A can be satisfied. If none can then it can crash.

@vanniktech
Copy link
Author

The same should be applied for where PI is defined as .setVariable("π", Expression.PI).

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

3 participants