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

Fixes nasty bug when locale means , is used for decimal point #468

Merged
merged 2 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/genn/genn/modelSpec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <cassert>

// GeNN includes
#include "gennUtils.h"
#include "modelSpec.h"

// GeNN code generator includes
Expand Down Expand Up @@ -230,10 +231,10 @@ void ModelSpec::finalize()
std::string ModelSpec::scalarExpr(double val) const
{
if (m_Precision == "float") {
return std::to_string((float)val) + "f";
return Utils::writePreciseString<float>(val) + "f";
}
else if (m_Precision == "double") {
return std::to_string(val);
return Utils::writePreciseString(val);
}
else {
throw std::runtime_error("Unrecognised floating-point type.");
Expand Down Expand Up @@ -319,4 +320,4 @@ SynapseGroupInternal *ModelSpec::findSynapseGroupInternal(const std::string &nam
else {
throw std::runtime_error("synapse group " + name + " not found, aborting ...");
}
}
}
4 changes: 2 additions & 2 deletions tests/unit/synapseGroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,8 @@ TEST(SynapseGroup, InvalidName)
NeuronModels::Izhikevich::VarValues varVals(0.0, 0.0);

ModelSpec model;
auto *pre = model.addNeuronPopulation<NeuronModels::SpikeSource>("Pre", 10, {}, {});
auto *post = model.addNeuronPopulation<NeuronModels::Izhikevich>("Post", 10, paramVals, varVals);
model.addNeuronPopulation<NeuronModels::SpikeSource>("Pre", 10, {}, {});
model.addNeuronPopulation<NeuronModels::Izhikevich>("Post", 10, paramVals, varVals);
try {
model.addSynapsePopulation<WeightUpdateModels::StaticPulse, PostsynapticModels::DeltaCurr>(
"Syn-6", SynapseMatrixType::DENSE_GLOBALG, NO_DELAY,
Expand Down