Floating point
i understand that floating point numbers are represented in java at binary numbers..
and that there are decimal values that cannot exactly representable in binary..
one of that i think is 0.1
but why is it that 0.1 can be represented exactly but in the computation it cannot.
i have this program..
public class CTest
public static void main(String[] args)
double d = 1.0;
double d2 = 0.9;
double d3 = 0.1;
System.out.println(""+(d-d2));
System.out.println(""+d3);
}please help..
thanks
I mean this one..
class D {
public static void main(String[] args){
double d = 0.1;
double d2 = 1.0 - 0.9;
System.out.println("d: " + d);
System.out.println("d: " + d2);
[\code]
Similar Messages
-
SQL Loader and Floating Point Numbers
Hi
I have a problem loading floating point numbers using SQL Loader. If the number has more than 8 significant digits SQL Loader rounds the number i.e. 1100000.69 becomes 1100000.7. The CTL file looks as follows
LOAD DATA
INFILE '../data/test.csv' "str X'0A'"
BADFILE '../bad/test.bad'
APPEND
INTO TABLE test
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
Amount CHAR
and the data file as follows
"100.15 "
"100100.57 "
"1100000.69 "
"-2000000.33"
"-100000.43 "
the table defined as follows
CREATE TABLE test
Amount number(15,4)
) TABLESPACE NNUT050M1;
after loading a select returns the following
100.15
100100.57
1100000.7
-2000000
-100000.4
Thanks in advance
RussellActually if you format the field to display as (say) 999,999,999.99, you will see the correct numbers loaded via SQL Loader.
null -
R6002 - floating point not loaded / C++ Runtime Error
Good Evening,
I have been having this problem with Adobe Bridge for a while and tonight sat down to try and solve it. Fresh version of Windows XP reinstalled all programs and this is still happening! Any Ideas?
This error only occurs with Adobe Bridge, I can load Photoshop etc.. all fine.
Error:
"Runtime Error!
Program: C:\ProgramFiles\Adobe\Adobe Bridge CS3\Bridge.exe
R6002
- floating point not loaded"
Here is a print screen..
http://images.unbrokenphotography.co.uk/BridgeError.jpgIs there are answer to this problem? This error message is appearing on an entire lab full of computers. We are running Web Premium CS4
I have tried to reset the Bridge Preferences:
Hold down the Ctrl key and click on Bridge icon to start.
Should get a reset window with 3 options.
Choose the first option
I still get "Runtime Error! Program: C:\Prgram Files\Adobe\Adobe Bridge CS4\Bridge.exe R6002 -floating point support not loaded" -
I have one Captivate 3 project published as a Stand Alone
project with Flash 8 selected. There are 36 slides, no audio, no
eLearning, SWF size and quality are high.
One person who runs this gets an "Invalid Floating Point"
error when he tries to run it the first time. He is running Windows
XP SP2, Firefox 3.0.4. and Flash Player 10.0.12.36. Other Captivate
projects I've created run fine for him. This one sometimes runs
after the first Error message.
Any thoughts on the cause and fix?
Thanks,
JanetiMediaTouch probably doesn't support Floating Point formats - it certainly doesn't mention them in the advertising. Try saving your files as 24-bit PCMs, and they should import fine.
-
Pack and Floating Point Data Type in ABAP
Dear All,
I am new to ABAP. Started with data types. Came across pack and floating point.
Please let me know what PACK and Floating Point stands for with few examples and the main difference between them.
Regards
Arun VHi,
You'd better ask this question in ABAP forum http://forums.sdn.sap.com/forum.jspa?forumID=50 .
Best Regards,
Ada -
Conversion of a floating point type field
Hi,
I'm fetching field ATFLV from table AUSP for a particular value of ATINN.ATFLV is a floating point type field.
Can anyone please guide me as to how to convert this field(ATFLV) from floating point no. to a simple no.?
Helpful answers will be rewarded.
Regards,
Siprahi,
Do like this,
float f = 234.33;
int i = (int) f; // i has value 234.
reward points if helpful.. -
Maximum size of a floating-point number
Morning all,
Does anyone know what the maximum size of a floating point number can be under Solaris 8 running on
a V880?
Regards,
Richard BreckonI'm not sure what you're asking.
The maximum size is 128 bits.
The maximum value is as given in /usr/include/float.h: 1.189731495357231765085759326628007016E+4932L -
Hello All,
I am having some trouble checking the value of a field with Key Figure type Number with 8 byte floating point. I want to read that field and populate another field with an X if true. For example if that field is equal to 5,0000000000000000E+07 then i want to mark the other field with an 'X'.
The problem is in my code, how do i read that number in the fltp field, such as the number above. my code reads as follows for the 'X' field.
if SOURCE_FIELDS-abc123 eq 5000000.
RESULT = 'X'.
endif.
Thanks everyone in advanceYou don't need to worry about converting the code into standard format or floating, just implement your code as you want and it will automatically take care of the conversion. Basically 5,0000000000000000E+07 = 50,000,000.
thanks.
Wond -
Hello,
Running FCP 5.1
Having audio sync issues and was double checking my settings.
Although the sequence presets are at 16 bit, they are showing up in the browser as 32bit Floating Point.
Any thoughts?
I generally capture now at 30 minute increments and actually have always had this issue. FCP 4.5 and 5.1
all settings are where they should be.
although I do notice, obviously when the device is off, the audio output defaults to 'default' not to firewire dv.
thanks
iMac intel Mac OS X (10.4.8)Some more details please. What hardware device are you sourcing the audio clips from? The likely culprit is your capture settings. What preset are you using? Check Audio/Video Settings-Capture Presets and see if the preset you've selected records audio as 32 bit. It will say in the right column after you've selected your preset.
If it says 32 bit there, click Edit to get the Capture Preset Editor. Under Quicktime Audio Settings, the Format field should give you a selection of sample rates and possibly alternate bit depths. If your only choice is 32 bit, (as it is for me when I capture audio via my RME, 32 bit Integer in my case) then you'd be well served by bringing those files into Peak or Quicktime and saving them as 16 bit Integer files to match your sequence settings.
If you've imported these files into FCP from an audio editor that can create 32 bit floating point audio files, eg Kyma, Sequoia, Nuendo, etc. then the same advice applies. The 32 bit files are much larger than they need to be and may upset the apple cart (he he, pun) when pulled into a sequence with different settings. More cpu overhead for sure.
Let us know what you find. -
How to make floating point division
I have tried many alternatives but i couldnt make any single floating point number printed to a page...
I am compiling the servlet with eclipse 3.2 without any error but the jsp page says java.lang.NoSuchFieldError: floatnumber even i have that variable...
i have tried double,float but both of them makes the error above...but i can print long as well.
can anyone teach me to divide 2 integer values and print the exact result like;
3 / 5 = 0.6can anyone teach me to divide 2 integer values and
print the exact result like;
3 / 5 = 0.6
int a= 3, b= 5;
double result= ((double)a)/b;... or any valid variation thereof.
kind regards,
Jos -
Reading Floating Point PLC5 Registers Kills my ability to write to any register
When ever I create an object that reads a PLC5 Floating Point Register(F8:5),it kills my ability to write to any other PLC register. The problem only shows up with Floating Point registers. If I use integer registers (N7:121 etc.)I can read/write fine. It also severely slows down my normal driver scan update time. Even though it is set to scan every 30 seconds, I may only get an update every few minutes. Anyone else ever run into this? Thanks in advance!
Hi,
It might be helpful creating a log file to monitor com port activity.
Here's the Knowledgebase article about it.
http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/cac576863ff648a186256b5900794761?OpenDocument
Another way to check the serial port activity would be using "portmon"
software available at
http://www.sysinternals.com/ntw2k/freeware/portmon.shtml
I hope this helps.
Remzi A.
Applications Engineering
National Instruments -
Cannot get Oracle 10g to start on a G5. Floating point exception
After a very painful 10g (EE) installation process i.e fixing all the following:
1) Created the missing /opt directory
2) Installation of XCode 1.2
3) Fixing the root.sh file
4) Downloaded the crstl file provided by Ron
5) Copied /etc/oratab/oratab to /etc/oratab
I tried bringing up the Oracle 10g instance by logging onto Sql*Plus as sysdba and running
startup nomount pfile ='/Users/oracle/admin/db01/scripts/init.ora''. The instance comes up for a few socunds and crashes. This is what i get in the alert.log
==========================================================
Sat Jul 17 11:40:08 2004
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Picked latch-free SCN scheme 2
KCCDEBUG_LEVEL = 0
Using LOG_ARCHIVE_DEST_10 parameter default value as USE_DB_RECOVERY_FILE_DEST
Autotune of undo retention is turned on.
Dynamic strands is set to TRUE
Running with 2 shared and 18 private strand(s). Zero-copy redo is FALSE
IMODE=BR
ILAT =18
LICENSE_MAX_USERS = 0
SYS auditing is disabled
Starting up ORACLE RDBMS Version: 10.1.0.3.0.
System parameters with non-default values:
processes = 150
sga_target = 146800640
control_files = /Users/oracle/oradata/db01/control01.ctl, /Users/oracle/oradata/db01/control02.ctl, /Users/oracle/oradata/db01/control03.ctl
db_block_size = 8192
compatible = 10.1.0.2.0
db_file_multiblock_read_count= 16
db_recovery_file_dest = /Users/oracle/flash_recovery_area
db_recovery_file_dest_size= 2147483648
undo_management = AUTO
undo_tablespace = UNDOTBS1
remote_login_passwordfile= EXCLUSIVE
db_domain =
dispatchers = (PROTOCOL=TCP) (SERVICE=db01XDB)
job_queue_processes = 10
background_dump_dest = /Users/oracle/admin/db01/bdump
user_dump_dest = /Users/oracle/admin/db01/udump
core_dump_dest = /Users/oracle/admin/db01/cdump
db_name = db01
open_cursors = 300
pga_aggregate_target = 16777216
PMON started with pid=2, OS id=4037
MMAN started with pid=3, OS id=4039
DBW0 started with pid=4, OS id=4041
LGWR started with pid=5, OS id=4043
CKPT started with pid=6, OS id=4045
SMON started with pid=7, OS id=4047
RECO started with pid=8, OS id=4049
Sat Jul 17 11:40:16 2004
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
CJQ0 started with pid=9, OS id=4051
Sat Jul 17 11:40:16 2004
starting up 1 shared server(s) ...
Sat Jul 17 11:40:18 2004
Errors in file /Users/oracle/admin/db01/bdump/db01_ckpt_4045.trc:
ORA-07445: exception encountered: core dump [semop+8] [SIGFPE] [Invalid floating point operation] [0xA0004CE4] [] []
Sat Jul 17 11:40:19 2004
Errors in file /Users/oracle/admin/db01/bdump/db01_mman_4039.trc:
ORA-07445: exception encountered: core dump [semop+8] [SIGFPE] [Invalid floating point operation] [0x41EDB3C] [] []
Sat Jul 17 11:40:21 2004
Errors in file /Users/oracle/admin/db01/bdump/db01_pmon_4037.trc:
ORA-00822: MMAN process terminated with error
Sat Jul 17 11:40:21 2004
PMON: terminating instance due to error 822
Instance terminated by PMON, pid = 4037
==========================================================
Any idea on what needs to be done to fix this error. I remember that i had the very same issue with the Oracle 9i R2 Developers release.
Any help will be greatly appreciated.After a very painful 10g (EE) installation process
i.e fixing all the following:<snip>
Sat Jul 17 11:40:19 2004
Errors in file
/Users/oracle/admin/db01/bdump/db01_mman_4039.trc:
ORA-07445: exception encountered: core dump [semop+8]
[SIGFPE] [Invalid floating point operation]
[0x41EDB3C] [] []
Sat Jul 17 11:40:21 2004
Errors in file
/Users/oracle/admin/db01/bdump/db01_pmon_4037.trc:
ORA-00822: MMAN process terminated with error
Sat Jul 17 11:40:21 2004
PMON: terminating instance due to error 822
Instance terminated by PMON, pid = 4037==============================================> Any idea on what needs to be done to fix this error.
I remember that i had the very same issue with the
Oracle 9i R2 Developers release.
Any help will be greatly appreciated.You mentioned the 9ir2 release. Do you still have any reference to the 9ir2 software in your environment ? With a little luck you have, and in that case it not so hard to find a solution ...
Ronald.
http://homepage.mac.com/ik_zelf/oracle -
How to gather a set of floating point numbers from a web page form?
I am pretty new to Java and I am working on a project to apply Benfords law to find the probability of digits submitted by the user. My first step is to gather set of floating point numbers from a web page. How do I go about doing this? Any suggestion or a proper site where I can learn this stuff will be highly appreciated.
I am using NetBeans IDE 5.5.1 and for this project. I have realized that the first question was not well phrased.
I created a web project with 2 jsp files and a class file in it. When my jsp file runs I ask the user to enter a number for finding the probablility based on Benfords law.
This is what I got so far:
This is input.jsp
<h1></h1>
Please enter a number to be checked
<form action="result.jsp" method="post">
<input type="number" name="number" >
<input type="submit" value="Check number">
</form>
</body>
</html>
This is result.jsp
String number=request.getParameter("number"); -
Floating Point Arithmatic Error
Hi,
I know actionscript represents numbers and double precision
floating point values. I'm having a problem where double arithmatic
in actionscript doesn't match the results of the same double
arithmatic in C++ / C#.
EXAMPLE:
In C++ / C#:
double x, y, x1, y1;
x = 209.4;
y = 148.8;
x1 = 203.0;
y1 = 145.0;
double ddx = x - x1;
double ddy = y - y1;
RESULT
ddx: 6.4000000000000057
ddy: 3.8000000000000114
In Flash ActionScipt 2:
var x, y, x1, y1;
x = 209.4;
y = 148.8;
x1 = 203.0;
y1 = 145.0;
var ddx = x - x1;
var ddy = y - y1;
RESULT
ddx: 6.39999999999992
ddy: 3.80000000000024
After researching Flash / Actionscript "var" stores numerical
values as doubles ( 8 bytes ) just like doubles are stored in C++ /
C# ( 8 bytes ). Why would there be a difference between the results
of ddx and ddy? Are there different implementations of double
floating point math? If so, Is there a way I can mimic the Flash /
Actionscript version in C++ / C#?
Any help would be great!
Thanks!Hmmm, so you're saying the actual binary representation is
the same but they're just displayed differently? -
Hi everybody,
This line:
System.out.println((0.1+0.7)*10);outputs 7.999999999999999
This is due to how floating point numbers are stored. When writing
a code, sometimes it behaves in an intended way, sometimes it doesn't
(like the one above). Is there a way to "predict" when the code is ok and
when isn't ? Are there any tips to be aware of to get around that kind
of problems ?
Cheers,
AdrianNo. Using BigDecimal just because you don't understand how floating-point numbers work would be... um... short-sighted. And it wouldn't help, either. As soon as you divide 1 by 3 then you have to know how decimal numbers work, which is essentially the same problem.
Edit: I forgot the forum hasn't been automated to provide the mandatory link for people who ask this question. We still have to do it by hand.
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Edited by: DrClap on Oct 11, 2007 3:02 PM -
Floating point precision of "Flatten to XML"
It appears that the "Flatten to XML" function (LV 7.1.1) truncates floating point numbers to 5 decimal places. This is a rather annoying limitation, since I'm trying to store a relative time in hours, accurate to the second (chosen by a previous coder that I have to be compatible with - otherwise I'd just use seconds). Is there a workaround to this? (other than multiplying by some power of 10 before flattening, and dividing after unflattening)
JaegenHi Paul and Jaegen,
I checked our databases and found entries of product suggestions and
corrective action requests for the behavior of the limited precision
when flattening to XML. I found an interesting reply from a LabVIEW
developer on the request for further precision:
The Flatten To XML primitive puposefully cuts off all numbers at 5
digits after the decimal. There are 3 main reasons for this:
Information regarding precision is not propagated on the wire.
Therefore, there is no real way to know how many significant digits or
even places past the decimal point is appropriate when data is
flattened to XML.
Bloat. If all floating point values printed all of the possible
decimal digits all of the time, this would provide for some very large
blocks of XML code.
Given the arbitrarily complex nature of LabVIEW data, it is
difficult to provide a method for specifying precision. For example, if
a user has a cluster of clusters, each of which contain a single,
double and extended representing various measurements of differing
accuracy, how can one precision setting be applied to each of these
values? The user would have to unbundle (and index if an array was
involved), flatten, concatenate, and then the reverse on the unflatten
side.
I suggest that you go ahead and file a new product suggestion by using the "feedback" link on www.ni.com/contact.
It would be best if you could give some detailed information on how you
would like LabVIEW to handle different scenarios while getting around
the above issues.
Thanks for the feedback!
- Philip Courtois, Thinkbot Solutions
Maybe you are looking for
-
How to delete a table in spite of a Reference...
Hi, i have a little Problem... I made two tables: CREATE TABLE one( NR INTEGER, xyz INTEGER REFERENCES two(abc), PRIMARY KEY (NR) CREATE TABLE two( abc INTEGER, jhg CHAR(3), PRIMARY KEY (abc) Now i want to delete table two: DROP TABLE two; But then t
-
Create key mapping using import manager for lookup table FROM EXCEL file
hello, i would like create key mapping while importing the values via excel file. the source file containing the key, but how do i map it to the lookup table? the properties of the table has enable the creation of mapping key. but during the mapping
-
iphone not appears at Itunes after updating to ios 6.0.2 and I cannot switch on Iphone - there's only "connect USB to Itunes" icon shown. What should I do?
-
I have emails that ask for certian items to be addressed such as "please fix leak in bath sink" and then the next line will have another request and on and on. I would like to answer each question at the end of each line with a response (preferably i
-
Mac OS 10.6.8 keeps crashing
Would going to Moutain Lion help with this? Evertime I try to back up my Mac Using CronosSync or try copying large file (ie.iTunes music) it freeze my Mac.