Dear All,

How to write that V = -sqrt{(2 * (Pd /1000)) / 1.225} to the arduino program.

Dear All,

How to write that V = -sqrt{(2 * (Pd /1000)) / 1.225} to the arduino program.

```
V = -sqrt((2. * Pd /1000.) / 1.225);
```

Which is the same as

```
V = -sqrt(Pd*1.633E-3);
```

jremington:

`V = -sqrt((2. * Pd /1000.) / 1.225);`

Which is the same as

`V = -sqrt(Pd*1.633E-3);`

I use your code to the program, but it wrong output.

There may be some mistake. I rewrite that show you.

the calculation is √{(2 * (Pd /1000)) / 1.225}

I use your code to the program, but it wrong output.

How do you know?

Is there a minus sign “-” or not?

the original formula is V= √{(2 * (Pd /1000)) / 1.225}

- sqrt = √ ?

shanelle: the original formula is V= √{(2 * (Pd /1000)) / 1.225}

- sqrt = √ ?

In math and C++, a leading minus sign indicates a negative value.

Without the minus sign, the formula is

```
V = sqrt(Pd*1.633E-3);
```

You need to declare V as float.

In the sticky thread, point 13, there's a link to the AVR libc docs. sqrt() in in the docs for math.h.

like this?

```
void setup()
{
Serial.begin(115200);
Serial.print("Start ");
Serial.println(__FILE__);
for (float Pd = 0; Pd < 10; Pd = Pd + 0.01)
{
float val = 2.0 * (Pd / 1000.0) / 1.225;
float v = sqrt( val );
Serial.print(Pd);
Serial.print("\t");
Serial.println(v);
}
}
void loop()
{
}
```