How to data type long to double?

Using long, since my application uses a lot of encoder ticks
in a need of double, because the PID wants it

how to convert, or omit using long / having to give double ?

//full code

#include <digitalWriteFast.h>
#include <PID_v1.h>
// library for high performance reads and writes by jrraines
// 40000 encoder ticks per second per motor is tested and working

// Quadrature encoders
#define c_LeftEncoderInterrupt 0
#define c_LeftEncoderPinA 2
#define c_LeftEncoderPinB 3
#define LeftEncoderIsReversed
volatile bool _LeftEncoderBSet;
volatile long _LeftEncoderTicks;


//DC motor
const int INA = 12; const int INA2 = 6;
const int PWM_PIN = 11; const int PWM_PIN2 = 5;
const int INB = 10; const int INB2 = 4;
int speedm = 0;

//PID

double Setpoint = 10000, Input = int((_LeftEncoderTicks)), Output, Kp = 0.0025, Ki = 0.0008, Kd = 0.0008;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);



void setup()
{
  Serial.begin(115200);

  // Quadrature encoders
  pinMode(c_LeftEncoderPinB, INPUT);      // sets pin B as input
  digitalWrite(c_LeftEncoderPinB, LOW);  // turn on pullup resistorsM
  pinMode(c_LeftEncoderPinA, INPUT);      // sets pin A as input
  digitalWrite(c_LeftEncoderPinA, LOW);  // turn on pullup resistors
  attachInterrupt(c_LeftEncoderInterrupt, HandleLeftMotorInterruptA, RISING);

  //DC motor
  pinMode(INA, OUTPUT);   pinMode(INA2, OUTPUT);
  pinMode(INB, OUTPUT);   pinMode(INB2, OUTPUT);
  pinMode(PWM_PIN, OUTPUT);  pinMode(PWM_PIN2, OUTPUT);

  myPID.SetMode(AUTOMATIC);
}

void loop()
{
  Serial.println(Input);
  // Serial.println("\t");
  delay(5);


  if (_LeftEncoderTicks <= Setpoint) {
    digitalWrite(INA, HIGH);  digitalWrite(INA2, HIGH);
    digitalWrite(INB, LOW); digitalWrite(INB2, LOW);
    Serial.println("forward");
    myPID.Compute();
    analogWrite(PWM_PIN, Output); analogWrite(PWM_PIN2, Output);
  }

  /*
   if (_LeftEncoderTicks >= Setpoint) {
      digitalWrite(INB, HIGH); digitalWrite(INB2, HIGH);
      digitalWrite(INA, LOW); digitalWrite(INA2, LOW);
      Serial.printlnM("backward");
      myPID.Compute();
      analogWrite(PWM_PIN, Output); analogWrite(PWM_PIN2, Output);
    }
  */

}

// Interrupt service routines for the motor's quadrature encoder
void HandleLeftMotorInterruptA()
{
  // Test transition; since the interrupt will only fire on 'rising' we don't need to read pin A
  _LeftEncoderBSet = digitalReadFast(c_LeftEncoderPinB);   // read the input pin

  // and adjust counter + if A leads B
#ifdef LeftEncoderIsReversed
  _LeftEncoderTicks -= _LeftEncoderBSet ? -1 : +1;
#else
  _LeftEncoderTicks += _LeftEncoderBSet ? -1 : +1;
#endif
}

What is the problem? If the function expects a float, you can pass it a long, and the long will be promoted to a float.

the error message for using a long in the PID

Arduino: 1.6.4 (Windows 8.1), Board: "Arduino Uno"

Using library digitalWriteFast in folder: C:\Users\esvanj\Documents\Arduino\libraries_

Using library PID in folder: C:\Users\esvanj\Documents\Arduino\libraries\PID

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Users\esvanj\Documents\Arduino\libraries_ -IC:\Users\esvanj\Documents\Arduino\libraries\PID C:\Users\esvanj\AppData\Local\Temp\build7616555364842606247.tmp\PID_test.cpp -o C:\Users\esvanj\AppData\Local\Temp\build7616555364842606247.tmp\PID_test.cpp.o

PID_test.ino:24:57: error: no matching function for call to 'PID::PID(long int*, double*, double*, double&, double&, double&, int)'
PID_test.ino:24:57: note: candidates are:
In file included from PID_test.ino:2:0:
C:\Users\esvanj\Documents\Arduino\libraries\PID/PID_v1.h:24:5: note: PID::PID(double*, double*, double*, double, double, double, int)
PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and
^
C:\Users\esvanj\Documents\Arduino\libraries\PID/PID_v1.h:24:5: note: no known conversion for argument 1 from 'long int*' to 'double*'
C:\Users\esvanj\Documents\Arduino\libraries\PID/PID_v1.h:20:5: note: PID::PID(double*, double*, double*, double, double, double, int, int)
PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and
^
C:\Users\esvanj\Documents\Arduino\libraries\PID/PID_v1.h:20:5: note: candidate expects 8 arguments, 7 provided
C:\Users\esvanj\Documents\Arduino\libraries\PID/PID_v1.h:5:7: note: PID::PID(const PID&)
class PID
^
C:\Users\esvanj\Documents\Arduino\libraries\PID/PID_v1.h:5:7: note: candidate expects 1 argument, 7 provided
no matching function for call to 'PID::PID(long int*, double*, double*, double&, double&, double&, int)'

