Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6980

SDK • Lua math issue

$
0
0
Hello everyone,

I don't exactly understand what is going on but I'm not getting the correct output for this code

Code:

print (math.rad(90))local x = math.rad(90)print (math.cos(x))
I expected the output to be

Code:

Output:1.57079632679496.1232339957368e-17
However I'm getting

Code:

1.570796-4.371139e-08
I'm not worried about the precision but the answer is so very wrong I can't use the result any idea why am I getting such a wrong value?

Thanks in advance.

if you need to see my source code for this https://gitlab.com/DarkElvenAngel/pt52-lua the math library is standard Lua so I'm not sure if the SDK is giving the issue since Lua uses math.h

Statistics: Posted by DarkElvenAngel — Mon Jul 22, 2024 1:00 am — Replies 1 — Views 44



Viewing all articles
Browse latest Browse all 6980

Trending Articles