Sha256: 07060544f8cf3fbd41e588adcd7a6751700a6107fd3bc03a6ff11fa96861cf0d

Contents?: true

Size: 1.99 KB

Versions: 12

Compression:

Stored size: 1.99 KB

Contents

o:$YARD::CodeObjects::MethodObject:
@name:	to_s:@docstringIC:YARD::Docstring"ÐReturns a string containing a representation of self. As well as a
fixed or exponential form of the number, the call may return
``<code>NaN</code>'', ``<code>Infinity</code>'', and
``<code>-Infinity</code>''.
:@objectu:YARD::StubProxyFloat#to_s:
@summary0:	@all"ôReturns a string containing a representation of self. As well as a
fixed or exponential form of the number, the call may return
``<code>NaN</code>'', ``<code>Infinity</code>'', and
``<code>-Infinity</code>''.


@overload to_s
  @return [String]:@ref_tags[:
@tags[o:YARD::Tags::OverloadTag
;
u;Float#to_s;;;IC;	"
;
u;Float#to_s;0;
"@return [String];[;[o:YARD::Tags::Tag
;
0;0:@types["String:
@text":@tag_name"return;0:@parameters[;0:@signature"	to_s;"
overload:@current_file_has_commentsF:@scope:
instance;[:@docstring_extra0:@files[["numeric.c0:@namespaceu;
Float:
@path"Float#to_s;[:@visibility:public:@source"ï/*
 *  call-seq:
 *     flt.to_s    => string
 *
 *  Returns a string containing a representation of self. As well as a
 *  fixed or exponential form of the number, the call may return
 *  ``<code>NaN</code>'', ``<code>Infinity</code>'', and
 *  ``<code>-Infinity</code>''.
 */

static VALUE
flo_to_s(flt)
    VALUE flt;
{
    char buf[32];
    double value = RFLOAT(flt)->value;
    char *p, *e;

    if (isinf(value))
    return rb_str_new2(value < 0 ? "-Infinity" : "Infinity");
    else if(isnan(value))
    return rb_str_new2("NaN");

    sprintf(buf, "%#.15g", value); /* ensure to print decimal point */
    if (!(e = strchr(buf, 'e'))) {
    e = buf + strlen(buf);
    }
    if (!ISDIGIT(e[-1])) { /* reformat if ended with decimal point (ex 111111111111111.) */
    sprintf(buf, "%#.14e", value);
    if (!(e = strchr(buf, 'e'))) {
        e = buf + strlen(buf);
    }
    }
    p = e;
    while (p[-1]=='0' && ISDIGIT(p[-2]))
    p--;
    memmove(p, e, strlen(e)+1);
    return rb_str_new2(buf);
}:@source_type:c

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
pry-doc-0.4.4 lib/pry-doc/core_docs_18/objects/Float/to_s_i.dat
pry-doc-0.4.3 lib/pry-doc/core_docs_18/objects/Float/to_s_i.dat
pry-doc-0.4.2 lib/pry-doc/core_docs_18/objects/Float/to_s_i.dat
pry-doc-0.4.1 lib/pry-doc/core_docs_18/objects/Float/to_s_i.dat
pry-doc-0.4.0 lib/pry-doc/core_docs_18/objects/Float/to_s_i.dat
pry-doc-0.3.0 lib/pry-doc/core_docs_18/objects/Float/to_s_i.dat
pry-doc-0.2.4pre1 lib/pry-doc/core_docs_18/objects/Float/to_s_i.dat
pry-doc-0.2.3pre1 lib/pry-doc/core_docs_18/objects/Float/to_s_i.dat
pry-doc-0.2.1 lib/pry-doc/core_docs_18/objects/Float/to_s_i.dat
pry-doc-0.2.0 lib/pry-doc/core_docs_18/objects/Float/to_s_i.dat
pry-doc-0.1.5pre1 lib/pry-doc/core_docs_18/objects/Float/to_s_i.dat
pry-0.6.9pre1-i386-mingw32 lib/pry/core_docs_18/objects/Float/to_s_i.dat