Results 1 to 10 of 10
Thread: machine epsilon
- 09-23-2008, 05:59 PM #1
Member
- Join Date
- Sep 2008
- Posts
- 58
- Rep Power
- 0
- 09-23-2008, 07:09 PM #2
have you tried writing a program to test this?
If not, do.
Are you using float to mean the java float type?
What is the smallest number that a float can hold?
What is the smallest number that a double can hold?
- 09-23-2008, 07:23 PM #3
Member
- Join Date
- Sep 2008
- Posts
- 58
- Rep Power
- 0
For IEEE754 single precision 24 dgits, which include 7 decimals. (float)
For IEEE754 double precision 53 digits, which include 15 decimal places (double)
I have a program that achieves this formula 1.0 + epsilon ==1.0
i.e. epsilon is a biggest small number that is not big enough to change 1.0.Last edited by rosh72851; 09-23-2008 at 09:26 PM.
- 09-23-2008, 09:29 PM #4
Member
- Join Date
- Sep 2008
- Posts
- 58
- Rep Power
- 0
Ok I figured how to do that.
Next question, how do I convert float and double data types to binary. For float, ive used the function
But the answer doesnt seem to be right.Java Code:Integer.toBinaryString(Float.floatToRawIntBits(value));
Please suggest.
- 09-23-2008, 10:19 PM #5
Everything in a computer is in binary. What format are you looking for? A String of "0"s and "1"s? or what?how do I convert float and double data types to binary
What does the output look like? Please post it.answer doesnt seem to be right.
Can you post the code that demos this?1.0 + epsilon ==1.0
- 09-23-2008, 10:31 PM #6
Member
- Join Date
- Sep 2008
- Posts
- 58
- Rep Power
- 0
Well obviously a string is the easiest way.Everything in a computer is in binary. What format are you looking for? A String of "0"s and "1"s? or what?
If I input a value 1. The result I get isWhat does the output look like? Please post it.
Ive already solved the epsilon problem.Java Code:111111100000000000000000000000
- 09-23-2008, 10:34 PM #7
Member
- Join Date
- Sep 2008
- Posts
- 58
- Rep Power
- 0
Going over the internet I can get ways only how to convert integers and not decimals (floats). If you could tell me how it works in real time, I can work on it myself.
- 09-24-2008, 12:14 AM #8
If you just want to see the internal values of various variables you could use the DataOutputStream. It has methods to output different types.
Either write to a disk file or use a ByteArray to hold the output.
Why do you think that value is wrong? It looks like it has enough bits.111111100000000000000000000000
The internal format for floats must be documented in many places online.
- 09-24-2008, 12:33 AM #9
Member
- Join Date
- Sep 2008
- Posts
- 58
- Rep Power
- 0
This definitely is not the binary for integer 1.111111100000000000000000000000
- 09-24-2008, 03:16 AM #10
Similar Threads
-
machine epsilon
By rosh72851 in forum New To JavaReplies: 2Last Post: 09-23-2008, 10:21 PM -
32 bit machine or 64 bit machine
By Kapil Gupta in forum Advanced JavaReplies: 13Last Post: 06-24-2008, 03:29 AM -
Getting name/ip of a machine
By Java Tip in forum Java TipReplies: 0Last Post: 03-02-2008, 07:11 PM -
Too many virtual Machine
By davantmay in forum Java AppletsReplies: 1Last Post: 07-06-2007, 10:53 PM -
Virtual Machine To Pda
By Heather in forum Advanced JavaReplies: 2Last Post: 06-30-2007, 03:11 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks