Description
Given a decimal decimal x, determine whether the binary representation of x is finite.
For example, the binary representation of the 0.5 is the binary representation of the 0.1,0.75 is that the 0.11,0.3 does not determine a finite binary representation.
input
The first line contains an integer T (1≤t≤10) that represents the number of groups to test the data.
The following T lines contain a
A fact that violates intuitionThe computer is called "Computing" machine is because it is mainly used to calculate the invention, "calculation" of course is its expertise, in everyone's impression, the calculation must be very accurate. But in fact, even in some very basic decimal operations, the results of the calculations are imprecise.Like what:
float F = 0.1f*0.1f;
System.out.println (f);
The result seems to be self-evident, it s
Decimal type
As a supplement, the decimal type is used to represent high precision floating-point numbers
Name
CTS Type
De script ion
Significant figures
Range (approximate)
Decimal
1. Binary number, octal number, hexadecimal decimal number
There is a formula: binary number, octal number, hexadecimal number of the numbers of the number of each of the respective cardinality of the (N-1) of the second party, and the sum is the corresponding decimal number. Single digit, n=1 10, n=2 ... for example:
The 0 =0+4+2+0=6d of the 1 110b=1*2 of the +1*2 of the 2-time Square +0*2 of the two side
Problem:Customer requirements, with the amount of data related to print out to retain two decimal places, such as: 13.2/13.200 to display as 13.20;Analysis:First look at the data in the database definition, all decimal (12,2), directly through the database query results will also retain two decimal places, but after the code processing, it will ignore the last "0
Binary, octal, decimal, hexadecimal conversion, binary hexadecimal1. Preface
The most boring thing during each holiday is that you don't want to get up or eat. Founder just doesn't want to move, lie in bed, watch the mobile phone, and brush QQ space bored. Although few people are playing QQ space now, however, this kind of habit has never changed until now, and the QQ on the computer is suddenly flashing. I know it's the QQ message sent by Uncle Ding,
About several oracle functions () Processing decimal places 1. Take the rounded decimal places selectround (1.2345, 3) fromdual; Result: 1. 2352. retain two decimal places,
About several oracle functions () Processing decimal places 1. Take the rounded decimal places select
Given integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part was repeating, enclose the repeating part in parentheses.For example,Given numerator = 1, denominator = 2, return "0.5". Given numerator = 2, denominator = 1, return "2". Given numerator = 2, denominator = 3, return "0. (6) ".Analysis: 1190000003794677The complexity of hash table methodTime O (n) space O (n)IdeasThe integer part is good to deal with, as long as the
Supplement: C # implements binary, octal, 10hexadecimal, and hexadecimal conversion freely.
In. NET FrameworkThe system. Convert class provides comprehensive conversion functions between various types and values. Two of these methods can be used to easily convert various hexadecimal values:
convert. toint32 (string value, int frombase) :
You can convert strings of different hexadecimal values to numbers. The frombase parameter is in the hexadecimal format and can only be 2, 8, 10, or 16:
Precision: the total number of digits in the decimal place, including the digits on the left and right of the decimal point. The precision must be between 1 and 38. The default precision is 18.Decimal places: the maximum number of digits in decimal places that can be stored on the right of the
Decimal (numeric), money, and float (real) are all floating point data types in MSSQL.
Sort by storage range
Float (real)
Decimal (numeric)
Money
You can give priority to money on the amount of storage. If the amount is too large, use decimal (numeric). In extreme cases (data is too large), use float (real)
Money and float do not automatically d
C # conversion between decimal and binary, hexadecimal, and octal,
1. Convert decimal to binary
After dividing the decimal number by 2, you can enter all the remainder into two parts to obtain the required binary data.
Public static string DecimalToBinary (int vDecimal) {/* divide the decimal number vDecimal by 2, take
Unit of the financial mm has been Super Praise Excel 2003 is a powerful good dongdong. However, once the decimal input is encountered, she will also call "trouble". Because this involves not only the number of input, but also involves the decimal point of input, especially in the Chinese input state, it is easy to lose the decimal point into a period. Here are tw
The example of this article for Java reserved two decimal questions for everyone to answer for your reference, the specific contents are as follows
Mode one:
Rounded
Double f = 111231.5585;
BigDecimal B = new BigDecimal (f);
Double f1 = B.setscale (2, bigdecimal.round_half_up). Doublevalue ();
Mode one this class solves the problem of mode three very well.
Keep two decimal dig
1, round (X,D): For data rounding, round (x), in fact, is round (x,0), also is the default d is 0;One of the notable points here is that D can be a negative number, when the D-bit integer bit to the left of the specified decimal point is 0, and the decimal places are 0;SELECT ROUND (100.3465,2), ROUND (100,2), ROUND (0.6,2), ROUND (114.6,-1);Results were: 100.35,100,0.6,1102. TRUNCATE (x,d): The function re
Label:When I recently worked on a project, I defined decimal as decimal (5,2) and waited until the biggest result was 999.99, and found a lot of places where the bug was not found.Insert very updated data is correct and the result is 999.99, finally know the meaning of the parameters in the decimal bracketsDecimal (5,2)5 is the fixed-point precision, and 2 is the
Description of the meaning of N and M in MySQL Data Type DECIMAL (N, M), mysqldecimal
My colleague asked me what the meaning of N and M in the MySQL Data Type DECIMAL (N, M). Needless to say, M is obviously the DECIMAL place, but is N the maximum number of digits before the decimal point or the maximum number of digits
1. IntroductionDefault, floating point math lacks precisionThe decimal module provides a decimal data type for floating-point calculation. Implementation of float compared to built-in binary floating-point numbers This type helps financial applications and other occasions where precise decimal expression is required, control accuracy, control rounding to suit
. In the following course about hexadecimal conversion, you can find this point.
6.2 convert binary number to decimal number 6.2.1 convert to decimal number
0th bits in binary are 0 to the power of 2, and 1st bits are 1 to the power of 2 ......
Therefore, there is a binary number: 0110 0100, which is converted to a 10-digit system:
The following is a vertical layout:
0110 0100 to
One, to complete this operation requires a ruler assist. If the ruler is not displayed in the PowerPoint interface, select the View menu card from the Ribbon menu and check the ruler to display the ruler.
Show Ruler
Second, select the number you want to align the decimal point, and then in the upper-left corner of the ruler, click the button continuously (shown in the red box below) until the decimal
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.