Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FMI Api is giving Round off value #145

Open
SudeepGhoshIN opened this issue Oct 15, 2024 · 3 comments
Open

FMI Api is giving Round off value #145

SudeepGhoshIN opened this issue Oct 15, 2024 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@SudeepGhoshIN
Copy link

I am using bellow code to get real value from model description , it is returning round off value. like 90547.9884 --> 90547.99
I want actual value without round off

fmi2_import_real_variable_t* rv = fmi2_import_get_variable_as_real(var);                    
    fmi2_real_t StartValue = fmi2_import_get_real_variable_start(rv); 
@PeterMeisrimelModelon PeterMeisrimelModelon self-assigned this Oct 15, 2024
@PeterMeisrimelModelon PeterMeisrimelModelon added the question Further information is requested label Oct 15, 2024
@PeterMeisrimelModelon
Copy link
Contributor

Hi,

how are you printing it? You might need some extra formatting specifiers to get all decimals.

/Peter

@SudeepGhoshIN
Copy link
Author

Hi , I am storing the value
fmi2_import_real_variable_t* rv = fmi2_import_get_variable_as_real(var);
fmi2_real_t StartValue = fmi2_import_get_real_variable_start(rv);
std::ostringstream valueAsObj;
valueAsObj << StartValue << std::endl;

@PeterMeisrimelModelon
Copy link
Contributor

This does sound like an issue specific to the way you are storing the value, see also #124 for reference where we talked about the same principle precision issue. Try to see if you get the correct accuracy by doing the same thing as in #124 (comment). If you do, then this is ostringstream issue.

/Peter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants