The world without the literal notation for floating-point numbers
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

The world without the literal notation for floating-point numbers

  • 1,745 views
Uploaded on

We need the decimal-point literal notation for Rational instead of Float because Float is legacy.

We need the decimal-point literal notation for Rational instead of Float because Float is legacy.

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,745
On Slideshare
1,603
From Embeds
142
Number of Embeds
2

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 142

http://d.hatena.ne.jp 90
http://coderwall.com 52

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. The world without the literal notation for floating-point numbers , Kenta Murata GeneticLab Co., Ltd.Tuesday, July 19, 2011 1
  • 2. CRuby Committer (BigDecimal) Ruby Sapporo Kosen Confhttp://www.flickr.com/photos/koichiroo/5244581973/Tuesday, July 19, 2011 2
  • 3. Tuesday, 12010 3 July 19, 2011 3
  • 4. RubyKaigi n !!Tuesday, 12010 3 July 19, 2011 4
  • 5. Ruby 04 Sapporo RubyKaigi 04 Summer 2012Tuesday, July 19, 2011 5
  • 6. I have some question.Tuesday, July 19, 2011 6
  • 7. Do you use Float values?Tuesday, July 19, 2011 7
  • 8. Do you understand Float well?Tuesday, July 19, 2011 8
  • 9. Float is too difficult.Tuesday, July 19, 2011 9
  • 10. Reading difficultyTuesday, July 19, 2011 10
  • 11. ruby-1.9.2-p290 :001 > 76287755398823936.0 => 76287755398823940.0 ruby-1.9.2-p290 :002 >Tuesday, July 19, 2011 11
  • 12. Comparing difficultyTuesday, July 19, 2011 12
  • 13. ruby-1.9.2-p290 :001 > 12.4 * 1.05 == 13.02 => false ruby-1.9.2-p290 :002 > 12.4 * 1.05 => 13.020000000000001 ruby-1.9.2-p290 :003 >Tuesday, July 19, 2011 13
  • 14. Representation differenceTuesday, July 19, 2011 14
  • 15. Human: Decimal Internal: BinaryTuesday, July 19, 2011 15
  • 16. Concept differenceTuesday, July 19, 2011 16
  • 17. We think Float is a number.Tuesday, July 19, 2011 17
  • 18. It is real that Float is a range.Tuesday, July 19, 2011 18
  • 19. They’re troublesomeTuesday, July 19, 2011 19
  • 20. There is a solutionTuesday, July 19, 2011 20
  • 21. Why not use Rational.Tuesday, July 19, 2011 21
  • 22. It is difficult, too.Tuesday, July 19, 2011 22
  • 23. Ruby doesn’t have any literal notations for RationalTuesday, July 19, 2011 23
  • 24. Does a fractional notation solve the problems?Tuesday, July 19, 2011 24
  • 25. No!Tuesday, July 19, 2011 25
  • 26. We naturally use decimal point notation.Tuesday, July 19, 2011 26
  • 27. We need a decimal- point notation for representing a Rational.Tuesday, July 19, 2011 27
  • 28. ruby--p290 :001 > 13.02.class => Rational ruby--p290 :001 > 12.4 * 1.05 == 13.02 => true ruby-1.9.2-p290 :002 > 12.4 * 1.05 => 13.02 ruby-1.9.2-p290 :003 > 13.02 / 3 => (217/50)Tuesday, July 19, 2011 28
  • 29. Do you worry about Rational is slow?Tuesday, July 19, 2011 29
  • 30. We can optimize for denominators of 10nTuesday, July 19, 2011 30
  • 31. Float isn’t as so fast as you thinkTuesday, July 19, 2011 31
  • 32. If you need fast Float calculationTuesday, July 19, 2011 32
  • 33. Write it in C as extension libraryTuesday, July 19, 2011 33
  • 34. If you need to calculate with arrays of FloatTuesday, July 19, 2011 34
  • 35. Use NArrayTuesday, July 19, 2011 35
  • 36. Rational may be what you wantTuesday, July 19, 2011 36
  • 37. This talk’s background, demonstrations, and more detail descriptionsTuesday, July 19, 2011 37
  • 38. Tuesday, July 19, 2011 38