Float Conversion

I am passing 2 strings of data Social Security Number and a string to be parsed
1) SSN 123456789
2)String PH80.00 170915.76 AAE
The string is parsed PH is extracted, 80.00 is extracted and 170915.76 is converted, however, it is converted to 170916.77. .01 is added to the value. Why does this occur? I think it has to do with the float. The code is as follows
* Created on Jun 13, 2007
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
package com.abbott.HRT.US018;
* @author Administrator
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
public class TransformData {
     * The below Function is for handling Compensation Update Records
     */ 2 examples of string passed MI80.00 242050.00 AAE Output produced is 242050.00
PH80.00 170915.76 AAE Output produced is 170915.77
     private String compensationUpdate(String sRecord) {
          //1.Map directly the source data to target data and make changes to below lengths.
          StringBuffer sBuf = new StringBuffer(sRecord);
          //          Correction : Make the length of sBuf equal to 21 in order to reduce the risk of runtime exception
          if (sBuf.length() < 21) {
               while (sBuf.length() != 21) {
                    sBuf.append(' ');
          //2.     Schedule Hours : Format the data into "ZZ9.99" at position 3-8
          String substring = sBuf.substring(2, 8);
          substring = formatNumber(substring, 4, 6, 2);
          sBuf.replace(2, 8, substring);
          //3.     Base Rate : Format the data into "ZZZZZZ9.99" at position 9-29. The target position will be 9-18
          substring = null;
          substring = sBuf.substring(8, 29);
          substring = formatNumber(substring, 8, 10, 2);
          sBuf.replace(8, 18, substring.substring(0, 10));
          sBuf.delete(18, 29);
          //4.     Performance Rating : For now no mapping is defined
          //At last append 434 spaces to the record
          sBuf = appendSpaces(sBuf, 434);
          return sBuf.toString();
     * The below Function is for formatting numbers Records
     private String formatNumber(
          String input,
          int position,
          int length,
          int decPlaces)
          throws NumberFormatException {
          //17.08.2007 : If empty string has come, send back the same
          int int1 = input.lastIndexOf(' ');
          int int2 = input.length();
          if (int1 == int2) {
               return input;
          // position = actual position of dec place (e.g.4 for ZZ9.99)
          //length = actual length (e.g. 6 for ZZ9.99)
          //decPlaces = (e.g. 2 for ZZ9.99)
          //First get the input converted into float and back so as to add a decimal sign if it does not exist
          float f;
          try {
               f = Float.parseFloat(input);
          } catch (NumberFormatException ex) {
               throw new NumberFormatException(
                    "Exception Occurred:" + ex.getMessage());
          StringBuffer sb = new StringBuffer(length);
          sb.insert(0, f);
          //Identify the position of decimal sign and then shift it gradually
          int index = sb.indexOf(".");
          if (index < position && index != -1) {
               while (index < (position - 1)) {
                    sb.insert(0, " ");
                    index = sb.indexOf(".");
               /*If there is no decimal sign, put one at the desired position                         
                                        if(index == -1){
                                             int int1 = Integer.parseInt(input);
                                             sb.ins;
                                             sb.insert(position,".");
          //Fill blank spaces after decimal sign with zero
          while (sb.length() < length) {
               sb.append("0");
          return sb.toString();
The code is as follows

Volume is not precision. You need to be precise and informative. This end is not served by simply dumping huge volumes of code or data into a help request. If you have a large, complicated test case that is breaking a program, try to trim it and make it as small as possible.
This is useful for at least three reasons. One: being seen to invest effort in simplifying the question makes it more likely that you'll get an answer, Two: simplifying the question makes it more likely you'll get a useful answer. Three: In the process of refining your bug report, you may develop a fix or workaround yourself.
-- http://www.catb.org/~esr/faqs/smart-questions.html
Example:
assert 170915.77F == Float.parseFloat("170915.76"); // why?And here's the answer:
http://en.wikipedia.org/wiki/Floating_point
http://java.sun.com/developer/JDCTechTips/2003/tt0204.html#2
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Cheers!
~

Similar Messages

  • Char to float conversion

    Hi,
    I am holding float value in a variable which i want to convert it into float again.
    Help Will be rewarded

    hi,
    u can take a float variable and move char into it directly.
    float1 = char1.

  • Binary file reading

    Dear All,
    I have Binary file. I want to read Bytes based on Patterns and each channel value (Byte values -- > Float conversion)  and storing it into Index array.
    Please check the attachment for pattren format. 
    Here, the biggest problem is we will get only pattern style, Based on pattern the data is already stored in Binary file just we need to read it means we need to set the Timestamp based on this.
    Please give me some idea to read this kind of pattern files.
    BR,
    Guru
    Munna
    Attachments:
    Data Reading.xlsx ‏15 KB
    Data Reading.xlsx ‏15 KB

    Hi Munna,
    that pattern is quite hard to understand. It seems there is some information missing…
    In your pattern table the data size for e.g. ch1 is given as "1 byte", but in your time schedule you use two bytes for ch1. How are those "ch start position bytes" to be identified?
    Byte values -- > Float conversion
    How do you want to convert those bytes to Float (SGL or DBL)?
    storing it into Index array
    What is an "index array"?
    It seems you have to create a table from your pattern which identifies the bytes in the file. That seems to be the trickiest part as in your pattern#2 example you already have made a mistake (for ch4 there is no marking at timestamp 70ms)…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • HDL Compiler Error

    Salve,
    per la mia applicazione uso un crate PXIe (1062Q) con un RT-module 8102 ed una FlexRIO 7962R. Alla FlexRIO è connesso un AM custom. Nella mia applicazione genero un IP-core con il coregen di xilinx da importare come CLIP nel mio progetto (è una fifo dual clock con dimensione di bus dati differente tra scrittura e lettura). Premesso che con LV 2011 tutto funzionava correttamente, non appena ho installato LV 2012, e quindi, nella speranza di ottenere prestazioni ancora migliori, sono passato ad usare ISE 13.4, ho ri-generato IP-core della fifo (fifo generator 8.4 al posto del 7.2 della precedente versione), ho re-importato il codice nel mio progetto ma al momento di compilare il VI ho ricevuto il seguente errore (del quale allego anche il log xilinx):
    English version:
    Hi,
    I'm using a PXIe crate(1062Q) with a RT-module 8102 and a FlexRIO 7962R. A custom AM is connected to the FlexRIO. I create a new IP-core with Xilinx coregen to import as CLIP in my project (the IP-CORE is a dual clock fifo with non-symmetric aspect ratios). Using LV 2011 all works fine, but with LV 2012 (ISE 13.4, fifo generator 8.4 instead of 7.2 of previous version), trying to have better performance, during compiling I received the following error (log xilinx as attached):
    LabVIEW FPGA:  The compilation failed due to a xilinx error.
    Details:
    ERROR:HDLCompiler:104 - "C:\NIFPGA\jobs\LejKY3B_DPeQegM\NiLvFpgaClipContainer.vhd" Line 149: Cannot find <fifo_generator_v8_4> in library <work>. Please ensure that the library was compiled, and that a library and a use clause are present in the VHDL file.
    ERROR:HDLCompiler:104 - "C:\NIFPGA\jobs\LejKY3B_DPeQegM\NiLvFpgaClipContainer.vhd" Line 162: Cannot find <fifo_generator_v8_4> in library <work>. Please ensure that the library was compiled, and that a library and a use clause are present in the VHDL file.
    ERROR:HDLCompiler:854 - "C:\NIFPGA\jobs\LejKY3B_DPeQegM\NiLvFpgaClipContainer.vhd" Line 95: Unit <clipcontainer_vhdl> ignored due to previous errors.
    VHDL file C:\NIFPGA\jobs\LejKY3B_DPeQegM\NiLvFpgaClipContainer.vhd ignored due to errors
    -->
    Total memory usage is 203228 kilobytes
    Number of errors   :    3 (   0 filtered)
    Number of warnings :    5 (   0 filtered)
    Number of infos    :    1 (   0 filtered)
    Process "Synthesize - XST" failed
    Grazie in anticipo a chiunque abbia una soluzione da proporre.
    Thanks in advance to everyone have a solution to suggest.
    Attachments:
    XilinxLog.txt ‏133 KB

    We had the same problem when switching to Ubuntu 14.04, and there actually is a solution for it: make sure your locales are set to English.
    $> env | grep LC_*
    should only show english (or C) locales, all others are known to cause parsing errors in some numbers, usually caused by wrong string-to-float conversions (e.g. 18,29 in german is 18.29 in english). You can change the locales in the file /etc/default/localesThis is not the first time we had problems with the locale settings, Xilinx does not seem to test their software with anything else than en_US, causing obscure bugs like this one.
    HTH
    Philipp

  • Vivado 2013.4 ERROR: [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order

    Hello,
    I just downloaded and installed Vivado 2013.4 on my Xubuntu 12.04 machine. But when I try to add IP from the IP catalog, as in the ug937 Lab1 step2, it fails with obscure error messages (see below).
    Here's basically what I did:
    -In the Flow Navigator, i select the IP Catalog button.
    -In the search field of the IP Catalog, I type DDS.
    -then I double-click the DDS Compiler and my error occure.
    Please Help,
    Jerome.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen_demo.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen_demo.vhd":1]
    Analysis Results[IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen.vhd":1]
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    set_property target_language Verilog [current_project]
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    sources_1[IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen_demo.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen_demo.vhd":1]
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    update_compile_order -fileset sim_1
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/fsm.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/fsm.vhd":1]
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/fsm.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/fsm.vhd":1]
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [HDL 9-1654] Analyzing Verilog file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sim/testbench.v" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sim/testbench.v":1]
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/debounce.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/debounce.vhd":1]
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-2313] Loaded Vivado IP repository '/opt/Xilinx/Vivado/2013.4/data/ip'.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-1704] No user IP repositories specified
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    Vivado Commands[Project 1-11] Changing the constrs_type of fileset 'constrs_1' to 'XDC'.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    sim_1[IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [HDL 9-1654] Analyzing Verilog file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sim/testbench.v" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sim/testbench.v":1]
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-234] Refreshing IP repositories
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/debounce.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/debounce.vhd":1]
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen.vhd":1]
    set_property constrs_type XDC [current_fileset -constrset]
     

    We had the same problem when switching to Ubuntu 14.04, and there actually is a solution for it: make sure your locales are set to English.
    $> env | grep LC_*
    should only show english (or C) locales, all others are known to cause parsing errors in some numbers, usually caused by wrong string-to-float conversions (e.g. 18,29 in german is 18.29 in english). You can change the locales in the file /etc/default/localesThis is not the first time we had problems with the locale settings, Xilinx does not seem to test their software with anything else than en_US, causing obscure bugs like this one.
    HTH
    Philipp

  • 6/7 is 0?

    hi.
    Am doing a calculation in java.if do 6/7 means the result is 0.since i store the result in double.
    After that i perform some calculation using Number Format ,then also same result.
    here is my code.
    NumberFormat f = NumberFormat.getInstance();
    f. setMaximumFractionDigits(2);
    String cal2=f.format(6/7);
    float cal22=Float.parseFloat(cal2);
    System.out.println(cal22);
    double db=6/7;
    System.out.println(db);Both the above logic giving 0.
    Suggest me a thing to do this.
    Thanks in advance
    regards,
    satheeshkannan

    duffymo wrote:
    Brynjar wrote:
    duffymo wrote:
    Brynjar wrote:
    Unless you cast the numbers to float/double, or add .0, as in 6.0/7.0, the numbers are treated as integers, including the result. Easy to get around, but clumsy nonetheless.Clumsy? Why? Not if you know the difference between integer and floating point numbers.
    This is true in any number of languages. It's hardly clumsy, just the nature of integer numbers in computers.
    %Maybe just a matter of taste. I'd want automatic float conversion in the OP's case, as he declares the result of the division as a float.Not me. I would be worried about those times when things were going on behind the scenes without me knowing it.
    Making one of the arguments a floating point number is an easy thing to do without forcing the compiler to infer anything. Reading minds is asking for trouble.
    %That's a good point. While it may feel 'clumsy' to some because it can be inconvenient in the usual case, there's a very good reason why it's this way. I suppose something like this would get picked up as an Xlint warning

  • SMPlayer vs. Mplayer - behaviour after resuming a pause

    For a few weeks I've been experiencing a change in SMPlayer behaviour after resuming a pause of playing a video - motion of the video is jerked for a few seconds. However, I don't experience this with MPlayer. Has anybody else noticed this or does anybody know what could I do to make SMPlayer work normally?

    I've turned an extended log of MPlayer on and so these are logs created during a short play with some pauses (with jerked motions after resuming):
    SMPlayer log (just extract, couldn't copy the whole log, but it doesn't seem to contain something relevant):
    [22:40:33:653] Core::pause
    [22:40:33:653] Core::pause: current state: Playing
    [22:40:33:653] Core::tellmp: 'pause'
    [22:40:33:707] MplayerProcess::parseLine: ''
    [22:40:33:707] MplayerProcess::parseLine: ' ===== PAUSE ====='
    [22:40:33:708] MplayerProcess::parseLine: ''
    [22:40:33:708] MplayerProcess::parseLine: 'ID_PAUSED'
    [22:40:33:708] Core::changePause
    [22:40:33:708] Core::changePause: mplayer reports that it's paused
    [22:40:33:708] BaseGui::displayState: Paused
    [22:40:33:708] BaseGui::togglePlayAction
    [22:40:33:709] BaseGui::checkStayOnTop
    [22:40:35:104] Core::pause
    [22:40:35:104] Core::pause: current state: Paused
    [22:40:35:104] Core::tellmp: 'pause'
    [22:40:35:143] BaseGui::displayState: Playing
    [22:40:35:143] BaseGui::togglePlayAction
    [22:40:35:144] Core::changeCurrentSec: mplayer reports that now it's playing
    [22:40:35:147] BaseGui::checkStayOnTop
    [22:40:38:432] Core::pause
    [22:40:38:432] Core::pause: current state: Playing
    [22:40:38:432] Core::tellmp: 'pause'
    [22:40:38:507] MplayerProcess::parseLine: ''
    [22:40:38:508] MplayerProcess::parseLine: ' ===== PAUSE ====='
    [22:40:38:508] MplayerProcess::parseLine: ''
    [22:40:38:508] MplayerProcess::parseLine: 'ID_PAUSED'
    [22:40:38:508] Core::changePause
    [22:40:38:508] Core::changePause: mplayer reports that it's paused
    [22:40:38:508] BaseGui::displayState: Paused
    [22:40:38:509] BaseGui::togglePlayAction
    [22:40:38:509] BaseGui::checkStayOnTop
    [22:40:42:012] BaseGui::showMplayerLog
    [22:40:56:875] BaseGui::showLog
    MPlayer log (I've cut out a long list of subtitles' lines):
    /usr/bin/mplayer -noquiet -v -nofs -nomouseinput -sub-fuzziness 1 -identify -slave -vo xv:adaptor=0 -ao alsa -nokeepaspect -framedrop -autosync 100 -nodr -nodouble -input nodefault-bindings:conf=/dev/null -stop-xscreensaver -wid 52429143 -monitorpixelaspect 1 -ass -embeddedfonts -ass-line-spacing 0 -ass-font-scale 1 -ass-styles /home/ondra/.config/smplayer/styles.ass -fontconfig -font Arial -subfont-autoscale 0 -subfont-osd-scale 20 -subfont-text-scale 20 -subcp CP1250 -vid 0 -aid 2 -sub /home/ondra/Plocha/Poirot - S12E02 - The Clocks - ENG.srt -subpos 100 -volume 32 -nocache -ss 417 -osdlevel 0 -idx -vf-add ass -vf-add screenshot -slices -channels 2 -af scaletempo,equalizer=0:0:0:0:0:0:0:0:0:0 -softvol -softvol-max 100 /mnt/ubuntu/home/sdilene/Hercule.Poirot.S12E01.Hodiny.DVDRip.XviD.cz.en-iNG.avi
    MPlayer SVN-r32492-4.5.1 (C) 2000-2010 MPlayer Team
    CPU vendor name: GenuineIntel max cpuid level: 2
    CPU: Intel(R) Pentium(R) 4 CPU 2.40GHz (Family: 15, Model: 2, Stepping: 7)
    extended cpuid-level: 4
    Detected cache-line size is 64 bytes
    Testing OS support for SSE... yes.
    Tests of OS support for SSE passed.
    CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNowExt: 0 SSE: 1 SSE2: 1 SSSE3: 0
    Compiled with runtime CPU detection.
    get_path('codecs.conf') -> '/home/ondra/.mplayer/codecs.conf'
    Reading /home/ondra/.mplayer/codecs.conf: Can't open '/home/ondra/.mplayer/codecs.conf': No such file or directory
    Reading /etc/mplayer/codecs.conf: 159 audio & 349 video codecs
    init_freetype
    Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay
    get_path('fonts') -> '/home/ondra/.mplayer/fonts'
    Configuration: --prefix=/usr --enable-runtime-cpudetection --disable-gui --disable-arts --disable-liblzo --disable-speex --disable-openal --disable-fribidi --disable-libdv --disable-musepack --disable-esd --disable-mga --enable-xvmc --language=all --confdir=/etc/mplayer
    CommandLine: '-noquiet' '-v' '-nofs' '-nomouseinput' '-sub-fuzziness' '1' '-identify' '-slave' '-vo' 'xv:adaptor=0' '-ao' 'alsa' '-nokeepaspect' '-framedrop' '-autosync' '100' '-nodr' '-nodouble' '-input' 'nodefault-bindings:conf=/dev/null' '-stop-xscreensaver' '-wid' '52429143' '-monitorpixelaspect' '1' '-ass' '-embeddedfonts' '-ass-line-spacing' '0' '-ass-font-scale' '1' '-ass-styles' '/home/ondra/.config/smplayer/styles.ass' '-fontconfig' '-font' 'Arial' '-subfont-autoscale' '0' '-subfont-osd-scale' '20' '-subfont-text-scale' '20' '-subcp' 'CP1250' '-vid' '0' '-aid' '2' '-sub' '/home/ondra/Plocha/Poirot - S12E02 - The Clocks - ENG.srt' '-subpos' '100' '-volume' '32' '-nocache' '-ss' '417' '-osdlevel' '0' '-idx' '-vf-add' 'ass' '-vf-add' 'screenshot' '-slices' '-channels' '2' '-af' 'scaletempo,equalizer=0:0:0:0:0:0:0:0:0:0' '-softvol' '-softvol-max' '100' '/mnt/ubuntu/home/sdilene/Hercule.Poirot.S12E01.Hodiny.DVDRip.XviD.cz.en-iNG.avi'
    Using nanosleep() timing
    Terminal type `unknown' is not defined.
    Parsing input config file /dev/null
    Input config file /dev/null parsed: 0 binds
    Setting up LIRC support...
    mplayer: could not connect to socket
    mplayer: No such file or directory
    Failed to open LIRC support. You will not be able to use your remote control.
    get_path('Hercule.Poirot.S12E01.Hodiny.DVDRip.XviD.cz.en-iNG.avi.conf') -> '/home/ondra/.mplayer/Hercule.Poirot.S12E01.Hodiny.DVDRip.XviD.cz.en-iNG.avi.conf'
    Playing /mnt/ubuntu/home/sdilene/Hercule.Poirot.S12E01.Hodiny.DVDRip.XviD.cz.en-iNG.avi.
    get_path('sub/') -> '/home/ondra/.mplayer/sub/'
    [file] File size is 821880832 bytes
    STREAM: [file] /mnt/ubuntu/home/sdilene/Hercule.Poirot.S12E01.Hodiny.DVDRip.XviD.cz.en-iNG.avi
    STREAM: Description: File
    STREAM: Author: Albeu
    STREAM: Comment: based on the code from ??? (probably Arpi)
    LAVF_check: AVI format
    AVI file format detected.
    list_end=0x3324
    ======= AVI Header =======
    us/frame: 40000 (fps=25.000)
    max bytes/sec: 0
    padding: 0
    MainAVIHeader.dwFlags: (272) HAS_INDEX IS_INTERLEAVED
    frames total: 133641 initial: 0
    streams: 3
    Suggested BufferSize: 0
    Size: 640 x 368
    ==========================
    list_end=0x10F4
    ==> Found video stream: 0
    ID_VIDEO_ID=0
    [aviheader] Video stream found, -vid 0
    ====== STREAM Header =====
    Type: vids FCC: xvid (64697678)
    Flags: 0
    Priority: 0 Language: 0
    InitialFrames: 0
    Rate: 25/1 = 25.000
    Start: 0 Len: 133641
    Suggested BufferSize: 125416
    Quality 10000
    Sample size: 0
    ==========================
    Found 'bih', 40 bytes of 40
    ======= VIDEO Format ======
    biSize 40
    biWidth 640
    biHeight 368
    biPlanes 1
    biBitCount 24
    biCompression 1145656920='XVID'
    biSizeImage 1413120
    ===========================
    Regenerating keyframe table for MPEG-4 video.
    list_end=0x2186
    ==> Found audio stream: 1
    ID_AUDIO_ID=1
    [aviheader] Audio stream found, -aid 1
    ====== STREAM Header =====
    Type: auds FCC: (0)
    Flags: 0
    Priority: 0 Language: 0
    InitialFrames: 1
    Rate: 16000/384 = 41.667
    Start: 0 Len: 222719
    Suggested BufferSize: 8064
    Quality -1
    Sample size: 384
    ==========================
    Found 'wf', 30 bytes of 18
    ======= WAVE Format =======
    Format Tag: 85 (0x55)
    Channels: 2
    Samplerate: 48000
    avg byte/sec: 16000
    Block align: 384
    bits/sample: 0
    cbSize: 12
    mp3.wID=1
    mp3.fdwFlags=0x2
    mp3.nBlockSize=384
    mp3.nFramesPerBlock=1
    mp3.nCodecDelay=0
    ==========================================================================
    list_end=0x3218
    ==> Found audio stream: 2
    ID_AUDIO_ID=2
    [aviheader] Audio stream found, -aid 2
    ====== STREAM Header =====
    Type: auds FCC: (0)
    Flags: 0
    Priority: 0 Language: 0
    InitialFrames: 1
    Rate: 16000/384 = 41.667
    Start: 0 Len: 222735
    Suggested BufferSize: 8064
    Quality -1
    Sample size: 384
    ==========================
    Found 'wf', 30 bytes of 18
    ======= WAVE Format =======
    Format Tag: 85 (0x55)
    Channels: 2
    Samplerate: 48000
    avg byte/sec: 16000
    Block align: 384
    bits/sample: 0
    cbSize: 12
    mp3.wID=1
    mp3.fdwFlags=0x2
    mp3.nBlockSize=384
    mp3.nFramesPerBlock=1
    mp3.nCodecDelay=0
    ==========================================================================
    list_end=0x3324
    AVI: dmlh found (size=248) (total_frames=133641)
    list_end=0x3364
    hdr=Software size=43
    Software : VirtualDubMod 1.5.4.1 (build 2066/release)
    list_end=0x309B07A2
    Found movie at 0x380C - 0x309B07A2
    Reading INDEX block, 400890 chunks for 133641 frames (fpos=815466410).
    AVI index offset: 0x3808 (movi=0x380C idx0=0x4 idx1=0x1F8C)
    Auto-selected AVI audio ID = 2
    Auto-selected AVI video ID = 0
    AVI: Searching for audio stream (id:2)
    AVI video size=641146236 (133641) audio size=85530240 (222735)
    VIDEO: [XVID] 640x368 24bpp 25.000 fps 959.5 kbps (117.1 kbyte/s)
    Auto-selected AVI audio ID = 2
    [V] filefmt:3 fourcc:0x44495658 size:640x368 fps:25.000 ftime:=0.0400
    Clip info:
    Software: VirtualDubMod 1.5.4.1 (build 2066/release)
    ID_CLIP_INFO_NAME0=Software
    ID_CLIP_INFO_VALUE0=VirtualDubMod 1.5.4.1 (build 2066/release)
    ID_CLIP_INFO_N=1
    File not found: '/home/ondra/Plocha/Poirot - S12E02 - The Clocks - ENG.srt'
    Failed to open /home/ondra/Plocha/Poirot - S12E02 - The Clocks - ENG.srt.
    File not found: '/home/ondra/Plocha/Poirot - S12E02 - The Clocks - ENG.srt'
    Failed to open /home/ondra/Plocha/Poirot - S12E02 - The Clocks - ENG.srt.
    [ass] ass_read_file(/home/ondra/Plocha/Poirot - S12E02 - The Clocks - ENG.srt): fopen failed
    Cannot load subtitles: /home/ondra/Plocha/Poirot - S12E02 - The Clocks - ENG.srt
    get_path('sub/') -> '/home/ondra/.mplayer/sub/'
    [file] File size is 115710 bytes
    STREAM: [file] /mnt/ubuntu/home/sdilene/Hercule.Poirot.S12E01.Hodiny.DVDRip.XviD.cz.en-iNG.srt
    STREAM: Description: File
    STREAM: Author: Albeu
    STREAM: Comment: based on the code from ??? (probably Arpi)
    SUB: Detected subtitle file format: subviewer
    SUB: opened iconv descriptor.
    SUB: closed iconv descriptor.
    SUB: Read 1352 subtitles, 0 bad line(s).
    [file] File size is 115710 bytes
    STREAM: [file] /mnt/ubuntu/home/sdilene/Hercule.Poirot.S12E01.Hodiny.DVDRip.XviD.cz.en-iNG.srt
    STREAM: Description: File
    STREAM: Author: Albeu
    STREAM: Comment: based on the code from ??? (probably Arpi)
    [ass] Opened iconv descriptor
    [ass] Closed iconv descriptor
    [ass] File size: 300
    [ass] Opened iconv descriptor
    [ass] Closed iconv descriptor
    [ass] [0xa6f6ef8] Style: Default,Arial,20,&H00ffffff,&H00000000,&H00000000,0,0,2,1,1,2,20,20,8
    plaintext event at 1000, +3000: Downloaded From www.AllSubs.org
    plaintext event at 35920, +1670: - Good night Annie.\N- Good night Fi.
    plaintext event at 5286120, +3590: - Yes please.\N- Let's start again.
    plaintext event at 5290710, +10000: Downloaded From www.AllSubs.org
    ID_FILE_SUB_ID=0
    ID_FILE_SUB_FILENAME=/mnt/ubuntu/home/sdilene/Hercule.Poirot.S12E01.Hodiny.DVDRip.XviD.cz.en-iNG.srt
    SUB: Added subtitle file (1): /mnt/ubuntu/home/sdilene/Hercule.Poirot.S12E01.Hodiny.DVDRip.XviD.cz.en-iNG.srt
    ID_FILENAME=/mnt/ubuntu/home/sdilene/Hercule.Poirot.S12E01.Hodiny.DVDRip.XviD.cz.en-iNG.avi
    ID_DEMUXER=avi
    ID_VIDEO_FORMAT=XVID
    ID_VIDEO_BITRATE=959504
    ID_VIDEO_WIDTH=640
    ID_VIDEO_HEIGHT=368
    ID_VIDEO_FPS=25.000
    ID_VIDEO_ASPECT=0.0000
    ID_AUDIO_FORMAT=85
    ID_AUDIO_BITRATE=128000
    ID_AUDIO_RATE=0
    ID_AUDIO_NCH=0
    ID_START_TIME=0.00
    ID_LENGTH=5345.64
    ID_SEEKABLE=1
    ID_CHAPTERS=0
    X11 opening display: :0.0
    vo: X11 color mask: FFFFFF (R:FF0000 G:FF00 B:FF)
    vo: X11 running at 1680x1050 with depth 24 and 32 bpp (":0.0" => local display)
    [x11] Current fstype setting doesn't honour any X atoms
    [VO_XV] Using Xv Adapter #0 (NV17 Video Texture)
    [xv common] Drawing no colorkey.
    [xv common] Maximum source image dimensions: 2046x2046
    Opening video filter: [screenshot]
    Opening video filter: [ass]
    [screenshot] query(Planar YV12) -> 3
    [ass] FreeType library version: 2.4.4
    [ass] FreeType headers version: 2.4.3
    [ass] Init
    get_path('fonts') -> '/home/ondra/.mplayer/fonts'
    get_path('subfont.ttf') -> '/home/ondra/.mplayer/subfont.ttf'
    [ass] Updating font cache
    ==========================================================================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    INFO: libavcodec init OK!
    Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
    ==========================================================================
    ID_VIDEO_CODEC=ffodivx
    ==========================================================================
    Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
    dec_audio: Allocating 4608 + 65536 = 70144 bytes for output buffer.
    mp3lib: using SSE optimized decore!
    MP3lib: init layer2&3 finished, tables done
    MPEG 1.0, Layer III, 48000 Hz 128 kbit Joint-Stereo, BPF: 384
    Channels: 2, copyright: No, original: No, CRC: No, emphasis: 0
    AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)
    ID_AUDIO_BITRATE=128000
    ID_AUDIO_RATE=48000
    ID_AUDIO_NCH=2
    Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
    ==========================================================================
    Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
    [libaf] Adding filter scaletempo
    [libaf] Adding filter equalizer
    [scaletempo] 1.000 speed * 1.000 scale_nominal = 1.000
    [libaf] Adding filter format
    [format] Changing sample format from little-endian 16-bit signed int to little-endian 32-bit float
    [format] Accelerated little-endian 16-bit signed int to little-endian 32-bit float conversion
    [scaletempo] 1.000 speed * 1.000 scale_nominal = 1.000
    [format] Changing sample format from little-endian 16-bit signed int to little-endian 32-bit float
    [format] Accelerated little-endian 16-bit signed int to little-endian 32-bit float conversion
    Trying preferred audio driver 'alsa', options '[none]'
    alsa-init: requested format: 48000 Hz, 2 channels, 1d
    alsa-init: using ALSA 1.0.23
    alsa-init: setup for 1/2 channel(s)
    alsa-init: using device default
    alsa-init: pcm opened in blocking mode
    alsa-init: got buffersize=65536
    alsa-init: got period size 1024
    alsa: 48000 Hz/2 channels/8 bpf/65536 bytes buffer/Float 32 bit Little Endian
    AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
    AO: Description: ALSA-0.9.x-1.x audio output
    AO: Author: Alex Beregszaszi, Zsolt Barat <[email protected]>
    AO: Comment: under development
    Building audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/floatle...
    [scaletempo] 1.000 speed * 1.000 scale_nominal = 1.000
    [format] Changing sample format from little-endian 16-bit signed int to little-endian 32-bit float
    [format] Accelerated little-endian 16-bit signed int to little-endian 32-bit float conversion
    [scaletempo] 1.000 speed * 1.000 scale_nominal = 1.000
    [format] Changing sample format from little-endian 16-bit signed int to little-endian 32-bit float
    [format] Accelerated little-endian 16-bit signed int to little-endian 32-bit float conversion
    ID_AUDIO_CODEC=mp3
    [Mixer] No hardware mixing, inserting volume filter.
    [libaf] Adding filter volume
    [scaletempo] 1.000 speed * 1.000 scale_nominal = 1.000
    [format] Changing sample format from little-endian 16-bit signed int to little-endian 32-bit float
    [format] Accelerated little-endian 16-bit signed int to little-endian 32-bit float conversion
    [scaletempo] 1.000 speed * 1.000 scale_nominal = 1.000
    [format] Changing sample format from little-endian 16-bit signed int to little-endian 32-bit float
    [format] Accelerated little-endian 16-bit signed int to little-endian 32-bit float conversion
    Starting playback...
    SEEK: i=31390 (max:31427) dpos=6703872 (wanted:6703872)
    SEEK: idx=31390 (a:31390 v:31427) v.skip=12 a.skip=0/0.000
    XXX initial v_pts=418.520 a_pos=8064 (0.504)
    [libaf] Reallocating memory in module format, old len = 0, new len = 69637
    Increasing filtered audio buffer size from 0 to 69632
    [mpeg4 @ 0x8a2dc40]Invalid and inefficient vfw-avi packed B frames detected
    [ffmpeg] aspect_ratio: 1.739130
    VDec: vo config request - 640 x 368 (preferred colorspace: Planar YV12)
    Trying filter chain: ass screenshot vo
    VDec: using Planar YV12 as output csp (no 0)
    Movie-Aspect is 1.74:1 - prescaling to correct movie aspect.
    ID_VIDEO_ASPECT=1.7391
    VO Config (640x368->640x368,flags=0,'MPlayer',0x32315659)
    REQ: flags=0x437 req=0x0
    [swscaler @ 0x8ad6520]using unscaled yuv420p -> rgb24 special converter
    REQ: flags=0x437 req=0x0
    VO: [xv] 640x368 => 640x368 Planar YV12
    VO: Description: X11/Xv
    VO: Author: Gerd Knorr <[email protected]> and others
    Xvideo image format: 0x32595559 (YUY2) packed
    Xvideo image format: 0x32315659 (YV12) planar
    Xvideo image format: 0x59565955 (UYVY) packed
    Xvideo image format: 0x30323449 (I420) planar
    using Xvideo port 331 for hw scaling
    *** [ass] Allocating mp_image_t, 640x368x12bpp YUV planar, 353280 bytes
    *** [ass] Allocating mp_image_t, 640x368x12bpp YUV planar, 353280 bytes
    [ass] PlayResX undefined, setting to 384
    *** [vo] Allocating mp_image_t, 640x368x12bpp YUV planar, 353280 bytes
    *** [screenshot] Direct Rendering mp_image_t, 640x368x12bpp YUV planar, 353280 bytes
    Unicode font: 1185 glyphs.
    Unicode font: 1185 glyphs.
    *** [ass] Allocating mp_image_t, 640x368x12bpp YUV planar, 353280 bytes
    ===== PAUSE =====
    ID_PAUSED
    [ass] Font info: family 'Arial', style 'Normal', fullname 'Arial', slant 0, weight 80
    [ass] fontconfig_select: (Arial, 80, 0) -> /usr/share/fonts/TTF/arial.ttf, 0
    ===== PAUSE =====
    ID_PAUSED
    ===== PAUSE =====
    ID_PAUSED
    ===== PAUSE =====
    ID_PAUSED
    So it seems there is no error during the resuming.

  • Miles to Kilometers

    What am I doing wrong
    import java.util.Scanner;
    public class MilesToKm{
    public static void main(String[] args){
    float miles, conversion;
    Scanner scan;
    scan = new Scanner (System.in);
    System.out.println("Please enter number of miles: ");
    miles = scan.nextFloat();
    conversion = miles * 1.609;
    System.out.println("The number of miles in kilometers is: " + conversion +".");
    im getting
    MilesToKm.java:13: possible loss of precision
    found : double
    required: float
    conversion = miles * 1.609;
    ^
    1 error
    ----jGRASP wedge: exit code for process is 1.
    ----jGRASP: operation complete.

    Any floating point literal--e.g. 1.609--is of type double.
    Any calculation that contains a double yields a double result.
    So it's as if you did this:
    double d = 1.234;
    float f = d;You can't stuff a double into a float. If you want to do that assignment, you need to cast:
    float f = (float)d;  // EDIT: Oops, was double in the cast, should've been float. Thanks warnerja.However, you're better off just using double throughout. There's no reason to use float at all.
    Edited by: jverd on Jan 29, 2009 1:20 PM

  • Conversion Vector of Floats to float[]:  exception?

    Java Developers,
    I am able to convert my String vector to a
    String[] but just can't get the Vector with Floats to be converted to a float[] array. I have looked into google and java.sun.com Forums but still cant seem to find the answer. I would really appreciate your help!
    This is how I am making the conversion from Vector(String) to String[]:
    legendLabelsArray = new String[columnHeads.size()];
    int k=0;
    Iterator e = columnHeads.iterator();
    while(e.hasNext()){
    System.out.println("inside the enumerator");
    legendLabelsArray[k] = e.next().toString();
    System.out.println("Array elements at " + k + " are " + legendLabelsArray[k]);
    System.out.println(k++);
    How can I make something similar to work with a Vector with Floats to float[] instead of Strings?
    Thanks,
    Musaddiq
    [email protected]

    Assuming Vector v with Float elements:
    float[] a = new float[v.size()];
    int n = 0;
    for (Iterator i = v.iterator(); i.hasNext(); )
        a[n++] = ((Float) i.next()).floatValue();

  • Precision loss - conversions between exact values and floating point values

    Hi!
    I read this in your SQL Reference manual, but I don't quite get it.
    Conversions between exact numeric values (TT_TINYINT, TT_SMALLINT, TT_INTEGER, TT_BIGINT, NUMBER) and floating-point values (BINARY_FLOAT, BINARY_DOUBLE) can be inexact because the exact numeric values use decimal precision whereas the floating-point numbers use binary precision.
    Could you please give two examples: one where a TT_TINYINT is converted to a BINARY_DOUBLE and one when a TT_BIGINT is converted into a DOUBLE, both cases give examples on lost precision? This would be very helpful.
    Thanks!
    Sune

    chokpa wrote:
    Public Example (float... values){}
    new Example (1, 1e2, 3.0, 4.754);It accepts it if I just use 1,2,3,4 as the values being passed in, but doesn't like it if I use actual float values.Those are double literals, try
    new Example (1f, 1e2f, 3.0f, 4.754f);

  • Float to string conversion

    import java.lang.String;
    import java.lang.Integer;
    import java.lang.Float;
    import java.util.Hashtable;
    import java.util.Enumeration;
    public class VenkatCart {
    protected Hashtable items = new Hashtable();
    public VenkatCart() {
    public void addItem(String idk,int ic,int size,float rate,int qty) {
    String item[]={idk,Integer.toString(ic),Integer.toString(size),Float.toString(rate),Integer.toString(qty)};
    if (items.containsKey(idk)) {
         String tmpItem[] = (String[])items.get(idk);
         int tmpQuant = Integer.parseInt(tmpItem[4]);
         qty += tmpQuant;
         tmpItem[4] = Integer.toString(qty);
    else {
         items.put(idk,item);
    // get an Enumeration to the list of items in the shopping cart
    public Enumeration getEnumeration() {
    return items.elements();
    // get the total cost of all of the items currently in the shopping cart
    public float getCost() {
    Enumeration enum = items.elements();
    String tmpItem[];
    float totalCost = 0.0f;
    while (enum.hasMoreElements()) {
         tmpItem = (String[])enum.nextElement();
         totalCost += (Integer.parseInt(tmpItem[4]) * Float.parseFloat(tmpItem[3]));
    return totalCost;
    // get the total number of items currently in the shopping cart
    public int getNumOfItems() {
    Enumeration enum = items.elements();
    String tmpItem[];
    int numOfItems =0;
    while (enum.hasMoreElements()) {
         tmpItem = (String[])enum.nextElement();
         numOfItems += Integer.parseInt(tmpItem[4]);
    return numOfItems;
    When I call the method "getCost()" from a jsp program, I get the error message
    Error: java.lang.Float: method parseFloat(Ljava/lang/String;)F not found has been reported.
    I think the mistake is in conversion.
    Please help me.
    My thanks in advance.

    Why don't you try the following:
    Float tmpFloat=new Float(tmpItem[3]);
    totalCost += (Integer.parseInt(tmpItem[4]) * tmpFloat.floatValue();
    Justyna

  • Floating point format conversions

    Hi All,
    I have a binary file that has 8 byte floats in it written in VAX D floating point format. It also has 4 byte integers in it. I have to read this file on a Sun Sparc. To get the correct value of the integers I just swap the bytes around and write out the int value, so bytes 0123 get rearranged to be 3210 and then I use that as my int. I tried that with the doubles, reorder bytes 01234567 to 76543210 and then write out the double value but I don't get the value that was stored.
    I read 8 bytes from the file, I'm supposed to get 512.0 but I get garbage.
    The hex dump of the file shows: 0045 0000 0000 0000
    I can't come up with a way to turn that into 512.0
    Another one is 360448.0 with hex dump: b049 0000 0000 0000
    Can anyone show me how to manipulate these bits/bytes to get the correct values?
    Thanks

    Hi Legosa,
    Thanks for looking for a solution for me. The linkhttp://nicmos2.as.arizona.edu/thompson/kfocas/vax2sun.c
    has a C implementation of exactly what I need and has saved me a lot of time and work. Translation to Java will have to use bit shifting I think, the C unions make for a nice implementation.
    I also have to read PC and Cray generated files on my Sun.
    I have found that, like the Vax, Intel x86 including pentium are all little endian and use IEEE so I'm guessing that I just have to do the byte swapping to translate from PC to Sun.
    Crays are Big endian so I don't need byte swapping but I do need to do some manipulation of the exponent and the mantissa.
    Do you know where I might find code that others have done for PC to Sun and Cray to Sun conversions of integers, floats and doubles?
    BTW, for those who may read this later, the solution in vax2sun.c isn't quite right, the author forgot to use the least significant 32 bits and lost 3 bits in the middle but it is very close. To make it closer you have to change the vax2sun.c code a little.
    Replace mantissa and lomant with
    In union ieeebuf
    int mantissa1:20
    int mantissa2:3
    int mantissa3:29
    In union vaxbuf
    int mantissa1:20
    int mantissa2:3
    int mantissa3:29
    int lost_bits:3
    In the code replace d.mantissa = v.mantissa/8 with:
    d.mantissa1 = v.mantissa1
    d.mantissa2 = v.mantissa2
    d.mantissa3 = v.mantissa3
    My few tests showed this gave very good results. The lost_bits are lost because ieee needs 3 more bits for its exponent so it doesn't have room for all of the vax mantissa bits. A little bigger range means a little less precision.

  • Hexvalue to float value conversion

    Hi Everyone,
    I have a hex value "40000000" which its value in float is supposed to be "2" in my xml file.When i do the conversion i get a different value.Can somebody help me figure this out.Thanks

    I have a hex value "40000000" which its value in float is supposed to be "2" There exists a standard IEEE 754 floating point representation, and just by
    coincidence it matches your conversion for this particular value:          int i= 0x40000000;
              float f= Float.intBitsToFloat(i);
              System.out.println("f= "+f);kind regards,
    Jos

  • Float to hex conversion

    Application A has a data type NUMBER and B has a data type BLOB. The data types cannot be changed since we don't have the source codes for both applications.
    The data stored in application A is a float of negative value (--1.7029176). I need to convert it to hex (BFD9F934) and store it in application B to be able to use it.
    Is there a way to code this in PL/SQL?

    I guess you are looking for these conversion functions
    SQL> select rawtohex(-1.7029176) from dual;
    RAWTOHEX(-1.70
    3E641F48542966
    --" or "
    SQL> select dump (-1.7029176,16 ) from dual;
    DUMP(-1.7029176,16)
    Typ=2 Len=7: 3e,64,1f,48,54,29,66

  • Conversion of date to float

    Can anyone tell me how to convert the date value to float value
    Ex now i have a val 30-jul-2007
    this i need to insert as 20070730 i.e yyyymmdd as that field data type is float
    or give me a function for changing the date format as we use format in sql server???
    Thanks in Advance

    michaels>  with tab as (select '30-jul-2007' dt from dual)
    select dt,
           to_number(to_char(to_date(dt,'dd-mon-yyyy'),'yyyymmdd')) fl
    from tab
    DT                  FL
    30-jul-2007   20070730

Maybe you are looking for

  • 10.6.8 Unable to log into the network after update

    07-31-2011 Server: 10.6.8 Client 10.6.8 Just installed the latest updates for my snow leopard server and it will not accept my network login. I have quadruple checked the credentials and then some but it appears to accept the username and pass, displ

  • Takes a long time to save an email after you click the email.

    after an email is saved if you click on the saved email the screen goes white. All other functions work well.

  • Add Date and Time in OBIEE

    Hi , I have two columns in my Physical Table Source, DELIVERY_DATE (contains the date) and DELIVERY_TIME (contains time in hh:mi:ss) ; and I would now like to create a new Logical column to add both DELIVERY_DATE & DELIVERY_TIME to derive DELIVERY_DA

  • Recording a voice and formatting it for e-mail

    my mac book pro is standard with no special programs. how can I record a voice, what format should i save it in to attach it to an e-mail. thanks

  • IOS XE Cisco 4431 NAT Config DNS Issues

    Hi All, I found out that  the XE IOS does not support IP DNS Server and therefor you are required to have a DNS sever seperately. My question is if i push all clients to a public DNS server such as google why does it not work? I can ping out and do N