Boost logo

Boost Users :

Subject: Re: [Boost-users] [Units] Temperature conversion problem
From: Belcourt, Kenneth (kbelco_at_[hidden])
Date: 2011-11-30 16:50:07


On Nov 30, 2011, at 2:24 PM, Matthias Schabel wrote:

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

Oh, okay, missed that. So I probably don't fully understand what the units library is doing but I find this behavior a bit worrisome.

[kbelco_at_wsblade001 ~]$ cat test3.cpp

int main(int, char **) {
  quantity<fahrenheit::temperature> f(212 * fahrenheit::temperature());
  quantity<celsius::temperature> c(f);
  std::cout << f << std::endl;
  std::cout << c << std::endl;
  return 0;
}

[kbelco_at_wsblade001 ~]$ ./a.out
212 F
117.778 C

If 'f' is 212ºF, why, when converting it to ºC, do I end up at 117 and change? Is this really what we should expect? It seems that this very simple use case produces unexpected, and to a casual user wrong, results. I understand the need for complexity but it seems to show up very early in the user experience.

-- 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