Results for: "tally"

Create a new BigDecimal object.

initial

The initial value, as an Integer, a Float, a Rational, a BigDecimal, or a String.

If it is a String, spaces are ignored and unrecognized characters terminate the value.

digits

The number of significant digits, as an Integer. If omitted or 0, the number of significant digits is determined from the initial value.

The actual number of significant digits used in computation is usually larger than the specified number.

exception

Whether an exception should be raised on invalid arguments. true by default, if passed false, just returns nil for invalid.

Exceptions

TypeError

If the initial type is neither Integer, Float, Rational, nor BigDecimal, this exception is raised.

TypeError

If the digits is not an Integer, this exception is raised.

ArgumentError

If initial is a Float, and the digits is larger than Float::DIG + 1, this exception is raised.

ArgumentError

If the initial is a Float or Rational, and the digits value is omitted, this exception is raised.

Returns x/y or arg as a Rational.

Rational(2, 3)   #=> (2/3)
Rational(5)      #=> (5/1)
Rational(0.5)    #=> (1/2)
Rational(0.3)    #=> (5404319552844595/18014398509481984)

Rational("2/3")  #=> (2/3)
Rational("0.3")  #=> (3/10)

Rational("10 cents")  #=> ArgumentError
Rational(nil)         #=> TypeError
Rational(1, nil)      #=> TypeError

Rational("10 cents", exception: false)  #=> nil

Syntax of the string form:

string form = extra spaces , rational , extra spaces ;
rational = [ sign ] , unsigned rational ;
unsigned rational = numerator | numerator , "/" , denominator ;
numerator = integer part | fractional part | integer part , fractional part ;
denominator = digits ;
integer part = digits ;
fractional part = "." , digits , [ ( "e" | "E" ) , [ sign ] , digits ] ;
sign = "-" | "+" ;
digits = digit , { digit | "_" , digit } ;
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
extra spaces = ? \s* ? ;

See also String#to_r.

Evaluates the Ruby expression(s) in string. If binding is given, which must be a Binding object, the evaluation is performed in its context. If the optional filename and lineno parameters are present, they will be used when reporting syntax errors.

def get_binding(str)
  return binding
end
str = "hello"
eval "str + ' Fred'"                      #=> "hello Fred"
eval "str + ' Fred'", get_binding("bye")  #=> "bye Fred"

Returns a new array with the results of running block once for every element in enum.

If no block is given, an enumerator is returned instead.

(1..4).map { |i| i*i }      #=> [1, 4, 9, 16]
(1..4).collect { "cat"  }   #=> ["cat", "cat", "cat", "cat"]

Returns first n elements from enum.

a = [1, 2, 3, 4, 5, 0]
a.take(3)             #=> [1, 2, 3]
a.take(30)            #=> [1, 2, 3, 4, 5, 0]

Computes the arctangent of decimal to the specified number of digits of precision, numeric.

If decimal is NaN, returns NaN.

BigMath.atan(BigDecimal('-1'), 16).to_s
#=> "-0.785398163397448309615660845819878471907514682065e0"

Determines the equality of two numbers by comparing to zero, or using the epsilon value

Enables coverage measurement.

Convert self to locale encoding

Convert self to locale encoding

Returns self, for backward compatibility.

Returns true if the named file is writable by the effective user and group id of this process. See eaccess(3).

Returns true if the named file is executable by the effective user and group id of this process. See eaccess(3).

Returns true if the named files are identical.

file_1 and file_2 can be an IO object.

open("a", "w") {}
p File.identical?("a", "a")      #=> true
p File.identical?("a", "./a")    #=> true
File.link("a", "b")
p File.identical?("a", "b")      #=> true
File.symlink("a", "c")
p File.identical?("a", "c")      #=> true
open("d", "w") {}
p File.identical?("a", "d")      #=> false

Initiates garbage collection, unless manually disabled.

This method is defined with keyword arguments that default to true:

def GC.start(full_mark: true, immediate_sweep: true); end

Use full_mark: false to perform a minor GC. Use immediate_sweep: false to defer sweeping (use lazy sweep).

Note: These keyword arguments are implementation and version dependent. They are not guaranteed to be future-compatible, and may be ignored if the underlying implementation does not support them.

Returns a Hash containing information about the GC.

The hash includes information about internal statistics about GC such as:

{
    :count=>0,
    :heap_allocated_pages=>24,
    :heap_sorted_length=>24,
    :heap_allocatable_pages=>0,
    :heap_available_slots=>9783,
    :heap_live_slots=>7713,
    :heap_free_slots=>2070,
    :heap_final_slots=>0,
    :heap_marked_slots=>0,
    :heap_eden_pages=>24,
    :heap_tomb_pages=>0,
    :total_allocated_pages=>24,
    :total_freed_pages=>0,
    :total_allocated_objects=>7796,
    :total_freed_objects=>83,
    :malloc_increase_bytes=>2389312,
    :malloc_increase_bytes_limit=>16777216,
    :minor_gc_count=>0,
    :major_gc_count=>0,
    :remembered_wb_unprotected_objects=>0,
    :remembered_wb_unprotected_objects_limit=>0,
    :old_objects=>0,
    :old_objects_limit=>0,
    :oldmalloc_increase_bytes=>2389760,
    :oldmalloc_increase_bytes_limit=>16777216
}

The contents of the hash are implementation specific and may be changed in the future.

This method is only expected to work on C Ruby.

Returns the elapsed real time used to execute the given block.

Returns the elapsed real time used to execute the given block.

The path to the data directory specified by the gem name. If the package is not available as a gem, return nil.

Returns the tangent of z, where z is given in radians

CMath.tan(1 + 1i) #=> (0.27175258531951174+1.0839233273386943i)

Returns the hyperbolic tangent of z, where z is given in radians

CMath.tanh(1 + 1i) #=> (1.0839233273386943+0.27175258531951174i)

Returns the arc tangent of z

CMath.atan(1 + 1i) #=> (1.0172219678978514+0.4023594781085251i)

returns the arc tangent of y divided by x using the signs of y and x to determine the quadrant

CMath.atan2(1 + 1i, 0) #=> (1.5707963267948966+0.0i)

returns the inverse hyperbolic tangent of z

CMath.atanh(1 + 1i) #=> (0.4023594781085251+1.0172219678978514i)

Returns the tangent of z, where z is given in radians

CMath.tan(1 + 1i) #=> (0.27175258531951174+1.0839233273386943i)
Search took: 2ms  ·  Total Results: 1371