playMaker

Author Topic: I really need to work with Double variables..What alternative do I have?[SOLVED]  (Read 2116 times)

Rockstarfreak

  • Playmaker Newbie
  • *
  • Posts: 10
I tried to avoid this problem many times but it's impossible now. I am developing a bitcoin dice simulator and people work wit 8 decimals. If you use a float variable and only use decimals you would only have 7 decimals to work with. With every number you use in front of the decimal, more decimals disappear. So I thought of using to floats and splitting the string (input of the player). But that is not possible because floats ignore 0s in front of the first non0 number (example: 987.0001: number1=987, number2=1 (0s ignored)). Is there any other option or a way to get double variables in playmaker?
« Last Edit: December 02, 2016, 01:38:48 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: I really need to work with Double variables... What alternative do I have?
« Reply #1 on: December 01, 2016, 03:04:50 AM »
Hi,

You could split manually, I think you can get passed the ignored 0s.

now, maybe you should then wrap your double into an class and use FsmObject to work with it, but every mathematical actions for float will have to be duplicated and modified to work with your double object wrapper.

 the other solution which I think it best is to use soft references like I do for XmlMaker where I need to let the developer work with xmlNodes classes which isn't also available as an Fsm variable, so what I do is I keep a list of my values with string keys defined by the developer, and then he can refer to any custom value using that string. I would explore this.

Bye,

 Jean

Rockstarfreak

  • Playmaker Newbie
  • *
  • Posts: 10
Re: I really need to work with Double variables... What alternative do I have?
« Reply #2 on: December 01, 2016, 12:03:43 PM »
Thank you very much jeanfabre!