code:

#include <digitalWriteFast.h>
#include <PID_v1.h>
// library for high performance reads and writes by jrraines
// 40000 encoder ticks per second per motor is tested and working

// Quadrature encoders
#define c_LeftEncoderInterrupt 0
#define c_LeftEncoderPinA 2
#define c_LeftEncoderPinB 3
#define LeftEncoderIsReversed
volatile bool _LeftEncoderBSet;
volatile long _LeftEncoderTicks;


//DC motor
const int INA = 12; const int INA2 = 6;
const int PWM_PIN = 11; const int PWM_PIN2 = 5;
const int INB = 10; const int INB2 = 4;
int speedm = 0;

//PID
long Input = _LeftEncoderTicks;
double Setpoint = 10000, Output, Kp = 0.0025, Ki = 0.0001, Kd = 0.0001;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);



void setup()
{
  Serial.begin(115200);

  // Quadrature encoders
  pinMode(c_LeftEncoderPinB, INPUT);      // sets pin B as input
  digitalWrite(c_LeftEncoderPinB, LOW);  // turn on pullup resistorsM
  pinMode(c_LeftEncoderPinA, INPUT);      // sets pin A as input
  digitalWrite(c_LeftEncoderPinA, LOW);  // turn on pullup resistors
  attachInterrupt(c_LeftEncoderInterrupt, HandleLeftMotorInterruptA, RISING);

  //DC motor
  pinMode(INA, OUTPUT);   pinMode(INA2, OUTPUT);
  pinMode(INB, OUTPUT);   pinMode(INB2, OUTPUT);
  pinMode(PWM_PIN, OUTPUT);  pinMode(PWM_PIN2, OUTPUT);

  myPID.SetMode(AUTOMATIC);
}

void loop()
{
  Serial.println(Input);
  // Serial.println("\t");
  delay(5);


  if (_LeftEncoderTicks <= Setpoint) {
    digitalWrite(INA, HIGH);  digitalWrite(INA2, HIGH);
    digitalWrite(INB, LOW); digitalWrite(INB2, LOW);
    Serial.println("forward");
    myPID.Compute();
    analogWrite(PWM_PIN, Output); analogWrite(PWM_PIN2, Output);
  }

  /*
   if (_LeftEncoderTicks >= Setpoint) {
      digitalWrite(INB, HIGH); digitalWrite(INB2, HIGH);
      digitalWrite(INA, LOW); digitalWrite(INA2, LOW);
      Serial.printlnM("backward");
      myPID.Compute();
      analogWrite(PWM_PIN, Output); analogWrite(PWM_PIN2, Output);
    }
  */

}

// Interrupt service routines for the motor's quadrature encoder
void HandleLeftMotorInterruptA()
{
  // Test transition; since the interrupt will only fire on 'rising' we don't need to read pin A
  _LeftEncoderBSet = digitalReadFast(c_LeftEncoderPinB);   // read the input pin

  // and adjust counter + if A leads B
#ifdef LeftEncoderIsReversed
  _LeftEncoderTicks -= _LeftEncoderBSet ? -1 : +1;
#else
  _LeftEncoderTicks += _LeftEncoderBSet ? -1 : +1;
#endif
}

if I wasn't clear before, my problem is that I use the data type long for my encoder values while the PID function from the library expects a double, which gives me the error above. So I phrased my question, how to convert a long to a double, or make the PID library happy with my long?

how to convert a long to a double

Your problem is you actually need a "pointer to double" in the PID constructor.
The easiest thing to do is just use a float for the PID, and make sure you update its value from the long before calling myPID.compute():

  :
//PID
double Input;
double Setpoint = 10000, Output, Kp = 0.0025, Ki = 0.0001, Kd = 0.0001;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
  :
void loop()
{
  :
  if (_LeftEncoderTicks <= Setpoint) {
    digitalWrite(INA, HIGH);  digitalWrite(INA2, HIGH);
    digitalWrite(INB, LOW); digitalWrite(INB2, LOW);
    Serial.println("forward");
    Input = _LeftEncoderTicks;
    myPID.Compute();
    analogWrite(PWM_PIN, Output); analogWrite(PWM_PIN2, Output);
  }

  /*
   if (_LeftEncoderTicks >= Setpoint) {
      digitalWrite(INB, HIGH); digitalWrite(INB2, HIGH);
      digitalWrite(INA, LOW); digitalWrite(INA2, LOW);
      Serial.printlnM("backward");
      Input = _LeftEncoderTicks;
      myPID.Compute();
      analogWrite(PWM_PIN, Output); analogWrite(PWM_PIN2, Output);
    }
  */
}

Brilliant! That works like a charm! I understand its workings better now, thank you!