Boost logo

Boost Users :

Subject: Re: [Boost-users] [Units] Temperature conversion problem
From: Matthias Schabel (boost_at_[hidden])
Date: 2011-11-30 16:24:05


http://www.boost.org/doc/libs/1_48_0/doc/html/boost_units/Examples.html#boost_units.Examples.AbsoluteRelativeTemperatureExample

> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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