Files
IfcOpenShell/src/ifcparse/si_prefix.cpp
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
2.4 KiB
C++
Raw Normal View History

/********************************************************************************
* *
* This file is part of IfcOpenShell. *
* *
* IfcOpenShell is free software: you can redistribute it and/or modify *
* it under the terms of the Lesser GNU General Public License as published by *
* the Free Software Foundation, either version 3.0 of the License, or *
* (at your option) any later version. *
* *
* IfcOpenShell is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* Lesser GNU General Public License for more details. *
* *
* You should have received a copy of the Lesser GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
2017-12-20 16:38:55 +01:00
2026-03-31 15:32:36 +02:00
#include "si_prefix.h"
2017-12-20 16:38:55 +01:00
2026-03-31 15:32:36 +02:00
double ifcopenshell::si_prefix_to_value(const std::string& prefix) {
if (prefix == "EXA") {
2023-09-17 12:30:17 +02:00
return 1.e18;
}
if (prefix == "PETA") {
2023-09-17 12:30:17 +02:00
return 1.e15;
}
if (prefix == "TERA") {
2023-09-17 12:30:17 +02:00
return 1.e12;
}
if (prefix == "GIGA") {
2023-09-17 12:30:17 +02:00
return 1.e9;
}
if (prefix == "MEGA") {
2023-09-17 12:30:17 +02:00
return 1.e6;
}
if (prefix == "KILO") {
2023-09-17 12:30:17 +02:00
return 1.e3;
}
if (prefix == "HECTO") {
2023-09-17 12:30:17 +02:00
return 1.e2;
}
if (prefix == "DECA") {
2023-09-17 12:30:17 +02:00
return 1.e1;
}
if (prefix == "DECI") {
2023-09-17 12:30:17 +02:00
return 1.e-1;
}
if (prefix == "CENTI") {
2023-09-17 12:30:17 +02:00
return 1.e-2;
}
if (prefix == "MILLI") {
2023-09-17 12:30:17 +02:00
return 1.e-3;
}
if (prefix == "MICRO") {
2023-09-17 12:30:17 +02:00
return 1.e-6;
}
if (prefix == "NANO") {
2023-09-17 12:30:17 +02:00
return 1.e-9;
}
if (prefix == "PICO") {
2023-09-17 12:30:17 +02:00
return 1.e-12;
}
if (prefix == "FEMTO") {
2023-09-17 12:30:17 +02:00
return 1.e-15;
}
if (prefix == "ATTO") {
2023-09-17 12:30:17 +02:00
return 1.e-18;
}
return 1.;
2016-05-24 13:50:50 +02:00
}