Hi
I want to know if quantlib has function as follow: double amt = 1235.5678; amt = function(1235.5678, 2), 2- precision amt = 1235.57 thks!!! ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Just use
amt = std::round(amt * 100.0) / 100.0; -----邮件原件----- 发件人: 刘华 [mailto:[hidden email]] 发送时间: 2013年5月27日 15:18 收件人: [hidden email] 主题: [Quantlib-users] quantlib has round function? Hi I want to know if quantlib has function as follow: double amt = 1235.5678; amt = function(1235.5678, 2), 2- precision amt = 1235.57 thks!!! ---------------------------------------------------------------------------- -- Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Or
rounded = ClosestRounding(2)(amt); in <ql/math/rounding.hpp> you'll also find functions for up-rounding, down-rounding etc. Luigi On Mon, May 27, 2013 at 5:42 PM, Cheng Li <[hidden email]> wrote: > Just use > > amt = std::round(amt * 100.0) / 100.0; > > -----邮件原件----- > 发件人: 刘华 [mailto:[hidden email]] > 发送时间: 2013年5月27日 15:18 > 收件人: [hidden email] > 主题: [Quantlib-users] quantlib has round function? > > Hi > I want to know if quantlib has function as follow: > > double amt = 1235.5678; > > amt = function(1235.5678, 2), 2- precision > > amt = 1235.57 > > thks!!! > ---------------------------------------------------------------------------- > -- > Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only > SaaS-based application performance monitoring service that delivers powerful > full stack analytics. Optimize and monitor your browser, app, & servers with > just a few lines of code. Try New Relic and get this awesome Nerd Life > shirt! http://p.sf.net/sfu/newrelic_d2d_may > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users > > > ------------------------------------------------------------------------------ > Try New Relic Now & We'll Send You this Cool Shirt > New Relic is the only SaaS-based application performance monitoring service > that delivers powerful full stack analytics. Optimize and monitor your > browser, app, & servers with just a few lines of code. Try New Relic > and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |