numbers

How to expand decimal places of a number to a minimum in Oracle PLSQL?

久未见 提交于 2019-12-23 12:35:01
问题 I cant figure out how to select the following: 123 -> 123.00000 123.12 -> 123.12000 123.123456 -> 123.123456 I would like to expand the number of decimal places to for example 5 decimal places (minimum) If there are no decimal places at all there should be 5 zeros. It is fine if there are more then 5 decimal places. SELECT ROUND(123,5) FROM DUAL; will result: 123 instead of 123.00000 The number has a default precision. Is this possible or should I convert it to a varchar with the oracle

JavaScript: why does bitwise OR of booleans return a number instead of a boolean?

99封情书 提交于 2019-12-23 12:08:17
问题 I found out the hard way that bitwise operators on bools don't return bools in JavaScript. I thought it must be a bug, but I looked it up in the ECMAScript spec, and sure enough, it says that the bitwise operators return numbers, not bools. It doesn't say a word about the weirdness that results when you're using them on boolean values. Why is it done this way? I've used this technique for years in other languages, so I'm totally baffled why it does something different in JavaScript. Any ideas

Firefox does not allow decimals in input[type=number]

这一生的挚爱 提交于 2019-12-23 11:54:51
问题 I encountered some strange behavior in Firefox. I have a simple input[type=number] field and when I try to type a decimal value in it (e.g. 4.5), the browser puts an ugly red border around my input. <input type="number" /> How can I fix this and override this stupid behavior of Firefox? See jsFiddle 回答1: If you set a step="0.01" , then the border disappears. The number type has a step value controlling which numbers are valid (along with max and min), which defaults to 1. This value is also

Is there a number “value equals”?

混江龙づ霸主 提交于 2019-12-23 10:56:58
问题 By default, Java does Binary Numeric Promotion for primitives, but does not do the same thing for objects. Here's a quick test to demonstrate: public static void main(String... args) { if(100 == 100L) System.out.println("first trial happened"); if(Integer.valueOf(100).equals(Long.valueOf(100))) { System.out.println("second trial was true"); } else { System.out.println("second trial was false"); } if(100D == 100L) System.out.println("third trial, fun with doubles"); } Output: first trial

Validating my money

徘徊边缘 提交于 2019-12-23 10:52:14
问题 I am having some trouble validating a money input. I have used some pointers from my other questions to write some better code. The following is what I'm using to validate whether or not the input is money. static void Main(string[] args) { string myTest1 = "$1,234.56"; string myTest2 = "$1.00"; string myTest3 = "$1000.01"; string myTest4 = "$1,234,567.89"; myIsMaybeMoneyValidator Miimv = new myIsMaybeMoneyValidator(); bool myResult1 = Miimv.isMaybeMoney(myTest1); bool myResult2 = Miimv

Most efficient way to extract all the (natural) numbers from a string

☆樱花仙子☆ 提交于 2019-12-23 10:41:28
问题 Users may want to delimit numbers as they want. What is the most efficient (or a simple standard function) to extract all the (natural) numbers from a string? 回答1: You could use a regular expression. I modified this example from Sun's regex matcher tutorial: import java.util.regex.Pattern; import java.util.regex.Matcher; public class Test { private static final String REGEX = "\\d+"; private static final String INPUT = "dog dog 1342 dog doggie 2321 dogg"; public static void main(String[] args

Most efficient way to extract all the (natural) numbers from a string

北城余情 提交于 2019-12-23 10:40:05
问题 Users may want to delimit numbers as they want. What is the most efficient (or a simple standard function) to extract all the (natural) numbers from a string? 回答1: You could use a regular expression. I modified this example from Sun's regex matcher tutorial: import java.util.regex.Pattern; import java.util.regex.Matcher; public class Test { private static final String REGEX = "\\d+"; private static final String INPUT = "dog dog 1342 dog doggie 2321 dogg"; public static void main(String[] args

Why does AtomicInteger implements Serializable

。_饼干妹妹 提交于 2019-12-23 09:25:39
问题 Accoriding to javadoc, public class AtomicInteger extends Number implements java.io.Serializable { // code for class } But, public abstract class Number implements java.io.Serializable { //code for class } If Number class already implements java.io.Serializable then why do AtomicInteger implements it again? Edit: Does Serializable being a marker interface makes any difference in this context? 回答1: Just to document it more clearly. Same situation with the abstract collection base classes.

Oracle Bankers rule

烂漫一生 提交于 2019-12-23 09:25:38
问题 Why Oracle is not using Bankers rule (the rounding method)? 回答1: Accurate decimal arithmatic is a large and complex subject. Google 'mike colishaw decimal rounding' if you want to read the ahem Oracle on the subject. Basically there are many rounding schemes which are possible:- Round everthing down - the default in most languages including C as Oracle is written in C this is probably why they do this. Round everything up - rarely seen but occasionally needs to be implemented because of

Numbers localization in desktop applications

我只是一个虾纸丫 提交于 2019-12-23 07:46:08
问题 In the number decimal category of Unicode, 460 decimal characters are defined (see this page for some examples). Unfortunately I could not find any character representing a digit regardless of its appearance. As a result, currently only Western Arabic numeral characters are understood by most software as digits. So you can not for example enter other number characters in the MS Excel. If Unicode had (at least) 10 code for digits 0 to 9 as pure numbers, not a glyph, we could use them in almost