Re: [rspec-users] Why can not a BigDecimal be compared to a Float via "==". How should I handle this???

2009-01-11 Thread Greg Hauptmann
ok - thanks - seems like if one remembers to use "BigDecimal('10.1')", then instead of 10.1 in your code you should be ok then. On Mon, Jan 12, 2009 at 6:45 AM, Maurício Linhares < mauricio.linha...@gmail.com> wrote: > This is a very bad idea, as you can break the whole runtime by doing > this, a

Re: [rspec-users] Why can not a BigDecimal be compared to a Float via "==". How should I handle this???

2009-01-11 Thread Mark Wilden
On Sun, Jan 11, 2009 at 12:17 AM, Greg Hauptmann < greg.hauptmann.r...@gmail.com> wrote: > Any suggestions on how to write an rspec expectation for equality when you > get a BigDecimal back. I see that "big_decimal_variable.should == 123.23" > doesn't work as the ruby BigDecimal comparison (via

Re: [rspec-users] Why can not a BigDecimal be compared to a Float via "==". How should I handle this???

2009-01-11 Thread Tero Tilus
2009-01-11 18:17, Greg Hauptmann: > Any suggestions on how to write an rspec expectation for equality when you > get a BigDecimal back. I see that "big_decimal_variable.should == > 123.23" If you register keywords "comparison" and "float", you should train yourself to cry out "delta" without even

Re: [rspec-users] Why can not a BigDecimal be compared to a Float via "==". How should I handle this???

2009-01-11 Thread Maurício Linhares
This is a very bad idea, as you can break the whole runtime by doing this, as many internal classes use floating point math. You would also slow the world down, as operations using BigDecimals are some order of magnitude slower than pure floating point math. - Maurício Linhares http://alinhavado.w

Re: [rspec-users] Why can not a BigDecimal be compared to a Float via "==". How should I handle this???

2009-01-11 Thread Greg Hauptmann
it would be nice in one's project if you could basically say "use BigDecimal wherever you normally would have used a float", just to get the benefit but maintain ease of coding/readability etc - anyone know if this is possible? Would it be enough to override Float's initializer and return a BigDe

Re: [rspec-users] Why can not a BigDecimal be compared to a Float via "==". How should I handle this???

2009-01-11 Thread Rick DeNatale
On Sun, Jan 11, 2009 at 9:21 AM, David Chelimsky wrote: > On Sun, Jan 11, 2009 at 4:05 AM, Greg Hauptmann > wrote: > > I've gone with the following > > ai.amount.should == BigDecimal('-323.03') > > However I'm still a bit surprised that Ruby itself does allow a good "==" > > test between a F

Re: [rspec-users] Why can not a BigDecimal be compared to a Float via "==". How should I handle this???

2009-01-11 Thread David Chelimsky
On Sun, Jan 11, 2009 at 4:05 AM, Greg Hauptmann wrote: > I've gone with the following > ai.amount.should == BigDecimal('-323.03') > However I'm still a bit surprised that Ruby itself does allow a good "==" > test between a Float and a BigDecimal. Perhaps there's a reason that I'm > missing?

Re: [rspec-users] maybe I 'get it' after all

2009-01-11 Thread aslak hellesoy
On Sun, Jan 11, 2009 at 1:56 PM, Tom Cloyd wrote: > I hope I'm not the only one in the world who posts to a discussion list > only to (maybe) get the answer to a question moments after hitting > posting. Sigh. > > Looking again, in the cucumber wiki page "Running Features", I had a > sense that I

Re: [rspec-users] Is the Fit Table documentation correct?

2009-01-11 Thread Matt Wynne
On 11 Jan 2009, at 01:22, MarkMT wrote: Thanks Matt. I have now found the page that deals with scenario outlines (GH is back up) - http://wiki.github.com/aslakhellesoy/cucumber/scenario-outlines so that is now pretty clear. Might be worth a note in the fit table page referring to that. The

Re: [rspec-users] getting started - very much a beginner

2009-01-11 Thread aslak hellesoy
On Sun, Jan 11, 2009 at 1:26 PM, Tom Cloyd wrote: > A hope my ignorance is acceptable here. I have, to this point, > programmed in Ruby mostly using my awareness of procedural programming; > I've written a small number of very useful programs for myself. I'm starting > to use classes now - just s

Re: [rspec-users] maybe I 'get it' after all

2009-01-11 Thread doug livesey
> I hope I'm not the only one in the world who posts to a discussion list > only to (maybe) get the answer to a question moments after hitting > posting. Sigh. Hey, that's my trick! Get your own! 2009/1/11 Tom Cloyd > I hope I'm not the only one in the world who posts to a discussion list > only

[rspec-users] maybe I 'get it' after all

2009-01-11 Thread Tom Cloyd
I hope I'm not the only one in the world who posts to a discussion list only to (maybe) get the answer to a question moments after hitting posting. Sigh. Looking again, in the cucumber wiki page "Running Features", I had a sense that I maybe I DID know what to do, went to /examples/dos_line_endin

[rspec-users] getting started - very much a beginner

2009-01-11 Thread Tom Cloyd
A hope my ignorance is acceptable here. I have, to this point, programmed in Ruby mostly using my awareness of procedural programming; I've written a small number of very useful programs for myself. I'm starting to use classes now - just starting. I have a small project I'm working on - settin

Re: [rspec-users] Why can not a BigDecimal be compared to a Float via "==". How should I handle this???

2009-01-11 Thread Greg Hauptmann
I've gone with the following ai.amount.should == BigDecimal('-323.03') However I'm still a bit surprised that Ruby itself does allow a good "==" test between a Float and a BigDecimal. Perhaps there's a reason that I'm missing? On Sun, Jan 11, 2009 at 7:23 PM, Mark Wilden wrote: > On Sun,

Re: [rspec-users] Why can not a BigDecimal be compared to a Float via "==". How should I handle this???

2009-01-11 Thread Mark Wilden
On Sun, Jan 11, 2009 at 12:17 AM, Greg Hauptmann < greg.hauptmann.r...@gmail.com> wrote: > > Any suggestions on how to write an rspec expectation for equality when you > get a BigDecimal back. I see that "big_decimal_variable.should == 123.23" > doesn't work as the ruby BigDecimal comparison (via

[rspec-users] Why can not a BigDecimal be compared to a Float via "==". How should I handle this???

2009-01-11 Thread Greg Hauptmann
Hi, Any suggestions on how to write an rspec expectation for equality when you get a BigDecimal back. I see that "big_decimal_variable.should == 123.23" doesn't work as the ruby BigDecimal comparison (via ==) to the same Float value gives false (not true as you'd expect). For background / as an e