|
Boost Users : |
Subject: [Boost-users] [Units] Temperature conversion problem
From: Belcourt, Kenneth (kbelco_at_[hidden])
Date: 2011-11-30 16:11:54
Hi,
There appears to be a temperature conversion problem between ºC and ºF. Here's a simple test that shows the error under both gcc and Intel on both Darwin and Linux (with Boost trunk).
brisc:~ kbelco$ cat test3.cpp
#include <iostream>
#include <boost/units/io.hpp>
#include <boost/units/quantity.hpp>
#include <boost/units/systems/temperature/celsius.hpp>
#include <boost/units/systems/temperature/fahrenheit.hpp>
int main(int, char **) {
using namespace boost::units;
quantity<fahrenheit::temperature> t(100 * celsius::temperature());
// expect output of 212 F, produces 180 F
// seems like not adding 32º offset when computing F = (C * 9/5 + 32)
std::cout << t << std::endl;
return 0;
}
brisc:~ kbelco$ icpc -g -Iboost test3.cpp
brisc:~ kbelco$ ./a.out
180 F
-- Noel
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net