My presentation in RubyConf 2011.
You can see the description at http://rubyconf.org/presentations/33
You can get the implementation proposed this presentation from https://github.com/mrkn/ruby/tree/decimal_rational_implementation
校内勉強会のススメ An encouragement to hold workshops In your schoolKenta Murata
Kenta Murata is a programmer from Sapporo, Japan who loves the programming language Ruby. He runs a genetic algorithm lab and shares photos on Flickr of his work with Ruby. Some of his photos show Ruby code and others show the outputs of genetic algorithms he has created with Ruby.
Introduction to ATDD with Cucumber and RSpecKenta Murata
This document discusses an introduction to acceptance test-driven development (ATDD) using Cucumber and RSpec. It explains that ATDD involves collaborating with stakeholders to write automated acceptance tests before development begins. The tests describe features and scenarios in a way that stakeholders can understand. Cucumber uses a plain language format to define tests and map them to code via step definitions. RSpec is also used for unit testing. The document provides examples of Cucumber feature files and touches on integrating Cucumber with RSpec during the development process.
The world without the literal notation for floating-point numbersKenta Murata
The document discusses the difficulties of using floating point numbers (Floats) in Ruby and proposes using Rational numbers instead. Some key issues mentioned are that Floats are represented internally as binary which can lead to representation errors, they describe a range rather than a specific number, and calculations with Floats may not be equal due to rounding errors. As an alternative, Rational numbers represented using a decimal notation could solve these problems, though they may be slower. Overall the document argues that Rational is a better fit than Float for many use cases in Ruby.
The document discusses the difficulties of using floating point numbers (Floats) in Ruby and proposes using Rational numbers instead. Some key points made include:
- Floats are stored internally as binary which can lead to representation errors, while we think of them as decimal numbers
- Floats actually represent a range of values rather than a single number
- Using Rational would allow keeping numbers as exact fractions, avoiding errors from Float representations
- While Rational may seem slower, optimizations are possible for common denominators and FastMath libraries could be used for Floats if needed
Let's begin Behavior Driven Development using RSpecKenta Murata
The document contains snippets of Ruby code and discussions around test-driven development (TDD) and behavior-driven development (BDD). It includes code examples using RSpec to test an AgeCalculator class, discussions of gems like rspec and test frameworks like Test::Unit. It also covers observer pattern and use of test doubles in RSpec tests. Live coding examples are presented on FizzBuzz implementation using TDD and RSpec best practices.
The document discusses the future of Ruby's bigdecimal library and number system. It outlines some current problems with BigDecimal including its use of global modes, lack of automatic precision tracking, and limitations on instance generation. It suggests improvements could be made to calculation speeds by implementing more advanced algorithms. Additionally, a new class is needed to represent irrational numbers as computable algorithms rather than decimal approximations.
The document shows equations for calculating entropy (S) when transferring heat (dQ) between systems at temperature (T). It introduces entropy for system B (S(B)) as dependent on entropy of system A (S(A)) and heat transfer over temperature. It then illustrates this relationship between two systems A and B connected to a third system C, with the total entropy change equaling zero when heat is transferred between any two systems.
Let's begin Behavior Driven Development using RSpecKenta Murata
The document contains snippets of Ruby code and discussions around test-driven development (TDD) and behavior-driven development (BDD). It includes code examples using RSpec to test an AgeCalculator class, discussions of gems like rspec and test frameworks like Test::Unit. It also covers observer pattern and use of test doubles in RSpec tests. Live coding examples are presented on FizzBuzz implementation using TDD and RSpec best practices.
The document discusses the future of Ruby's bigdecimal library and number system. It outlines some current problems with BigDecimal including its use of global modes, lack of automatic precision tracking, and limitations on instance generation. It suggests improvements could be made to calculation speeds by implementing more advanced algorithms. Additionally, a new class is needed to represent irrational numbers as computable algorithms rather than decimal approximations.
The document shows equations for calculating entropy (S) when transferring heat (dQ) between systems at temperature (T). It introduces entropy for system B (S(B)) as dependent on entropy of system A (S(A)) and heat transfer over temperature. It then illustrates this relationship between two systems A and B connected to a third system C, with the total entropy change equaling zero when heat is transferred between any two systems.