Package org.jruby

Examples of org.jruby.RubyFloat


            ByteList num = absSubSequence(memo, p);
            // note: this is actually a shared string, but since it is temporary and
            //       read-only, it doesn't really matter
            RubyString expr = RubyString.newStringLight(getRuntime(), num);
            RubyFloat number = RubyNumeric.str2fnum(getRuntime(), expr, true);
            return new ParserResult(number, p + 1);
        }
View Full Code Here


            int new_p = parseFloatInternal(p, pe);
            if (new_p == -1) {
                res.update(null, p);
                return;
            }
            RubyFloat number = createFloat(p, new_p);
            res.update(number, new_p + 1);
            return;
        }
View Full Code Here

       public static String convertToFloat(Object rubyObject) throws AxisFault {
           try {

               if(rubyObject instanceof RubyFloat){
               RubyFloat floatObject = (RubyFloat) rubyObject;
               return floatObject.toString();
               }
               return Double.toString(RubyFloat.num2dbl((IRubyObject)rubyObject)) ;
              // return rubyObject.toString();
           } catch (Exception e) {
               throw new AxisFault("Unable to convert the return value to float");
View Full Code Here

    }

    public static void benchFloatFib(int n) {
        long start = System.currentTimeMillis();
        ThreadContext context = ruby.getCurrentContext();
        RubyFloat result = boxedFib(context, RubyFloat.newFloat(ruby, n));
        System.out.println("Took " + (System.currentTimeMillis() - start) + "ms for boxedFib(" + n + ") = " + result);
    }
View Full Code Here

                return new NativeMethod(module, arity, fn);
        }
    }

    public static RubyFloat newFloat(Ruby runtime, long handle, double value) {
        final RubyFloat f = RubyFloat.newFloat(runtime, value);
        GC.register(f, Handle.newHandle(runtime, f, handle));

        return f;
    }
View Full Code Here

        }
        return fixnum;
    }

    public final RubyFloat getFloat(Ruby runtime, int index, double value) {
        RubyFloat flote = floats[index];
        if (flote == null) {
            return floats[index] = RubyFloat.newFloat(runtime, value);
        }
        return flote;
    }
View Full Code Here

            int new_p = parseFloatInternal(p, pe);
            if (new_p == -1) {
                res.update(null, p);
                return;
            }
            RubyFloat number = createFloat(p, new_p);
            res.update(number, new_p + 1);
            return;
        }
View Full Code Here

                return new NativeMethod(module, arity, fn);
        }
    }

    public static RubyFloat newFloat(Ruby runtime, long handle, double value) {
        final RubyFloat f = RubyFloat.newFloat(runtime, value);
        GC.register(f, Handle.newHandle(runtime, f, handle));

        return f;
    }
View Full Code Here

        }
        return fixnum;
    }

    public final RubyFloat getFloat(ThreadContext context, int index, double value) {
        RubyFloat flote = floats[index];
        if (flote == null) {
            return floats[index] = RubyFloat.newFloat(context.runtime, value);
        }
        return flote;
    }
View Full Code Here

            int new_p = parseFloatInternal(p, pe);
            if (new_p == -1) {
                res.update(null, p);
                return;
            }
            RubyFloat number = createFloat(p, new_p);
            res.update(number, new_p + 1);
            return;
        }
View Full Code Here

TOP

Related Classes of org.jruby.RubyFloat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.