Jump to content
  • 0
joao

Decimals in rAthena

Question

Despite of rAthenas' scripts not supporting decimals, I was wondering if there's a way to, for example, write a formula in C, compile it, and then call this C script inside a rAthena script (or must I do everything in C?). If you guys know any other way, or have any other suggestions on using decimals in rAthena, I'd love to hear. Thanks for the support!

 

EDIT: If I, for example, assign a formula to a variable (even if it contains divisions), and then multiply it by 10000000 (assuming there's a limit to the decimals), would it work properly or would I have any problem (maybe overflow)? Example:

[email protected] = (x/7)*100000000

Edited by joao
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
1 hour ago, joao said:

Despite of rAthenas' scripts not supporting decimals, I was wondering if there's a way to, for example, write a formula in C, compile it, and then call this C script inside a rAthena script (or must I do everything in C?). If you guys know any other way, or have any other suggestions on using decimals in rAthena, I'd love to hear. Thanks for the support!

 

EDIT: If I, for example, assign a formula to a variable (even if it contains divisions), and then multiply it by 10000000 (assuming there's a limit to the decimals), would it work properly or would I have any problem (maybe overflow)? Example:

[email protected] = (x/7)*100000000

You should organize your equation with fractions in mind.

 

You can write formula 'supporting' decimals but doing something along these lines

X = 123456

Mes X/100 +"."+ (X%100);

 

This will show "123.456"

 

 

Link to comment
Share on other sites

  • 0

Got it, thanks for the help. Just an update for anyone who might come to this topic searching for help: I found out you can't use decimals in sql_query function as well, but what you can do is Power/root operators in sql_query using the POW() SQL function.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.