[AusNOG] Looking for employees? Melbourne based

Beeson, Ayden ABeeson at csu.edu.au
Fri Oct 11 15:59:05 EST 2013


Yep it has been pointed out to me that Perl simply hid its trickery :)

I had wondered but I wasn't able to reproduce it in the few minutes I gave it, the example I was given to show it was $ perl -e 'printf "%0.20f\n", 0.2 + 0.1;' (thanks Lee!)

Same result, unfortunately Binary math doesn't quite translate to base10 math no matter what handles it :)

Thanks,
Ayden Beeson


-----Original Message-----
From: Ross Wheeler [mailto:ausnog at rossw.net]
Sent: Friday, 11 October 2013 3:55 PM
To: Beeson, Ayden
Cc: Alex Samad - Yieldbroker; ausnog at lists.ausnog.net
Subject: Re: [AusNOG] Looking for employees? Melbourne based


> I even went to confirm it to see if Perl didn't have that problem:
> perl
> print 0.2+0.1;
> 0.3
>
> Working as intended :)

The problem of floating point approximating numbers that are not exact powers of 2 remains the problem, regardless of how your chosen language handles it.

$ echo "scale=50; 1/10+2/10"|bc
.30000000000000000000000000000000000000000000000000

$ awk 'BEGIN{printf("%.40f\n",1/10+2/10)}'
0.3000000000000000444089209850062616169453


Charles Sturt University

| ALBURY-WODONGA | BATHURST | CANBERRA | DUBBO | GOULBURN | MELBOURNE | ONTARIO | ORANGE | PORT MACQUARIE | SYDNEY | WAGGA WAGGA |

LEGAL NOTICE
This email (and any attachment) is confidential and is intended for the use of the addressee(s) only. If you are not the intended recipient of this email, you must not copy, distribute, take any action in reliance on it or disclose it to anyone. Any confidentiality is not waived or lost by reason of mistaken delivery. Email should be checked for viruses and defects before opening. Charles Sturt University (CSU) does not accept liability for viruses or any consequence which arise as a result of this email transmission. Email communications with CSU may be subject to automated email filtering, which could result in the delay or deletion of a legitimate email before it is read at CSU. The views expressed in this email are not necessarily those of CSU.

Charles Sturt University in Australia  http://www.csu.edu.au  The Grange Chancellery, Panorama Avenue, Bathurst NSW Australia 2795  (ABN: 83 878 708 551; CRICOS Provider Numbers: 00005F (NSW), 01947G (VIC), 02960B (ACT)). TEQSA Provider Number: PV12018

Charles Sturt University in Ontario  http://www.charlessturt.ca 860 Harrington Court, Burlington Ontario Canada L7N 3N4  Registration: www.peqab.ca

Consider the environment before printing this email.

Disclaimer added by CodeTwo Exchange Rules 2007
http://www.codetwo.com




More information about the AusNOG mailing list