mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-12-23 04:43:57 +01:00
FIX: truncated precision of floats [text]
This commit is contained in:
parent
5fb1418f9b
commit
7d24442984
@ -151,12 +151,14 @@ for fname in files_funcs_groups:
|
|||||||
templine2 = templine1.replace('$group$', grname)
|
templine2 = templine1.replace('$group$', grname)
|
||||||
|
|
||||||
if params['dtype'] == 'double':
|
if params['dtype'] == 'double':
|
||||||
std_dtype = 'lf'
|
std_dtype_out = '24.16e'
|
||||||
|
std_dtype_in = 'lf'
|
||||||
elif params['dtype'] == 'int64_t':
|
elif params['dtype'] == 'int64_t':
|
||||||
std_dtype = 'ld'
|
std_dtype_out = 'ld'
|
||||||
|
std_dtype_in = 'ld'
|
||||||
|
|
||||||
templine1 = templine2.replace('$group_dset_std_dtype$', std_dtype)
|
templine1 = templine2.replace('$group_dset_std_dtype_out$', std_dtype_out)
|
||||||
templine2 = templine1
|
templine2 = templine1.replace('$group_dset_std_dtype_in$', std_dtype_in)
|
||||||
|
|
||||||
f_out.write(templine2)
|
f_out.write(templine2)
|
||||||
elif do_num:
|
elif do_num:
|
||||||
|
@ -385,7 +385,7 @@ $group$_t* trexio_text_read_$group$(trexio_text_t* const file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (uint64_t i=0 ; i<size_$group_dset$ ; ++i) {
|
for (uint64_t i=0 ; i<size_$group_dset$ ; ++i) {
|
||||||
rc = fscanf(f, "%$group_dset_std_dtype$", &($group$->$group_dset$[i]));
|
rc = fscanf(f, "%$group_dset_std_dtype_in$", &($group$->$group_dset$[i]));
|
||||||
assert(!(rc != 1));
|
assert(!(rc != 1));
|
||||||
if (rc != 1) {
|
if (rc != 1) {
|
||||||
FREE(buffer);
|
FREE(buffer);
|
||||||
@ -467,7 +467,7 @@ trexio_exit_code trexio_text_flush_$group$(trexio_text_t* const file) {
|
|||||||
|
|
||||||
fprintf(f, "$group_dset$\n");
|
fprintf(f, "$group_dset$\n");
|
||||||
for (uint64_t i=0 ; i<size_$group_dset$ ; ++i) {
|
for (uint64_t i=0 ; i<size_$group_dset$ ; ++i) {
|
||||||
fprintf(f, "%$group_dset_std_dtype$\n", $group$->$group_dset$[i]);
|
fprintf(f, "%$group_dset_std_dtype_out$\n", $group$->$group_dset$[i]);
|
||||||
}
|
}
|
||||||
// END REPEAT GROUP_DSET
|
// END REPEAT GROUP_DSET
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user