Find Jobs
Hire Freelancers

C++ project

$30-100 USD

Abgesagt
Veröffentlicht vor etwa 16 Jahren

$30-100 USD

Bezahlt bei Lieferung
I have an application that takes a pointer to a function and returns the result of the function. I need to read the function in memory, save it as a file (as binary data is fine), and then read it in later, so that it can run it again. The 2 functions are: 1. Save function from memory 2. Load function from text file The specs are: typedef void (* FUNCTION_PTR) (float*, float**); int saveFunction (FUNCTION_PTR pToFunction, CString fileName) // this function takes the pointer to the function in memory and saves it as a file FUNCTION_PTR LoadFunction (CString fileName) // this function takes the filename, loads the file, loads the function into memory, and then returns a pointer to the funciton to run the function: (*pToFunction)(inputData, output); // This is how it works. I just added to explain. the function should occupy less than 10K of memory. here is an example of a function that we want to save and load the binary code for: #define TRUNC(x)(((x)>=0) ? floor(x) : ceil(x)) #define C_FPREM (_finite(f[0]/f[1]) ? f[0]-(TRUNC(f[0]/f[1])*f[1]) : f[0]/f[1]) #define C_F2XM1 (((fabs(f[0])<=1) && (!_isnan(f[0]))) ? (pow(2,f[0])-1) : ((!_finite(f[0]) && !_isnan(f[0]) && (f[0]<0)) ? -1 : f[0])) float DiscipulusCFunction(float v[]) { long double f[8]; long double tmp = 0; int cflag = 0; f[0]=f[1]=f[2]=f[3]=f[4]=f[5]=f[6]=f[7]=0; f[0]-=v[60]; cflag=(f[0] < f[2]); f[1]+=f[0]; f[0]+=v[31]; f[0]+=f[2]; if (!cflag) f[0] = f[2]; f[0]-=v[12]; f[0]/=f[0]; if (cflag) f[0] = f[0]; if (!cflag) f[0] = f[3]; f[0]+=f[1]; f[0]/=f[3]; f[0]/=v[61]; f[0]/=v[10]; cflag=(f[0] < f[1]); f[0]+=f[1]; cflag=(f[0] < f[2]); cflag=(f[0] < f[0]); f[0]+=f[0]; if (!_finite(f[0])) f[0]=0; return f[0]; } the first parameter that is passed is an array of inputs to function. it is an array of 64 floats. the second parameter is the output from the function. it says return f[0], but i call it with this code: (*pGeneticProgram)(g_StockData[currentDay], Outputs); myValue = Outputs[0]; so, i am not using the return value. it stores the return values in Outputs. I don't know why the function code only has one parameter. i guess that's not correct because i know the code i call it works. so i think it actually takes 2 parameters, the input array[64], and the output array[8]. if its easier to use the return value instead of modifying the outputs array, that's could work. but i don't know if that works so if you want to do it let me know and i will try it and see. also, there can be up to 2048 operations. (f[0]-=v[60]; is 1 operation). so i think that means the function could take up to 8k of memory, but i am not sure. you can call me to ask questions at 310 709 2042 (usa). i am available from 5AM to 11PM everyday (including new years day). feel free to ask me questions by email or call me. also, the outputs array has 8 floats. if possible, let's save the data as a text file. if not, it can be saved as a binary file.
Projekt-ID: 210584

Über das Projekt

Remote Projekt
Aktiv vor 16 Jahren

Möchten Sie etwas Geld verdienen?

Vorteile einer Ausschreibung auf Freelancer

Legen Sie Ihr Budget und Ihren Zeitrahmen fest
Für Ihre Arbeit bezahlt werden
Skizzieren Sie Ihren Vorschlag
Sie können sich kostenlos anmelden und auf Aufträge bieten

Über den Kunden

Flagge von IRELAND
Belfast, Ireland
4,9
121
Zahlungsmethode verifiziert
Mitglied seit Juli 29, 2007

Kundenüberprüfung

Danke! Wir haben Ihnen per E-Mail einen Link geschickt, über den Sie Ihr kostenloses Guthaben anfordern können.
Beim Senden Ihrer E-Mail ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.
Registrierte Benutzer Veröffentlichte Jobs
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Vorschau wird geladen
Erlaubnis zur Geolokalisierung erteilt.
Ihre Anmeldesitzung ist abgelaufen und Sie wurden abgemeldet. Bitte melden Sie sich erneut an.