Jump to content
  • 0

Decimals in rAthena


Question

Posted (edited)

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:

$@formula = (x/7)*100000000

Edited by joao

2 answers to this question

Recommended Posts

  • 0
Posted
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:

$@formula = (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"

 

 

  • MVP 1
  • 0
Posted

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.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...