[clfft] 06/74: FIX: for float to string conversion always use '.' as comma separator, independent of locale setting
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Jan 14 19:52:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/sid
in repository clfft.
commit 87ff509b5f66cca4125604dbd3efbbf127c469f2
Author: Gregor Thalhammer <gregor.thalhammer at gmail.com>
Date: Wed Nov 11 18:23:56 2015 +0100
FIX: for float to string conversion always use '.' as comma separator, independent of locale setting
---
src/library/generator.stockham.cpp | 10 ++++------
src/library/private.h | 1 +
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/library/generator.stockham.cpp b/src/library/generator.stockham.cpp
index 660189e..08f32d6 100644
--- a/src/library/generator.stockham.cpp
+++ b/src/library/generator.stockham.cpp
@@ -570,15 +570,13 @@ namespace StockhamGenerator
// Stringize the table
std::stringstream ss;
+ ss.imbue(std::locale("C"));
+ ss.precision(34);
for(size_t i = 0; i < (N-1); i++)
{
ss << "("; ss << RegBaseType<PR>(2); ss << ")(";
-
- char cv[64], sv[64];
- sprintf(cv, "%036.34lf", wc[i]);
- sprintf(sv, "%036.34lf", ws[i]);
- ss << cv; ss << sfx; ss << ", ";
- ss << sv; ss << sfx; ss << "),\n";
+ ss << std::scientific << wc[i] << sfx << ", ";
+ ss << std::scientific << ws[i] << sfx << "),\n";
}
twStr += ss.str();
}
diff --git a/src/library/private.h b/src/library/private.h
index ccca9db..0d7320c 100644
--- a/src/library/private.h
+++ b/src/library/private.h
@@ -21,6 +21,7 @@
#include <vector>
#include <string>
+#include <locale>
#include <iostream>
#include <sstream>
#include <stdexcept>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/clfft.git
More information about the debian-science-commits
mailing list