Step-by-step learning Ruby (7): mathematical expression

2009-09-23  来源:本站原创  分类:Ruby  人气:464 

We know that in the bottom of the computer is completely based on the data, we have prepared procedures for operation data.

Expression is understood to be the number of computers, operator of the joint variables. For example, add, subtract, multiply, divide and so on, this and other languages, the following expressions are

Step-by-step learning Ruby (7): mathematical expression

Here we pay attention to language and other differences between the 10 / 2,10 / 2.0 difference, Ruby only when there is a regular expression is float, the result is the floating-point numbers

Step-by-step learning Ruby (7): mathematical expression

0 / 0 would be reported to an exception, but the results of 0.0/0.0 is NaN

Step-by-step learning Ruby (7): mathematical expression

Negative operation

Step-by-step learning Ruby (7): mathematical expression

** Operator, power calculation, as well as the power of root

Step-by-step learning Ruby (7): mathematical expression

Joint calculations, from right to left

** Priority than high priority +,-,*,/

Integer can be very large, but the floating-point numbers can not be greater than Float:: MAX

Step-by-step learning Ruby (7): mathematical expression

Step-by-step learning Ruby (7): mathematical expression

Abbreviated form of x + = y and x = x + y

Step-by-step learning Ruby (7): mathematical expression

Floating-point

Because the floating-point values are accurate, so we are approximations, see the following code

Step-by-step learning Ruby (7): mathematical expression

The author of this article: Wang water

相关文章
  • Step-by-step learning Ruby (7): mathematical expression 2009-09-23

    We know that in the bottom of the computer is completely based on the data, we have prepared procedures for operation data. Expression is understood to be the number of computers, operator of the joint variables. For example, add, subtract, multiply,

  • Step-by-step learning Ruby (8): string expression 2009-09-23

    Ruby, the built-in many ways the operation of the string the following, we take a look at some of the most important methods Connection string Multiplication can be done on the string String Comparison In fact, we know that the string is stored in th

  • Step by step learning Samba Linux and Windows shared files 2010-09-21

    [Taken from] http://www.linuxsir.org/main/?q=node/158 Step by step learning Linux and Windows shared files Samba (v0.2b) <! - Begin content -> Analysis: North South North, is on the increase in the ... ... need your participation; From: LinuxSir.Org

  • oracle stored procedure step by step learning 2011-01-19

    Learning step by step storage procedure: 1 Introduction to learning the stored procedure: - Create a simple stored procedure create or replace procedure testPro is begin Dbms_Output.put_line ('hello word! This is first produce'); end; 2 .-- Create a

  • Linux step by step learning (update frequency: finished) the entry to the power of Linux video tutorials! 2011-09-15

    LAMP Linux worth 2,000 yuan Band of Brothers video tutorial released! Li-known Linux expert speaker! Full study data sharing (video tutorial + slide + software + code + examples + exercises self-test questions)! Gradual farewell to explain to you the

  • In debian (ubuntu) on the establishment of the Ruby on Rails development environment step by step 2009-07-18

    1, Introduction Recently, learning Ruby on Rails, development environment in the establishment of a time when a lot of problems encountered, their steps are now posted up tight for reference, to help novice are small detours; any inappropriate, welco

  • Learning step by step Spring 2011-01-01

    Step by step starting from the demo to learn, Spring, come In accordance with the Java coding conventions, the first write interfaces HelloWorldService /** * @ClassName: HelloWorldService * @Description: The first example Service interface * @author

  • Rails 2.0 step by step [translated statement Translate] 2009-03-21

    Rails 2.0 step by step Rails core team in the December 7 release of the Ruby on Rails 2.0. At this version includes a lot of changes, including Rails scaffold code generation approach. This change may be under the old version will make use of the cur

  • Error step by step, layers of analysis - tns error analysis of some common examples of 2010-07-03

    Quote TNS-12514: TNS: listener does not recognize the current request to connect the service descriptor TNS-12541: TNS: no listener in oracle applications, tns-xxxxx this error in our application is very common. tns-xxxxx errors and database connecti

  • eclipse, and step into step over step return difference 2010-10-27

    First, about what the step into step over step return of the differences: step into that step, and continue to experience sub-functions to step into; (F5) step over step in when faced Functions within a function does not enter the sub-functions withi

  • Step by step learn the Basics Data Guard 2011-01-20

    It has numerous names, some call dg, some people call it Data Guard, some call data guard, the oracle of the features in the full light it has held the position of management, it is (applause )...... ................ Oracle Data Guard. For me, I have

  • Step-by-step learning Ruby (13): Ruby module 2009-09-23

    Class is subclass of Module, is a special form of modules, this can look at my article Step-by-step learning Ruby (5): Class, Module, Object, Kernel relationship . We know that the top of the class is Object, then the top of the module is the Kernel

  • Step by step to learn spring (1) - spring Getting Started Example 2010-03-18

    To learn spring, first of all, the first erected in the example of a spring, and then run up and spring in the end to understand what is using what and why to use spring and so on. First, the use of IoC features spring to build up a step by step exam

  • Started learning Ruby 2010-04-02

    Ready to start learning Ruby it!

  • Django Step by Step (6) error correction 2010-04-08

    Django Step by Step (VI) from django.db import models # Create your models here. class Wiki (models.Model): pagename = models.CharField (maxlength = 20, unique = True) content = models.TextField () Run-time error prompted: __init__ () got an unexpect

  • Django step by step the sixth amendment to the small error and knowledge about points 2010-04-13

    In the sixth step by step to learn about when, in the operation that the new wiki of the app finished, the modified model.py this document, from django.db import models # Create your models here. class Wiki(models.Model): pagename = models.CharField(

  • Install Windows XP using USB Flash Disk / Flash Drive - Step by Step Guide 2010-07-16

    http://komku.blogspot.com/2008/11/install-windows-xp-using-usb-flash-disk.html Someone in this post ( Acer Aspire One Specifications and Windows XP Drivers ) Ask me to Write a tutorial about How to install Windows XP using USB Flash Disk / Flash driv

  • Transfer: Debug Native c / c + + Application for Android (Step by Step) 2010-07-19

    Debug Native c / c + + Application for Android (Step by Step) Debugging Android on the c / c + + program has been a problem, I used to rely on the output log to solve the problem, for a little more tricky project, which is almost an impossible task,

  • jQuery step by step, cross-browser can edit the form, support IE.Firefox.Safari 2010-08-19

    Editable forms to achieve the function, we must address the following issues: 1. Clear the data to modify what columns in the table (how to find these cells); 2. How do cells become editable; 3. How to deal with some key events cell; 4. To resolve cr

  • Submit the form step by step solution 2010-10-13

    Have only heard this stuff before, is now himself to do this, and do also have heard before, great to pop in two ways. The first is: div hidden method This approach is self-evident, will you have to deal with the forms step by step into the correspon