Commit 0651db52 authored by Clément Stenac's avatar Clément Stenac

%f in galaktos (Closes:#585)

parent 13817ff8
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#include <vlc/vlc.h>
/* Library functions to manipulate initial condition values */ /* Library functions to manipulate initial condition values */
...@@ -115,6 +115,7 @@ void init_cond_to_string(init_cond_t * init_cond) { ...@@ -115,6 +115,7 @@ void init_cond_to_string(init_cond_t * init_cond) {
/* Create a string "param_name=val" */ /* Create a string "param_name=val" */
switch (init_cond->param->type) { switch (init_cond->param->type) {
lldiv_t div;
case P_TYPE_BOOL: case P_TYPE_BOOL:
sprintf(string, "%s=%d\n", init_cond->param->name, init_cond->init_val.bool_val); sprintf(string, "%s=%d\n", init_cond->param->name, init_cond->init_val.bool_val);
...@@ -123,7 +124,9 @@ void init_cond_to_string(init_cond_t * init_cond) { ...@@ -123,7 +124,9 @@ void init_cond_to_string(init_cond_t * init_cond) {
sprintf(string, "%s=%d\n", init_cond->param->name, init_cond->init_val.int_val); sprintf(string, "%s=%d\n", init_cond->param->name, init_cond->init_val.int_val);
break; break;
case P_TYPE_DOUBLE: case P_TYPE_DOUBLE:
sprintf(string, "%s=%f\n", init_cond->param->name, init_cond->init_val.double_val); div = lldiv( init_cond->init_val.double_val * 1000000,
1000000 );
sprintf(string, "%s="I64Fd".%06u\n", init_cond->param->name, div.quot, (unsigned int) div.rem );
break; break;
default: default:
return; return;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#include <vlc/vlc.h>
#include <stdio.h> #include <stdio.h>
...@@ -886,15 +887,19 @@ void write_init(init_cond_t * init_cond) { ...@@ -886,15 +887,19 @@ void write_init(init_cond_t * init_cond) {
sprintf(s, "%s=%d\n", init_cond->param->name, init_cond->init_val.int_val); sprintf(s, "%s=%d\n", init_cond->param->name, init_cond->init_val.int_val);
else if (init_cond->param->type == P_TYPE_DOUBLE) else if (init_cond->param->type == P_TYPE_DOUBLE)
sprintf(s, "%s=%f\n", init_cond->param->name, init_cond->init_val.double_val); {
lldiv_t div = lldiv( init_cond->init_val.double_val * 1000000,1000000 );
sprintf(s, "%s="I64Fd".%06u\n", init_cond->param->name, div.quot,
(unsigned int) div.rem );
}
else { printf("write_init: unknown parameter type!\n"); return; } else { printf("write_init: unknown parameter type!\n"); return; }
len = strlen(s); len = strlen(s);
if ((fwrite(s, 1, len, write_stream)) != len) if ((fwrite(s, 1, len, write_stream)) != len)
printf("write_init: failed writing to file stream! Out of disk space?\n"); printf("write_init: failed writing to file stream! Out of disk space?\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment