Get integer part of a double type value.

double dblVal=150.50;
how will i get the integer part only of variable dblVal?
i want to get the 150 only. please help.
killuasoft

Why would you want to do this? This can overflow your
int for sufficiently large double values, even when
using a long instead of an int.Maybe he previously did a range check or otherwise knows the range of possible values.

Similar Messages

  • Why do i get integer values instead of decimals when selecting a mysql table through an oracle xe DB?

    Hi
    My company just started a new project that implies migrating every hour operational data from a mysql database located at another company to our main DB (oracle10gR2). Between these two DB, we have an oracle XE DB which contains the database links to both DB and a procedure to get (from mysql) and insert (oracle10g) the values. What happens is that in the mysql DB, the values have decimals and, when i select the table in oracle, i only see integer values (no decimals). Here is an example of the select i use:
    SELECT "v_hour", "v_date", "v_type", "v_tabstamp","v_value"
    FROM "tab1"@mysql;
    How can i work around this problem?
    Many thanks!

    Maybe just a HS_LANGUAGE setting issue.
    You could try that:
    1a) in the gateway init file, please set HS_LANGUAGE=GERMAN_GERMANY.WE8ISO8859P1
    2a) now open a new SQL*Plus session ans select from your table using the gateway based database link
    => if the values are now including the decimal part then your foreign database is set up to use a comma as the decimal separator and you have to make sure that the HS_LANGUAGE contains a territory that uses as decimal separator a comma.
    If you still do not get the decimal values, then change it to:
    1b) HS_LANGUAGE=american_america.we8iso8859P1
    2b) Make sure you start again a new SQL*Plus session (the gateway init file is only read when you use the database link in your session for the first time (or explicit closed it before). Select again from your table.
    => is the decimal part now visible?
    More details can be found in the gateway note: Gateway and Decimal Digits(Doc ID 1453148.1) available from My Oracle Support portal.
    - Klaus

  • Getting the integer part of a float?

    This sure is a simple problem, but i couldn't find an appropriate methode or class so i just like to aks you, wheter you have an idea:^
    how do i get the integer part of a float? i mean, how do i get the "14" from the float "14.45698"?

    Sounds like you need to explicitly cast it to an integer, like this:
    double      number1 = 14.45698;
              int     number2 = 0;
              number2 = (int) number1;
    Hope this helps.

  • Pricing : Condition type value need tog get from the lowest of 4 other cond

    Hi,
    I have one requirement in one pricing procedure.
    I need to calculate condition value of one condition type from the lowest value of other 4 condition tyeps. These condition types values are not defined as a subtotal.
    So if I decide to write a formula on condition values, is there
    any way to select these values and choose the lowest of them?
    Please also advice if there is any other way such as condition exclusion
    or so?
    Thanks and regards,
    Anand

    Anand,
    As you have mentioned you can use condition exclusion for such a requirement.
    here is a detailed description of how you can achieve this: use the menu path IMG> Sales & Distribution> Basic Functions> Pricing> Condition Exclusion> Condition exclusion for group of conditions.
    When you execute this IMG acitivity you get a window with three options
    1.Define Condition Exclusion Groups
    2.Assign condition types to the exclusion groups
    3.Maintain condition exclusion for pricing procedures
    We will use these three options one by one, we start with the first
    1. Define an exclusion group, lets say EX01 and give a description
    2 Assign the four condition types that you want to compare to this exclusion group under this option
       lets say EX01 ZK01
                   EX01 ZK02
                   EX01 ZK03
                   EX01 Zk04
    3. under this third step, select the pricing procedure that you are working on and from the left margin click on 'Exclusion'. click on 'New Entries' and make the following entries (example)
             Sno.   Cpr         ExGr1
              10      A            EX01                leave ExGr2 blank, Save your entries
    Check if your purpose has been met or not. Do give your feedback
    Regards,
    PATHIK

  • Want to get "Base Type" value in Delivery

    Hi,
    I would like to get  "Base Type" value when create Delivery (Copy from Sales Order).
    The following is my code:
    Dim oOrderMat As SAPbouiCom.Matrix
    Dim oColumns As SAP bouiCom.Columns
    Dim oKeyColumn As SAPbouiCOM.Column
    Dim oKeyValue As String
    oOrderMat=oForm.Items.Item("38").Specific
    oColumns=oOrderMat.Columns
    For i=1 to oOrderMat.RowCount()-1
    oTypeColumn=oColumns.Item("43")
    oTypeValue=oTypeColumn.Cells.Item(i).Specific.Value()
    However, when i use the same way to retrieve the value of "Base Key" or "Base Row" which is perfectly fine.  The following is the error message.
    Error Message:
    error: System.MissingMemberException:Public member 'value' on type 'IComboBox' not found.
    at
    Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o,Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
    at
    Project1.CatchingEvents.SBO_Applicaton_FormDataEvent(BusinessObjectInfo&BusinessObjectInfo,Boolean&BubbleEvent)in
    Please help
    Regards,
    Anna

    Hi Anna,
    looks like that column is a combobox
    try:
    oTypeValue=oTypeColumn.Cells.Item(i).Specific.Selected.Value
    lg David

  • Modbus register readings, double type Shared Variable 32000

    Hello
    I am new to labview and modbus and have been trying to communicate with a control card using the VIs in the standard modbus library in labview 8. This might be a very simple question, it relates to the output of the "read holding register" or "function code 0x03" . All the results I have been getting are in 5 digit decimal form, I have read in another post that this may be the "double type Shared Variable" and that it can be converted or typecasted to "ieee 754 type" i.e. as actual measurement values. I was wondering if it is possible for 5 digit "double type shared variable" that are greater than the 32000, i.e such as 50119 or 50294, to be converted to "ieee 754 type". Or even if there are standard methods that can perform this type of conversion in general.
    Thanks in advance

    Maybe this will help.
    http://forums.mrplc.com/index.php?showtopic=30
    http://www.simplymodbus.ca/FAQ.htm#Types
    What are data types?
    The example for FC03 shows that register 40108 contains AE41
    which converts to the 16 bits 1010 1110 0100 0001
    Great! But what does it mean? Well, it could mean a few things.
    Register 40108 could be defined as any of these 16-bit data types:
         A 16-bit unsigned integer (a whole number between 0 and 65535)
                        register 40108 contains AE41 = 44,609 (hex to decimal conversion)
         A 16-bit signed integer (a whole number between -32768 and 32767)
                                                            AE41 = -20,927
                  (hex to decimal conversion that wraps, if its over 32767 then subtract 65536)
         A two character ASCII string (2 typed letters)
                                                            AE41 = ® A
         A discrete on/off value (this works the same as 16-bit integers with a value of 0 or 1.
                                                  The hex data would be 0000 or 0001)
    Register 40108 could also be combined with 40109 to form any of these 32-bit data types:
         A 32-bit unsigned integer (a number between 0 and 4,294,967,295)
                                 40108,40109 = AE41 5652 =  2,923,517,522
         A 32-bit signed integer (a number between -2,147,483,648 and 2,147,483,647)
                                                           AE41 5652 = -1,371,449,774
          A 32-bit double precision IEEE floating point number.
          This is a mathematical formula that allows any real number (a number with decimal
           points) to represented by 32 bits with an accuracy of about seven digits.
                                                           AE41 5652 = -4.395978 E-11
          Here is a spreadsheet IEEE float calculator for inputs of 4 bytes or 2 words.
          To download a copy, right click and select Save Target As...
         A four character ASCII string (4 typed letters)
                                                             AE41 5652 = ® A V R
    More registers can be combined to form longer ASCII strings.  Each register being used to store two ASCII characters (two bytes).

  • Separate the int and decimal parts of a double var

    Hi,
    I would like to know how can I obtain the int part and decimal of a double var.
    Example:
    2.3455
    int -->2
    decimal--->3455
    Also I would like to know how I can specify the precision of the decimal part. For example: 3455 if want a 2 decimal precision--> 34
    Regards and thanks with anticipation.

    Hi all,
    I too have a way to this solve this.
    1. Convert the double into a string.
    2. Split it by . symbol, which will produce an array of two elements.( First one is integer part, another one is decimal part)
    3. Now we can easily do type casting and get two variables.
    Example:
    double base = 2.5689;
    String str = Double.toString(base);
    String[] out = null;
    out = str.split(".");
    int a = Integer.parseInt(out[0]);
    double b = Double.parseDouble(out[1]);Thanks
    Ram

  • Condition type value updation using characteristic value in sales order

    Hi Experts,
    We are implementing SAP for one of our Spain client. In that one of the Legal requirements is, whenever they are selling the finished products to domestic customers who contain OIL as one of the component then, some additional cost needs to be calculated and collected from customer and which needs to be paid back to Spain Government every month on Region basis.
           If OIL is not a component to produce the finished product then, not required to charge the customer additionally.
    The OIL content used to produce every finished product will vary based on product characteristic value. Meaning, for some finished product the OIL used will be 2.2 KG and for some products it will be 3.5, 4.3 KG and etc.
    Since various combinations of products are available for the client, during sales order creation we are planning to update some special characteristic which the data flow from u201CVariant Tableu201D. In the variant table we are going to maintain the OIL Quantity required making finished product.
    But we are not sure how to activate a new condition type with the value fetched in the special characteristic. This new condition type needs to be activated based on this characteristic value and multiplied with total order quantity and price to charge from customer.
    Example, the special characteristic fetched the value of 2.2 KG based on variant table. Total Order quantity is 10 PC and charge is 0.06 EURO per KG. in this case, (2.2 x 10 ) x 0.06 EURO = 1.32 EURO
    I need the expert opinion how to activate the new condition type based on characteristic value and achieve the above requirement.
    Thanks in advance.
    Warm Regards,
    VEL

    Hello,
    I have replicated the whole requirememt in IDES and getting the price calculation as needed but the only issue with the Conversion factor for the condition type. Either you need to maintian the conv factor in material master or need to enter manually for the condition type in SO. Some how you have to maintain the conversion factor to calculate the price for the condition type in different unit.
    For easy of understanding Lets make the whole requirement in 2 parts
    Part - 1
    Oil qty calculation. For convenience sake I have taken oil qty also in TO
    1) Created a num char OIL_QTY1 with length 9 and decimal places 5 and UOM as TO
    2) Created Variant table to infer the OIL qty in TO per piece of finished prod ( This oil qty data may be depends on various factors). For certain Finished products the oil qty may be 0 or blank
    3) Created a REF char SO_QTY  to pull the SO qty to configuration and add this char in class 300(Table:VBAP,Field :KWMENG)
    4) Created another char SO_OIL_QTY  (Num with length 9 and decimal places 5 and UOM as TO)
    5) Created a PROCEDURE say PROC_SO_OIL_QTY with code
    *$self.SO_OIL_QTY = $self.OIL_QTY1 * $self.SO_QTY*
    6) Create another PROCEDURE as mentioned earlier with modified code
    $SELF.A_VARCOND = 'TEST_001' if OIL_QTY1 specified,
    $SET_PRICING_FACTOR ($SELF,A_VARCOND,'TEST_001', SO_OIL_QTY)
    Note: Maintain proper seq of the procedures in profile. The Qty cal proc should be before the price related procedures.
    PART-2
    1) For the condition type maintained 60 EUR per TO (0.06 EUR per KG)
    Now if you create SO for the Finished product of 10 PC
    the Char values will be
    OIL_QTY1  = 0.00022 TO (inferred from Variant table th proc)
    SO_QTY    = 10
    SO_OIL_QTY = 0.0022 TO
    Get into conditions tab
    Here Condition type ZSIG will be displayed as error with Amount 60 EUR per TO and condition value will be blank. Just enter value 1 in the col NumC and CCon fields.
    Now the Condition value will appear as 1.32 EUR.
    Hope this gives some more clarity
    Regards
    Brahmaji D

  • To get Class object representing the primitive type by a String

    for classes,I can use
    classNameString = "java.lang.String"
    Class c=Class.forName(classNameString);
    to get Class object representing the classNameString.
    but to get Class object representing the primitive type ,I have to use something like :
    Class c=Integer.TYPE;
    is there any way to get Class object representing the primitive type by a String?

    not using Class.forName(). you'll just need to key off the String passed to see whether it names a primitive:class ClassUtilities {
       * Gives the <code>Class</code> corresponding to a named class or primitive.
       * @param  name  FQN of a class, or the name of a primitive type
       * @param  loader  a {@link java.lang.ClassLoader ClassLoader}
       * @return  the <code>Class</code> for the name given.  This method
       * converts primitive type names to their particular <code>Class</code>
       * object.  <code>null</code>, the empty string, <code>"null"</code>, and
       * <code>"void"</code> yield {@link java.lang.Void#TYPE Void.TYPE}.  If any
       * classes require loading because of this operation, the given
       * <code>ClassLoader</code> performs the loading.  Such classes are not
       * initialized, however.
       * @throws  ClassNotFoundException  if the name names an unknown class
       * or primitive
       * @see  java.lang.Class#getName
      static Class classForNameOrPrimitive( String name, ClassLoader loader )
        throws ClassNotFoundException {
        if ( name == null || name.equals( "" ) || name.equals( "null" ) || name.equals( "void" ) ) {
          return Void.TYPE;
        if ( name.equals( "boolean" ) )
          return Boolean.TYPE;
        if ( name.equals( "byte" ) )
          return Byte.TYPE;
        if ( name.equals( "char" ) )
          return Character.TYPE;
        if ( name.equals( "double" ) )
          return Double.TYPE;
        if ( name.equals( "float" ) )
          return Float.TYPE;
        if ( name.equals( "int" ) )
          return Integer.TYPE;
        if ( name.equals( "long" ) )
          return Long.TYPE;
        if ( name.equals( "short" ) )
          return Short.TYPE;
        return Class.forName( name, false, loader );
    }

  • I have a problem of InputField of double type.

    Hi everyone,
    I have a problem of InputField of double type,if anyone have got the same problem i need your solution.
    I have a InputField bind to context of double type,when runtime this InputField display "0",after InputField get focus it won't select all content auto.What i need is:when inputfield get focus the value in it was selected all auto.
    best regard
    reefish

    Hi,
      I guess you want to set focus on the Input Field.
    For that Try with this code in wdDoModifyView method.
    IWDInputField ip = (IWDInputField)view.getElement("InputField");
    ip.requestFocus();
    Regards,
    Sridhar

  • Integer part only

    Hi everybody,
    I'm a brand new user of Labview (v 2009). I try to save some data from my electrometer (Keithley 617) in an array (time and electric current). And it works, I can see these data in a text file, with the time on the left, and on the right the value of the current. The issue is that I can only record the integer part. The current I try to record is something like 10E-12 A. So if I don't multiply the result by a constant of 10E15 for example, the result would be 0 instead of 0.00...004658 A. And it is the same for the time. I can see 1, 1, 1, 2, 2, 3, 3 instead of 1.034, 1.45, 1.89, 2.36, 2.98, 3.48, 3.95 for example. I've try to change the format, but it doesn't solve this problem of the integer part. I'd like to see the whole number (integer and decimal parts). Attached, please find my program. Also I attached 2 files. test01 is what I'd like to record, and test02 is what I currently record. Could you help me please ?
    Thank you !
    PS : I try to expose as best as I can my problem, I'm French...
    Solved!
    Go to Solution.
    Attachments:
    Keithley 617a Yang.vi ‏27 KB
    test01.txt ‏3 KB
    test02.txt ‏1 KB

    Ok I think I found a solution. A double precision float "DBL" was missing just before the "measurement" part. I attach you my program and the results.
    Thank you for your help !!
    Thomas.
    Attachments:
    Keithley 617b Yang.vi ‏26 KB
    test02.txt ‏1 KB

  • Boolean & Double types for Data Objects

    Are the Boolean and Double types going to be supported/implemented as usable types for Process/Project data objects?
    The option is available for each of these in JDeveloper, but they become highlighted in red when you select them and if you accept they get converted into String types. I'm not sure if this means this isn't implemented yet or it won't be supported. If they're not supported types they shouldn't be displayed as options.

    That is currently I bug that I found as well. If you type in the type name manually as Bool that should work. For Double I think it is either Real or Decimal. Once you type in these values the red will go away and they will work.

  • How is it posible to get the File name, size and type from a File out the H

    How is it posible to get the File name, size and type from a File out the HttpServletRequest. I want to upload a File from a client and save it on a server with the client name. I want to conrole before saving the name, type and size of the file.How is it posible to get the File name, size and type from a File out the HttpServletRequest.
    form JSP
    <form name="form" method="post" action="procesuploading.jsp" ENCTYPE="multipart/form-data">
    File: <input type="file" name="filename"/
    Path: <input type="text" readonly="" name="path" value="c:"/
    Saveas: <input type="text" name="saveas"/>
    <input name="submit" type="submit" value="Upload" />
    </form>
    proces JSP
    <%@ page language="java" %>
    <%@ page import="java.util.*" %>
    <%@ page import="FileUploadBean" %>
    <jsp:useBean id="TheBean" scope="page" class="FileUploadBean" />
    <%
    TheBean.doUpload(request);
    %>
    BEAN
    import java.io.*;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.ServletInputStream;
    public class FileUploadBean {
    public void doUpload(HttpServletRequest request) throws IOException
              String melding = "";
              String filename = request.getParameter("saveas");
              String path = request.getParameter("path");
              PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("test.java")));
              ServletInputStream in = request.getInputStream();
              int i = in.read();
              System.out.println("filename:"+filename);
              System.out.println("path:"+path);
              while (i != -1)
                   pw.print((char) i);
                   i = in.read();
              pw.close();
    }

    Thanks it works great.
    Here an excample from my code
    import org.apache.commons.fileupload.*;
    public class FileUploadBean extends Object implements java.io.Serializable{
    String foutmelding = "geen";
    String path;
    String filename;
    public boolean doUpload(HttpServletRequest request) throws IOException
         try
         // Create a new file upload handler
         FileUpload upload = new FileUpload();
         // Set upload parameters
         upload.setSizeMax(100000);
         upload.setSizeThreshold(100000000);
         upload.setRepositoryPath("/");
         // Parse the request
         List items = upload.parseRequest(request);
         // Process the uploaded fields
         Iterator iter = items.iterator();
         while (iter.hasNext())
         FileItem item = (FileItem) iter.next();
              if (item.isFormField())
                   String stringitem = item.getString();
         else
              String filename = "";
                   int temp = item.getName().lastIndexOf("\\");
                   filename = item.getName().substring(temp,item.getName().length());
                   File bestand = new File(path+filename);
                   if(item.getSize() > SizeMax && SizeMax != -1){foutmelding = "bestand is te groot.";return false;}
                   if(bestand.exists()){foutmelding ="bestand bestaat al";return false;}
                   FileOutputStream fOut = new FileOutputStream(bestand);     
                   BufferedOutputStream bOut = new BufferedOutputStream(fOut);
                   int bytesRead =0;
                   byte[] data = item.get();
                   bOut.write(data, 0 , data.length);     
                   bOut.close();
         catch(Exception e)
              System.out.println("er is een foutontstaan bij het opslaan de een bestand "+e);
              foutmelding = "Bestand opsturen is fout gegaan";
         return true;
         }

  • Exchange BPA Errors (Exchange server is a virtual machine but the additional tools are not installed and The 'Services' string type value located in 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\v14\Setup\Services' registry key is missing)

    Hi,
    I am running BPA on My Exchange 2010 VM (Server 2008 R2 VM on Hyper-V) and get the following errors:
    The 'Services' string type value located in 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\v14\Setup\Services' registry key is missing or inaccessible. The Microsoft Exchange Information Store service won't start. As a result, all services that depend
    on this service won't be able to start
    Exchange server [Exchange Server FQDN] is a virtual machine but the additional tools are not installed. This configuration is not supported. Install Virtual Machine Additions for this guest.
    Problem is that, for the first, that Key exists and the service is actually running fine. And for the second my VM tools are already installed.
    Hopefully someone out there has had the same issue and can assist.
    Pete

    Hi Pete,
    For the first error message, please try the following steps:
    Make sure the Information Store service is in Starting status,
    Automatic startup type and works well, as a test we can try to
    restart the Infroamtion Store service and verify the service works well.
    Start
    Registry Editor, find the registry key “Services” under “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\v14\Setup”, its value is “C:\Program
    files\Microsoft\Exchange Server\v14”(default install location), please check your registry, make sure the key “Services” exist and value is the Exchange Server install location and the
    location is accessible;
    Start
    Registry Editor, and locate the following registry key:
    HKEY_LOCAL_MACHINE\Software\Microsoft\Exchange\Setup
    Use the
    Permission option under the Security tab to check the permission setting on this key. Make sure
    System is in the list with Full Control permissions if the service account is Local System. If you are not using Local System as the service account, check the existence of the corresponding account in the list and ensure that
    it has Full Control permissions. Please refer to this article:
    Title: Exchange Store Does Not Start: Errors 7024, 1026, 9542, and 5000
    Link:
    http://support.microsoft.com/kb/285116
    Start
    ADSI Edit, and then browse to the following location:
    Domain.com/Configuration/Services/Microsoft Exchange/Org/Administrative Groups/AdminGroup/Servers/Server Name
    Right-click the
    server name, and then click Properties.
    Click the
    Security tab, make sure this own server’s server object have
    full control permission on its own server.
    If not or the object is missing, please modify the permission or click
    Add, locate the computer account for the Exchange Server computer, add it to the Permissions list with full control.
    Click OK, and then close ADSI Edit.
    Use
    Active Directory Users and Computers to add the current affected
    Exchange Server computer account to the Exchange Servers(previous version should be “Exchange Domain Servers”) group in the
    Microsoft Exchange Security Groups( or Users) OU. Refer to this article:
    http://support.microsoft.com/kb/297295.
    Restart the Exchange Server computer, then rerun the ExBPA.
    For the second error message, Microsoft don’t recommend to install Exchange Server on virtual machine without additional tools, so the error message occurs. We can just ignore
    this message, it will not affect the Exchange servers.
    Regards, Eric Zou

  • How to receive integers and double types in tcpread?

    I am trying to send data of double type from a linux machine through a C program.I am not able to read any data type from tcpread vi except the string data type.
    helpme out of this problem
    I am attaching my C program running on linux
    Attachments:
    server.c ‏3 KB

    i modified your VI by first type casting your string into an array of U16's. Then I did the byte swap and then re-cast this array as an array of U8's.
    If you are reading a single value as 4 bytes, try type casting it directly into a single precision flaoting point value.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Data_Client3.vi ‏39 KB

Maybe you are looking for

  • How can I get a List Objects from my NameSpace

    Hello to All. I need a list of objects an specifc documentation about these. ( SAP XI) Any transaction o maybe tables , where located this objects . Thanks and Regards Edited by: Luis Ortiz on Oct 10, 2008 2:58 PM

  • ACL Direct Link 7 Install for ECC 6.0

    Hi All, Have been in process of implementing the ACL Direct Link 7 on ECC 6.0 EHP4 (MSS2008R2/WIN2008R2). This is used by the Auditors. I have tried to search the forums for any threads related to this but didn't find so far and hence posting this me

  • Arabic text printing using smartfroms

    Hi, I' m printing Purchase oder in Arabic language , we installed Arabic supoort drivers in SAP system, when I see arabic values in debugging I am able to see arabic text perfectly , but when I give print or Print Preview arabic text printing as with

  • Where do i find the answers to my posted questions?

    I've posted a question on this help page. Where do I find the posting and any replies to it?

  • Crud operations

    Hi, shouldn't it be easy? A table displays a Collection of objects. I want be able to click on an 'edit' link or button and be brought to the detail screen for editing the record. I have to retrieve the ID of my objects, but I don't know how to get i