<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Buddika Abeykoon</title>
    <description>The latest articles on DEV Community by Buddika Abeykoon (@buddika_b).</description>
    <link>https://dev.to/buddika_b</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F736353%2F3de32c57-efad-413c-8f11-065b211df81c.jpeg</url>
      <title>DEV Community: Buddika Abeykoon</title>
      <link>https://dev.to/buddika_b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/buddika_b"/>
    <language>en</language>
    <item>
      <title>Why Float and Double Outputs Are Different?</title>
      <dc:creator>Buddika Abeykoon</dc:creator>
      <pubDate>Fri, 08 May 2026 08:59:06 +0000</pubDate>
      <link>https://dev.to/buddika_b/why-float-and-double-outputs-are-different-apo</link>
      <guid>https://dev.to/buddika_b/why-float-and-double-outputs-are-different-apo</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;float f = Long.MAX_VALUE;
double d = Long.MAX_VALUE;

System.out.println("Float max value is : "+ f);
System.out.println("Double max value is : "+ d);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;===============================================&lt;br&gt;
Float max value is : 9.223372E18&lt;br&gt;
Double max value is : 9.223372036854776E18&lt;br&gt;
===============================================*/&lt;/p&gt;

&lt;p&gt;When we assign Long.MAX_VALUE to float and double, both try to store a very large number. But float cannot keep many digits accurately, so Java rounds the value and shows a shorter number like 9.223372E18. double has higher precision, so it can store more digits and shows a more accurate value like 9.223372036854776E18. That’s why both outputs are different even though they come from the same value.&lt;/p&gt;

</description>
      <category>java</category>
      <category>softwareengineering</category>
      <category>softwaredevelopment</category>
    </item>
  </channel>
</rss>
