Click here to Skip to main content
15,894,720 members
Home / Discussions / Java
   

Java

 
GeneralRe: viewing Java disassembly Pin
Dave Kreskowiak12-Jan-24 12:14
mveDave Kreskowiak12-Jan-24 12:14 
There is only ever a single comparison made for each comparison operator, so if your code only has a single '==' operator, the JIT'd code will only generate a single IL comparison.

-0.0 does occur when a negative floating-point value is so small that is cannot be represented. That does NOT mean it's a different 0 from positive 0.0. You can see this is you try to convert an extremely small value to a string and output it. You can get -0.0.

If your code, the compiler will evaluate the comparison and optimize it out, replacing the expression with just 'true'. The resulting code, and what you see in the disassembly, will be very close to:
Java
if (true) System.out.println("they're equal");

or, depending on code around this, maybe even:
Java
System.out.println("they're equal");


If you want to know how numbers are represented in Java, and most other languages, read The IEEE Standard for Floating-Point Arithmetic (IEEE 754)[^]


modified 12-Jan-24 18:49pm.

QuestionHow can I integrate ChatGPT into my Spring Boot application? Pin
Nata Bil27-Dec-23 22:57
Nata Bil27-Dec-23 22:57 
AnswerRe: How can I integrate ChatGPT into my Spring Boot application? Pin
Richard MacCutchan27-Dec-23 23:47
mveRichard MacCutchan27-Dec-23 23:47 
GeneralRe: How can I integrate ChatGPT into my Spring Boot application? Pin
Gerry Schmitz28-Dec-23 6:41
mveGerry Schmitz28-Dec-23 6:41 
GeneralRe: How can I integrate ChatGPT into my Spring Boot application? Pin
Richard MacCutchan28-Dec-23 6:58
mveRichard MacCutchan28-Dec-23 6:58 
AnswerRe: How can I integrate ChatGPT into my Spring Boot application? Pin
jschell29-Dec-23 5:19
jschell29-Dec-23 5:19 
Questiondebugger stop button behaving weirdly Pin
mike741120-Dec-23 19:08
mike741120-Dec-23 19:08 
AnswerRe: debugger stop button behaving weirdly Pin
Gerry Schmitz20-Dec-23 20:45
mveGerry Schmitz20-Dec-23 20:45 
GeneralRe: debugger stop button behaving weirdly Pin
jschell21-Dec-23 3:41
jschell21-Dec-23 3:41 
GeneralRe: debugger stop button behaving weirdly Pin
Gerry Schmitz21-Dec-23 7:41
mveGerry Schmitz21-Dec-23 7:41 
GeneralRe: debugger stop button behaving weirdly Pin
jschell22-Dec-23 6:00
jschell22-Dec-23 6:00 
AnswerRe: debugger stop button behaving weirdly Pin
Richard MacCutchan20-Dec-23 22:09
mveRichard MacCutchan20-Dec-23 22:09 
AnswerRe: debugger stop button behaving weirdly Pin
jschell21-Dec-23 3:48
jschell21-Dec-23 3:48 
AnswerRe: debugger stop button behaving weirdly Pin
Richard MacCutchan21-Dec-23 23:09
mveRichard MacCutchan21-Dec-23 23:09 
QuestionIntellij Pin
anderson mendes 202312-Dec-23 9:13
anderson mendes 202312-Dec-23 9:13 
AnswerRe: Intellij Pin
Richard MacCutchan12-Dec-23 22:04
mveRichard MacCutchan12-Dec-23 22:04 
QuestionJava strings Pin
mike74114-Dec-23 16:12
mike74114-Dec-23 16:12 
AnswerRe: Java strings Pin
Richard MacCutchan4-Dec-23 22:17
mveRichard MacCutchan4-Dec-23 22:17 
GeneralRe: Java strings Pin
Andre Oosthuizen5-Dec-23 8:47
mveAndre Oosthuizen5-Dec-23 8:47 
GeneralRe: Java strings Pin
Richard MacCutchan5-Dec-23 9:26
mveRichard MacCutchan5-Dec-23 9:26 
AnswerRe: Java strings Pin
jschell5-Dec-23 5:26
jschell5-Dec-23 5:26 
GeneralRe: Java strings Pin
trønderen5-Dec-23 11:29
trønderen5-Dec-23 11:29 
GeneralRe: Java strings Pin
jschell6-Dec-23 6:33
jschell6-Dec-23 6:33 
GeneralRe: Java strings Pin
trønderen6-Dec-23 9:53
trønderen6-Dec-23 9:53 
GeneralRe: Java strings Pin
jschell7-Dec-23 4:43
jschell7-Dec-23 4:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.