Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: johannastephen on February 27, 2016, 05:59:21 PM

Title: Fsm Double ?
Post by: johannastephen on February 27, 2016, 05:59:21 PM
Hi. I want to write a custom action. I didnt see any FsmDouble for Double variable type. FsmFloat, FsmString is there. FsmDouble? Where is it?
Title: Re: Fsm Double ?
Post by: dudebxl on February 27, 2016, 06:15:48 PM
+1 for double (on the rare occasions I use it but there is no alternative inside PM)..
Title: Re: Fsm Double ?
Post by: johannastephen on February 28, 2016, 02:51:02 AM
I think that i can solve this with:

Code: [Select]
float f = 0.3f;
double d1 = System.Convert.ToDouble(f);

I try it when i go home. I'll write here the result.
Title: Re: Fsm Double ?
Post by: dudebxl on February 28, 2016, 10:47:49 AM
Dude,

For such a number why do you use double? the reason I ask for double is because a double has 2x the precision than a float. A double has 15 decimal digits of precision, while float only has 7.

In the script you can convert float & double, sure but you will need to round it and you will lose the precision (the only reason to use double).

 :o
Title: Re: Fsm Double ?
Post by: johannastephen on February 28, 2016, 02:50:23 PM
Dude,

For such a number why do you use double? the reason I ask for double is because a double has 2x the precision than a float. A double has 15 decimal digits of precision, while float only has 7.

In the script you can convert float & double, sure but you will need to round it and you will lose the precision (the only reason to use double).

 :o

I have to use double values for DateTime functions. They need double values instead of floats.
And i can say that the code on my previous post doesnt work. The following code works:

Code: [Select]

float myFloat = 5f;
double d1 = (double) myFloat;

Thank you.