What variable type to use??

i need to perform calculations on various numbers ranging from 0 to as big as possible.i also need to perform divide operations on these numbers and i need the result to be very accurate including decimal points.
example: (24 * 1000000) \ 35250
what type should i declare these numbers as??
i have tried BigDecimal but it always rounds the result to a whole number??

BigDecimal setScale throws an ArithmeticExpression exception if roundingMode==ROUND_UNNECESSARY and the specified scaling operation would require rounding.
since my calculations would give results with many numbers after decimal point would it require rounding??

Similar Messages

  • What Variables have been used in a Query???

    Hi All,
      how can i find out what variables are being used by a particular standard query in Query Designer level. When we open a query in query designer on the left panel expanding a characteristic we can see what are the available variables in that characteristic for the InfoProvider but i want to know among them which are being used by that query in designer level without going to analyzer.
    Thanks,
    Pritam.

    Hi Pritam,
    You need to use three tables to obtain this informaiton:
    1. rszglobv - List of All the variables
    2. rszetlxref - Cross reference between global variables and query name
    3. rszcomdir - Query Name
    Here is a sample program to obtian this info:
    REPORT  ZLIST_OF_VAR_4_QUERY.
    TABLES: RSZCOMPDIR.
    SELECT-OPTIONS: S_QUERY FOR RSZCOMPDIR-COMPID NO INTERVALS.
    TYPES: BEGIN OF ty_query,
      COMPID type RSZCOMPDIR-COMPID,
      vnam type rszglobv-vnam,
      end of ty_query.
    data: t_query TYPE TABLE OF ty_query.
    SELECT ACOMPID CVNAM
    INTO TABLE t_query
    FROM RSZCOMPDIR as a
      INNER JOIN rszeltxref as b
      on ( acompuid = bseltuid )
      INNER JOIN rszglobv as c
      on ( bteltuid = cvaruniid )
    where a~objvers = 'A'
      and c~objvers = 'A'
      and a~compid in s_query.
    You can output the data from the internal table t_query any way you want it.
    Cheers,
    Vasu Sattenapalli

  • What data type is used for storing password,

    What data type is used for storing pass word in oracle db, i mean if user inputs some thing from forms it should be in Encrypted form in db, please any help??
    Thank you
    Hina

    Data type is VARCHAR2:
    SQL> desc dba_users;
    Name                                      Null?    Type
    USERNAME                                  NOT NULL VARCHAR2(30)
    USER_ID                                   NOT NULL NUMBER
    PASSWORD                                           VARCHAR2(30)
    ACCOUNT_STATUS                            NOT NULL VARCHAR2(32)
    LOCK_DATE                                          DATE
    EXPIRY_DATE                                        DATE
    DEFAULT_TABLESPACE                        NOT NULL VARCHAR2(30)
    TEMPORARY_TABLESPACE                      NOT NULL VARCHAR2(30)
    CREATED                                   NOT NULL DATE
    PROFILE                                   NOT NULL VARCHAR2(30)
    INITIAL_RSRC_CONSUMER_GROUP                        VARCHAR2(30)
    EXTERNAL_NAME                                      VARCHAR2(4000)
    PASSWORD_VERSIONS                                  VARCHAR2(8)
    EDITIONS_ENABLED                                   VARCHAR2(1)
    AUTHENTICATION_TYPE                                VARCHAR2(8)You can use SQL function ORA_HASH to hash password: http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions124.htm#SQLRF06313.

  • What connector type is used to plug a guitar into the iPad?  Does it connect to the earphone jack?

    What connector type is used to plug a guitar into an iPad?  Does it connect to the earphone jack?

    Actually you can get something like this from your local mac store. http://www.ikmultimedia.com/products/irig/ It plugs right into the earphone jack and works fine (I own this model and it works well on the go). For my actual mac, I use a Monster iStudioLink, which I have heard will work with the iPad 2 (but with some bugs - see the comments on the Monster website) http://www.monstercable.com/productdisplay.asp?pin=2440

  • What message type to use for syndicating data back to R3 from XI

    What message type to use for syndicating data back to R3 from XI. It gives a Message type IDOC error code 51.

    Hi Rehman,
    You are getting error 51 which means "Error: Application document not posted".
    This might because of two reasons:
    1. Your IDoc doesn't contains all the mandatory fields required by the inbound function module to post the IDoc.
    2. You have assigned wrong inbound function module to post the IDoc.
    Please check these cases.
    Hope this will help you.
    Thanks,
    Shiv Prashant Dixit

  • What are type defs used for?

    I am learning about type defs and wanted to ping the community to get a feel for what expanse of things they are useful for.  Any and all comments are welcome.
    Cheers!
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

    I found this (from LV Help) enlightening as to the differences between typedefs and strict typedefs:
    Type Definitions and Strict Type Definitions
    Use type definitions and strict type definitions to link all the instances of a custom control or indicator to a saved custom control or indicator file. You can make changes to all instances of the custom control or indicator by editing only the saved custom control or indicator file, which is valuable if you use the same custom control or indicator in several VIs.
    Type Definitions
    Type definitions identify the correct data type for each instance of a custom control or indicator. When the data type of a type definition changes, all instances of the type definition automatically update. In other words, the data type of the instances of the type definition change in each VI where the type definition is used. However, because type definitions identify only the data type, only the values that are part of the data type update. For example, on numeric controls, the data range is not part of the data type. Therefore, type definitions for numeric controls do not define the data range for the instances of the type definitions. Also, because the item names in ring controls do not define the data type, changes to ring control item names in a type definition do not change the item names in instances of the type definition. However, if you change the item names in the type definition for an enumerated type control, the instances update because the item names are part of the data type. An instance of a type definition can have its own unique label, description, default value, size, color, or style of control or indicator, such as a knob instead of a slide.
    If you change the data type in a type definition, LabVIEW converts the old default value in instances of the type definition to the new data type, if possible. LabVIEW cannot preserve the instance default value if the data type changes to an incompatible type, such as replacing a numeric control or indicator with a string control or indicator. When the data type of a type definition changes to a data type incompatible with the previous type definition, LabVIEW sets the default value of instances to the default value for the new data type. For example, if you change a type definition from a numeric to a string type, LabVIEW replaces any default values associated with the old numeric data type with empty strings.
    Strict Type Definitions
    A strict type definition forces everything about an instance to be identical to the strict type definition, except the label, description, and default value. As with type definitions, the data type of a strict type definition remains the same everywhere you use the strict type definition. Strict type definitions also define other values, such as range checking on numeric controls and the item names in ring controls. The only VI Server properties available for strict type definitions are those that affect the appearance of the control or indicator, such as Visible, Disabled, Key Focus, Blinking, Position, and Bounds.
    You cannot prevent an instance of a strict type definition from automatically updating unless you remove the link between the instance and the strict type definition.
    LabVIEW 8.0.1; WinDoze XP
    aut viam inveniam aut faciam

  • What MIME type to use for DNG?

    Is there an 'official' MIME type to use for DNG? I've seen image/x-adobe-dng used, also image/tiff, and sometimes image/x-dcraw. I'd like to know so that I can characterize DNGs correctly for format identification software we are writing. I don't believe the MIME type is specified in the DNG spec. Thanks.

    I think this is clear
    image/x-adobe-dng = DNG
    image/tiff = for tiff images. I know that Phase One gives there RAW images .tif at the end but tiff sould be a real image.
    image/x-dcraw = for other camera raw files like CRW/CR2 of Canon, NEF of Nikon....
    I would suggest to use the "image/x-adobe-dng" for DNG files.

  • What variable type for database

    Hi to all..
    I would like to ask advice on what is the best type of variable to store and manage data. I am basically trying to build a small database of customer, names, address, tel number etc. The data is read and then saved into a simple excel or csv file. All is run locally, no need to connect to the web etc..
    I had started with a two dimensional array, but then I realise that I cannot Re-dim the array, as records are added or deleted. So I found something called Arraylist, but I have problem in working in two dimensions (maybe that's why it is called a list?).
    can anyone suggest what is the best structure for this, bearing in mind that the records are then shown in a jtable, as a list (with multiple columns).
    thanks for your help

    hey!!!
    suggestion of jverd (above) is a very good suggestion and you should hava a look at it. keeping the records in a seperate object would be the best. technically you can then make an array of those objects and then write them into file via ObejctOutputStream.
    but i think that what you want is to have the data in a 2-dimensional array so you can then create JTable.
    well then you will, most probably, need to look into table models and create your own table model (extension of abstract table model) and then do operations on it.
    sample:
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    public class neco extends JFrame implements ActionListener{
            private JScrollPane scroll = new JScrollPane();
            private JButton btn = new JButton("add row");
            private JTable tbl;
            public neco(){
                    Object[] cols = {"first name","last name","phone number"};
                    Object[][] data = {
                            {"first name","last name","phone number"},
                            {"second first name", "second last name","second phone number"}
                    Container cn = this.getContentPane();
                    cn.setLayout(new FlowLayout());
                    cn.add(scroll);
                    scroll.setViewport(this.getPort(tbl = new JTable(new MyTableModel(data,cols))));
                    cn.add(btn);
                    btn.addActionListener(this);
                    cn.validate();
            private JViewport getPort(JComponent comp){
                    JViewport port = new JViewport();
                    port.setView(comp);
                    return port;
            public void actionPerformed(ActionEvent ae){
                    if(ae.getSource() == btn){
                            MyTableModel mtm = (MyTableModel)tbl.getModel();
                            mtm.addRow(new Object[]{"new first name","new last name","new phone number"});
                            scroll.validate();
            public static void main(String[] vik){
                    neco n = new neco();
                    n.setSize(800,600);
                    n.setVisible(true);
                    n.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            class MyTableModel extends AbstractTableModel{
                    Object[][] data;
                    Object[] cols;
                    public MyTableModel(Object[][] data, Object[] cols){
                            this.data = data;
                            this.cols = cols;
                    @Override
                    public String getColumnName(int col){
                            return cols[col].toString();
                    public void addRow(Object[] row){
                            Object[][] newData = new Object[this.getRowCount() + 1][this.getColumnCount()];
                            //now copy the old object[][] array into this new one
                            for(int count=0;count<this.getRowCount();count++){
                                    newData[count] = data[count];
                            //and now add the new row
                            newData[newData.length - 1] = row;
                            //make data our newData
                            data = newData;
                            fireTableRowsInserted(0,data.length - 1);
                    public Object getValueAt(int row, int col){
                            return data[row][col];
                    public int getColumnCount(){
                            return cols.length;
                    public int getRowCount(){
                            return data.length;
    }in your (MyTableModel) you can add methods for getting rows, or column, or whatever you want and then you will have all the data that you need.
    hope this will help
    v.v.

  • What cast type are used for?

    In the example attached to this question is a simple VI application that cast, using type cast of LabVIEW, one value to different other type. My understanding of type cast, in C, C++ and to my best knowledge, was an implicit adaptation of a numerical value in a specific format to an other format. The value should remain the same. Unless the type in which the value is assigned is not enough large or adapted to contain such a number ex:
    I8 = 500;
    U32 = -1;
    But in my example all the assigned indicator are large enough.
    I have the same problem in LabVIEW 5.1.1 and 6.1
    If someone could only tell me what it is used for?
    Best regards,
    Nitrof
    Attachments:
    Type_cast.vi ‏26 KB

    The type cast function is really helpful for typecasting "unusual" data to a more convienient data format. It can also be used to coerce data, like in your example, but coercion is usually not always a good thing because it can cause bad values.
    There are lots of good examples of typecasting.
    For example, I use the typecast function to change refnums to unsigned 32 integers (U32), just so I can pass the refnums between VI's easier.
    Another VERY common typecast is if you want to display the ASCII value of a character. Run the string character "A" into a typecast, and set the output type as a Unsigned 8 bit number (U8), and you will see 0x41. Take a look at my example VI's to see what I mean.
    David
    Attachments:
    Type_cast_Example5.vi ‏16 KB
    Type_cast_Example6.vi ‏18 KB

  • NI-XNET nxBlink() what session type to use ?

    What session to pass to nxBlink() NI-XNET function ?
    I tried to pass sessions obtained from:
    - nxCreteSession(..., nxMode_FrameInStream, ...)
    - nxCreteSession(..., nxMode_FrameOutStream, ...)
    But I get error. The nxBlink() help only says use "The XNET Interface I/O name".
    but that doesn' tell me what kind of session out of these to use:
    nxMode_SignalInSinglePoint
    0
    nxMode_SignalInWaveform
    1
    nxMode_SignalInXY
    2
    nxMode_SignalOutSinglePoint
    3
    nxMode_SignalOutWaveform
    4
    nxMode_SignalOutXY
    5
    nxMode_FrameInStream
    6
    nxMode_FrameInQueued
    7
    nxMode_FrameInSinglePoint
    8
    nxMode_FrameOutStream
    9
    nxMode_FrameOutQueued
    10
    nxMode_FrameOutSinglePoint
    11
    nxMode_SignalConversionSinglePoint
    12

    I already found out that system type of session leads to interface/port type of session that can be used
    to blink the particular port LED.
    Thank you, Radek
     // Open system session.
            nxCheckErr(nxSystemOpen(&l_SystemRef));
     // Each Interface is represented by a u32 (4 bytes).
             l_NumberOfInterfaces = l_PropertySize /4;
             l_pInterfaceNames = (char**)malloc(sizeof(char*)*l_PropertySize);
             l_InterfaceBuffer = (u32 **)malloc(l_PropertySize);
             // This property returns the u32 value for each interface.  
             // You can use this value to get individual interface properties
             nxCheckErr(nxGetProperty (l_SystemRef, nxPropSys_IntfRefs, l_PropertySize, l_InterfaceBuffer));       
             // Get the individual interface names.
             for (i = 0; i < l_NumberOfInterfaces; i++)
                nxCheckErr(nxGetPropertySize((nxSessionRef_t)(l_In​terfaceBuffer[i]), nxPropIntf_Name, &l_PropertySize));
                l_pInterfaceNames[i] = (char*) malloc(l_PropertySize);
                nxCheckErr(nxGetProperty((nxSessionRef_t)l_Interfa​ceBuffer[i], nxPropIntf_Name, l_PropertySize, l_pInterfaceNames[i]));
                // Identify the port that match the resourceDescriptor.             
                if (0 == strcmp(resourceDescriptor, l_pInterfaceNames[i]))
                    actualInterface = (nxSessionRef_t)l_InterfaceBuffer[i];
                    nxBlink(actualInterface, 1); // Blink particular port for identification and
                    Delay(1);                    // indicate that input stream was succesfully opened.           
                    nxBlink(actualInterface, 0);    

  • What compression type to use when exporting?

    I need to export a Final Cut Pro Movie File to a QuickTime Movie file. There are so many copression types to choose from. Which should I use so that people with both Mac and PC could open the file? Some friends have complained that they can´t open files that I´ve exported using H.264 which is the default I get in QuickTime.
    thanks in advance

    Backward compatibility has always been a QuickTime strong suit. Files made in version 3 still open just fine in version 7.
    But H.264 (and the preset export options) make this a bit more confusing.
    MPEG-4 Video codec will open in version 6, or higher and, since version 6 has been available since 2002, it is a very good chance your viewers have version 6 to view it.
    Older machines that can't be upgraded to version 7 or viewers that still haven't upgrade their version of QuickTime beyond version 4 (Win 95) would like to view Sorenson 3 Video codec.
    Don't bother with any conversion to AVI as the QuickTime export options (Cinepak) haven't been used since Win 3.
    If you have a lot of videos to share or are making files to be used in a Web page you'll probably get the best results by choosing:
    Export > Movie to QuickTime Movie
    and choosing MPEG-4 Video codec. These .mov files work just fine on the Web and also in other players (iPods, etc.) as long as you don't exceed the specs for iPod.
    Learn more by experimenting with one minute exports to various codecs and settings.

  • What data type to use?

    I need to compute the percentage of each INTEGER, say, 4,5,6,3,2. So this is what I did:
    percent_value[] = (value[] / total) * 100;
    both percent_value and value[] are int arrays.
    I know there's something wrong, I don't know what... please help :)

    If total is an int, then you will always get 0 (or 100) the way you calculate it, since dividing two ints will produce an int, not a float. So you should multiply with 100 before you divide with total.
    You need a for-loop to work with your arrays:
    for (int x = 0; x < value.length; x++) {
      percent_value[x] = value[x]*100/total;
    }I assume that was what you were trying.

  • What compression type to use for disk image files

    Hello all
    I was wondering if a more experienced user than me could give a recommendation as to which compression format I should use to compress an image I made of my / partition. I used dd to make the image file.
    For me, (de)compression time is more important than compression ratio (size), but I'm of course looking for a good blend of both
    Thanks for any advice

    If you have a multicore processor, use pigz instead of gzip etc. Start with this app and only after you're not happy with it, look for one that's faster / compresses better.
    BTW, do you have a lot of incompressible data in there? Movies, pics, music and already compressed files won't compress any more.
    Last edited by karol (2011-01-29 16:16:03)

  • What report type should use ?

    Hi all,
    I got the following query output :-
    Item___Type
    1233___011
    1233___013
    1233___015
    1233___014
    and I will like to display the output in the following format :-
    Item__Model_011___Model_013___Model_014___Model_015
    1233__011_________013_________014_________015
    How should I do ? Thanks in advance.
    rgds
    Lim

    Hi Lim,
    U can use the matrix report.
    It will solve yr purpose.
    Regards
    Mayank Sharm

  • Use of variable types and rounding...

    I'm kinda confused on what variable types to use. I want it so that when I divide two numbers, it'll either round up or down, and give me a rounded number w/o a decimal.
    Examples...
    184/2683=7
    164/2683=6
    I have been fiddling with it for a while now, and I keep getting rounded down numbers, even if the decinal is more than .5. Thanks in advance!

    184 / 2683 = 0.068579947819604919865821841222512 -> 0.07
    164 / 2683 = 0.061125605665300037271710771524413 -> 0.06
    Use Math.rint (please read the javadocs...) and some scaling (multiply by 100.00, divide by 100.0 etc).
    Beware - when printing your result could be:
    0.070000000000001
    or
    0.069999999999998
    instead of the expected value 0.07
    for instance, due to the properties of floating-point arithmetic. If you want to round the number only for displaying it, use java.text.DecimalFormat or java.text.MessageFormat.

Maybe you are looking for