Syntax for pow function using inline C #5983
Replies: 1 comment
-
Posted at 2018-08-26 by @allObjects ...since there is no C preprocessor to resolve Posted at 2018-08-26 by Robin Sun 2018.08.26 Yeah, read that but on: http://www.espruino.com/Compilation
What part of using a math function isn't 'Maths' ? and wasn't sure if an extension was similar to a module http://www.espruino.com/Extending+Espruino+1 #include referenced there, so went on a hunch Wonder if I could accomplish the same task with a function that iterates using brute force += multiplication? Hmmmm Posted at 2018-08-28 by @gfwilliams http://www.espruino.com/Compilation is about compiling JS code, not inline C which is http://www.espruino.com/InlineC http://www.espruino.com/Extending+Espruino+1 is about compiling your own version if Espruino - in which case you can include what you want. The preprocessor is disabled because:
I guess you're just compiling a pow function for fun? Because there's one already in If I were doing it, I'd:
As mentioned in InlineC though, you may have similar issues dealing with double arithmetic though, since the double maths functions won't get built in by default. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-08-26 by Robin
Sun 2018.08.26
I am attempting to write some simple inline C functions. Was able to get the first snippet 'How do I use it' to compile and run.
http://www.espruino.com/InlineC
I'm now attempting the 'C' pow() function but wonder where to place the #include statement
#include <math.h>
Wouldn't you know it, this post machine wont allow the lt math.h gl symbology
#include <math.h>
Not under: either [http://www.espruino.com/Compilation](http://www.espruino.com/Compilation)
It can't be placed outside the
var c = E.compiledC(
block as it's not recognized as Javascript, and placing it inside results in this compiler msg:Need the insight of someone that's been down this path.
A pow er user ;-)
Thankx
Beta Was this translation helpful? Give feedback.
All reactions