playMaker

Author Topic: Fsm Double ?  (Read 1387 times)

johannastephen

  • Playmaker Newbie
  • *
  • Posts: 35
    • View Profile
Fsm Double ?
« 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?

dudebxl

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Re: Fsm Double ?
« Reply #1 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)..
« Last Edit: February 27, 2016, 06:21:09 PM by dudebxl »

johannastephen

  • Playmaker Newbie
  • *
  • Posts: 35
    • View Profile
Re: Fsm Double ?
« Reply #2 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.

dudebxl

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Re: Fsm Double ?
« Reply #3 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
« Last Edit: February 28, 2016, 10:55:24 AM by dudebxl »

johannastephen

  • Playmaker Newbie
  • *
  • Posts: 35
    • View Profile
Re: Fsm Double ?
« Reply #4 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.