math was not declared

I'm just starting to learn Arduino's and its coding but with all learning experience's I've hit a road block that i need some help. I'm been trying to do small projects to learn the process and code, currently i'm trying to use a meat thermometer and read it with the Arduino using some sample code. All was going good until i got to this line

 result=Math.log(((10240000/x) - 10000));

I'm getting a "math was not declared in this scope error. My research says that i need math.h library but i can't find it. I tried defining it but it still didn't work I'm sure this is some rookie error.

Have you by any chance tried

#include <math.h>

Do you need to #include it specifically ?

Are you sure that you are trying to use the log function correctly ?

log function

without Math. just log

UKHeliBob
I did try

#include <math.h>

but this did not help. The math.h part was not the same color as the "include" either.

Juraj
I changed the line to

result=log(((10240000/x) - 10000));

and it compiled. What is the difference between the two?

What is the difference between the two?

"Math."

The math.h part was not the same color as the "include" either.

Ignore the colours.

As you have discovered and as I alluded to you don't need to explicitly #include the library anyway but you do need to use the function correctly.

Thanks, I'm still not clear on the log after reading your link. I'll do some more research on it.

What could be clearer ?

void setup()
{
  Serial.begin(115200);
  double param, result;
  param = 5.5;
  result = log(param);
  Serial.println(result, 6);
}

void loop()
{
}

My apologies, this is all new and I'm trying to learn. I do appreciate all the help and positive direction I get along the way.

Are you trying to covert code from some other language? "Math.log()" looks to be mostly a Javascript or Python syntax.
The C/C++ syntax would be more like "Math::log()", except that C/C++ is so old a language that math functions are shoved in at the "top level" of the namespaces, so it's just "log()"
(In this case "Math" is known as a 'namespace' that groups a bunch of similar functions, and prevents their names from conflicting with similar names that do something entirely different (say: "TinkerToyGraphics.log(length, diameter)") "Modern Languages" are big on using this concept as they embrace a broad range of "things." But C is not a "modern language", and (mathematical) log() is a standard C function.)

What do logarithms have to do with reading a meat thermometer?

Maybe a thermistor and the Steinhart - Hart equation?

And this library:

Thanks Westfw, that's helpful and makes some sence. Like is said, i'm trying to learn but it didn't look familiar. The post that i was using as a guide is here-

Radar – O’Reilly

It looks to me like that particular example is a javascript host-side example talking to a Firmata sketch running on the arduino hardware. Huh. I just mentioned Firmata in another thread - it's a special purpose sketch/protocol that runs on both the arduino and the host (PC) that lets a host program (written in any number of languages) access the arduino hardware in ways that are similar to running code on the arduino itself (digitalWrite(), and etc.)

That explains why it wasn't looking familiar. That's ok, it did give me enough structure and guidance to get it done and learn a little more.

Thanks for the great feedback.