473,771 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

replacement for 'pow()' function

Hello,

I'd like to make a simple replacement of 'pow()' function for the embedded
platform I'm working on. What is the better way, probably bit shifting?
Thanks.

Best regards, Roman Mashak.
Dec 13 '07
15 7417
pete wrote:
Thad Smith wrote:
>pete wrote:
>>/* BEGIN fs_pow.h */
/*
** Portable code for either freestanding or hosted
** implementations of C.
*/
#ifndef H_FS_POW_H
#define H_FS_POW_H

double fs_pow(double x, double y);
double fs_fmod(double x, double y);
double fs_exp(double x);
double fs_log(double x);
double fs_sqrt(double x);
Interesting. What are the license requirements on the code?

I don't know. I think it's public domain.
If it is public domain, it is rather old, or explicitly declared such by
the author. The default in the US and most other countries is copyright
at the time of creation.

If you wrote the code and would like others to use it, I recommend that
you place a comment in the header stating that it is donated to the
public domain by the author, and include your name.
--
Thad
Dec 14 '07 #11
Thad Smith wrote:
>
pete wrote:
Thad Smith wrote:
pete wrote:
/* BEGIN fs_pow.h */
/*
** Portable code for either freestanding or hosted
** implementations of C.
*/
#ifndef H_FS_POW_H
#define H_FS_POW_H

double fs_pow(double x, double y);
double fs_fmod(double x, double y);
double fs_exp(double x);
double fs_log(double x);
double fs_sqrt(double x);
Interesting. What are the license requirements on the code?
I don't know. I think it's public domain.

If it is public domain, it is rather old,
or explicitly declared such by the author.
The default in the US and most other countries is copyright
at the time of creation.

If you wrote the code and would like others to use it,
I recommend that
you place a comment in the header stating that it is donated to the
public domain by the author, and include your name.
OK

--
pete
Dec 14 '07 #12
Op Thu, 13 Dec 2007 14:37:43 +0100 schreef Chris Dollin
<ch**********@h p.com>:
pete wrote:
>Thad Smith wrote:
>>Interesting . What are the license requirements on the code?

It's just trivial code.

Licensing isn't about whether the code is trivial or not.
Yes it is. Any license on something trivial cannot be enforced. Except
in an unreasonable justice system, of course...

--
Gemaakt met Opera's revolutionaire e-mailprogramma:
http://www.opera.com/mail/
Dec 14 '07 #13
pete wrote:
Thad Smith wrote:
>pete wrote:
>>Thad Smith wrote:
pete wrote:
/* BEGIN fs_pow.h */
/*
** Portable code for either freestanding or hosted
** implementations of C.
*/
#ifndef H_FS_POW_H
#define H_FS_POW_H
>
double fs_pow(double x, double y);
double fs_fmod(double x, double y);
double fs_exp(double x);
double fs_log(double x);
double fs_sqrt(double x);
Interestin g. What are the license requirements on the code?
I don't know. I think it's public domain.
If it is public domain, it is rather old,
or explicitly declared such by the author.
The default in the US and most other countries is copyright
at the time of creation.

If you wrote the code and would like others to use it,
I recommend that
you place a comment in the header stating that it is donated to the
public domain by the author, and include your name.

OK
Thanks. It matters to people who program for a living and are careful
about getting legal rights to the code they use.

As a suggestion, consider contributing it to Snippets.org, which has a
public domain collection of code snippets.

--
Thad
Dec 15 '07 #14
Thad Smith wrote:
>
pete wrote:
Thad Smith wrote:
pete wrote:
Thad Smith wrote:
pete wrote:
/* BEGIN fs_pow.h */
/*
** Portable code for either freestanding or hosted
** implementations of C.
*/
#ifndef H_FS_POW_H
#define H_FS_POW_H

double fs_pow(double x, double y);
double fs_fmod(double x, double y);
double fs_exp(double x);
double fs_log(double x);
double fs_sqrt(double x);
Interesting . What are the license requirements on the code?
I don't know. I think it's public domain.
If it is public domain, it is rather old,
or explicitly declared such by the author.
The default in the US and most other countries is copyright
at the time of creation.

If you wrote the code and would like others to use it,
I recommend that
you place a comment in the header stating that it is donated to the
public domain by the author, and include your name.
OK

Thanks. It matters to people who program for a living and are careful
about getting legal rights to the code they use.

As a suggestion, consider contributing it to Snippets.org, which has a
public domain collection of code snippets.
OK

--
pete
Dec 16 '07 #15
"Boudewijn Dijkstra" <bo*******@inde s.comwrote:
Op Thu, 13 Dec 2007 14:37:43 +0100 schreef Chris Dollin
pete wrote:
Thad Smith wrote:
>Interesting. What are the license requirements on the code?

It's just trivial code.
Licensing isn't about whether the code is trivial or not.

Yes it is. Any license on something trivial cannot be enforced. Except
in an unreasonable justice system, of course...
pete is in the USA.

Richard
Dec 17 '07 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
13063
by: Arik Peltz | last post by:
Hi, Does anybody know how pow() function is implemented in the standard libraries of visual c++ 6.0 ? Thanks, Arik
0
308
by: Robert Smith | last post by:
Sorry if I posted this incorrectly and/or in the wrong place. I'm an idiot. Nevertheless, it would be kind if someone forwarded this to the appropriate people VC 6 VC 7 (.net) float Test = pow(2, 32); Test = 4.29497e+009 Test = 0 int Test = pow(2, 32); Test = 0 Test = 0
8
29249
by: Black Eagle | last post by:
Hey guys, Under linux, I tried this : #include <stdio.h> #include <math.h> main() { double a= 2.0; double b= 3.0; printf("%f^%f=%f",a,b,pow(a,b));
5
2866
by: Magix | last post by:
#include <math.h> double pow( double base, double exp ); will pow (2, -30) works fine ? (exp is negative value). If not, what are the workaround for exp to be negative?
2
3315
by: matrim | last post by:
What I'm trying to do: 1. Attempt to open the file. The filename, c:\\windData.txt, should be hardcoded into your program. Note the two slash characters in the file name. If the file cannot be opened, display a message and exit the program. 2. From the file read a temperature and a wind speed. Both values should be stored in variables declared as double. The file is a text file. 3. Calculate the wind chill factor using a programmer...
2
10252
by: satya3005 | last post by:
Dear members can u please tell me how to write code for x power n with out using pow() function.The manipulation code must be in only one line.
1
5920
by: denxx | last post by:
Hi, I am new in C++ and was trying to run a programme where I found an error using the pow statement. Error showed is error C2660: 'pow' : function does not take 1 parameters. As I have a square on the whole equation, I am not sure whether I am sure the power function right. Please advise, anyone? Code shown as below: eqn=vf+((vf*(1-x)+vg)*x); fun3 = 1000*hf+1000*hfg*x+(m*m*(pow(eqn,2.0))/2-1000*h-(pow(V,2.0)/2)); many thanks!
2
4334
by: Richard Ballin | last post by:
Hello All, I am taking a class using Visual Studio C++ Express 2010 and on one of the first projects i need to use the Math::Pow() function. The book does not do a good job of explaining how to use this. I was able to create the program and calculate simple interest fine with a normal formula however once I needed to calculate compounded interest it required a exponent. Line 203 of the Code is where the error is. "error C2660:...
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.