/* * Copyright (c) 1995, 1996 Gunther Schadow. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "pg_config.h" IDENT("@(#) cnv_func_tab.cc (Gunther Schadow) 12/19/96"); #include "UnitAtom.h" #include static double to_cel(double T_cel) { return T_cel - 273.15; } static double from_cel(double T_cel) { return T_cel + 273.15; } static double to_degf(double T_degf) { return T_degf - 459.67; } static double from_degf(double T_degf) { return T_degf + 459.67; } static double to_ph(double cH_molpl) { return -log10(cH_molpl); } static double from_ph(double cH_pH) { return pow(10, -cH_pH); } static double to_ln(double x) { return log(x); } static double from_ln(double x) { return exp(x); } static double to_lg(double x) { return log10(x); } static double from_lg(double x) { return pow(10, x); } static double to_10_lg(double x) { return 10 * log10(x); } static double from_10_lg(double x) { return pow(10, x/10); } static double to_20_lg(double x) { return 20 * log10(x); } static double from_20_lg(double x) { return pow(10, x/20); } UnitAtom::cnv_func UnitAtom::cnv_func::tab[] = { {"cel_f", from_cel, to_cel}, {"degf_f", from_degf, to_degf}, {"ph_f", from_ph, to_ph}, {"f_ln", from_ln, to_ln}, {"f_lg", from_lg, to_lg}, {"f_10_lg",from_10_lg,to_10_lg}, {"f_20_lg",from_20_lg,to_20_lg}, {NULL, NULL, NULL}, };