FAQ Database Discussion Community


why does Ruby's Rational class treat string arguments differently from numeric arguments?

ruby,aspect-ratio,rational
I'm using ruby's Rational library to convert the width & height of images to aspect ratios. I've noticed that string arguments are treated differently than numeric arguments. >> Rational('1.91','1') => (191/100) >> Rational(1.91,1) => (8601875288277647/4503599627370496) >> RUBY_VERSION => "2.1.5" >> RUBY_ENGINE => "ruby" FYI 1.91:1 is an aspect ratio recommended...

Calling a Static Method In Main

java,methods,static,rational
How do call the last method on this class, in main? I am just trying to return a new Rational object that contains the product of the two parameters. Every time I try to call it in main, I can't use integer in the parameters, since it only accepts objects....

How to convert a Rational into a “pretty” String?

haskell,formatting,rational
I want to display some Rational values in their decimal expansion. That is, instead of displaying 3 % 4, I would rather display 0.75. I'd like this function to be of type Int -> Rational -> String. The first Int is to specify the maximum number of decimal places, since...

Error while connecting to ClearCase(CCRC) via STS eclipse

java,eclipse,spring,clearcase,rational
Getting below error in the log while connecting to ClearCase(CCRC) via STS eclipse. Spring Tool Suite Version: 3.6.2.RELEASE Build Id: 201410091308 Platform: Eclipse Luna SR1 (4.4.1) ClearCase Version: 7.1.0.10 Error !ENTRY org.eclipse.jface 4 0 2015-02-05 10:25:39.807 !MESSAGE Unhandled event loop exception during blocked modal context. !STACK 0 org.eclipse.swt.SWTException: Failed to...