[Israel.pm] floating point curiosity

Yishay Weiss yishayjobs at hotmail.com
Wed Jan 4 05:35:32 PST 2006


Check out

http://perl.org.il/pipermail/perl/2005-November/007479.html

Where perlfaq4 is mentioned.


>From: Levenglick Dov-RM07994 <Dov at freescale.com>
>Reply-To: Perl in Israel <perl at perl.org.il>
>To: "'perl at perl.org.il'" <perl at perl.org.il>
>Subject: [Israel.pm] floating point curiosity
>Date: Wed, 4 Jan 2006 14:32:11 +0200
>
>Hi,
>Can someone please explain what is happening here?
>
>#!/usr/local/bin/perl5.6.1
>$float1 = 16.05;
>$float2 = 32.05;
>$float3 = 512.05;
>print $float1, " ", $float1*1000, " ", int ($float1*1000), "\n";
>print $float2, " ", $float2*1000, " ", int ($float2*1000), "\n";
>print $float3, " ", $float3*1000, " ", int ($float3*1000), "\n";
>
>Produces:
>16.05 16050 16050
>32.05 32050 32049
>512.05 512050 512049
>
>The question has to last printed value.
>
> 
>Best Regards,
>Dov Levenglick
>DSP SoC System and Applications Engineer,
>Network and Computing Systems Group
>Freescale Semiconductor Israel
>Tel. +972-9-952-2804
>The information contained in this email is classified as:
>[ ] General Business Information
>[ ] Freescale Internal Use Only
>[ ] Freescale Confidential Propriety
>[x] Personal Memorandum
> 
>
>
>_______________________________________________
>Perl mailing list
>Perl at perl.org.il
>http://perl.org.il/mailman/listinfo/perl





More information about the Perl mailing list