Click here to Skip to main content
12,350,134 members (26,424 online)

Welcome to the Lounge

   

For lazing about and discussing anything in a software developer's life that takes your fancy except programming questions.

Technical discussions are encouraged, but click here to ask your programming question.

The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct, no programming questions and please don't post ads.
 
GeneralRe: Malaysian Airlines have lost another plane Pin
glennPattonPUB18-Jul-14 0:18
professionalglennPattonPUB18-Jul-14 0:18 
GeneralRe: Malaysian Airlines have lost another plane Pin
JimmyRopes18-Jul-14 1:23
memberJimmyRopes18-Jul-14 1:23 
GeneralRe: Malaysian Airlines have lost another plane Pin
glennPattonPUB18-Jul-14 2:00
professionalglennPattonPUB18-Jul-14 2:00 
GeneralRe: Malaysian Airlines have lost another plane Pin
JimmyRopes18-Jul-14 2:44
memberJimmyRopes18-Jul-14 2:44 
GeneralRe: Malaysian Airlines have lost another plane Pin
JimmyRopes18-Jul-14 1:22
memberJimmyRopes18-Jul-14 1:22 
GeneralAPOD Pin
mark merrens17-Jul-14 5:57
membermark merrens17-Jul-14 5:57 
GeneralRe: APOD Pin
glennPattonPUB17-Jul-14 6:03
professionalglennPattonPUB17-Jul-14 6:03 
GeneralYou wanna see a real calc bug? Pin
newton.saber17-Jul-14 5:42
membernewton.saber17-Jul-14 5:42 
Four web browsers(opera, safari, firefox, chrome) reports the answer to the following calculation *incorrectly*:
((54/31)+140)

Those 4 browsers return the value : 141.74193548387098
IE reports the value of : 141.74193548387097

Note:The two leading #s in the next example are just for alignment.
if you calculate 54/31 using javascript and browser you get:
##1.7419354838709677

The second one calcs the same equation and simply adds 140 ((54/31)+140) -- to change precision.
141.74193548387098


Notice the digit after the last 9 in the sequence. The rounded up value should be a 7 (round up from 6), but it is reported as an 8 in every browser except IE. You can also compare the value to Windows Calculator for 54/31.

Windows calculator gives : 1.7419354838709677419354838709677
Interesting?

Here's the HTML / JavaScript so you can copy / paste and try in all browsers:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div>Clicking the [Calc] button runs two calculations and shows the result on this page. First calc is: (54/31)</div>
<span style="color:red">Note:</span><span>The two leading #s are just for alignment.</span>
 
<p id="p1">
</p>
<p id="p2">
</p>
<div>The second one calcs the same equation and simply adds 140 ((54/31)+140) -- to change precision.</div>
<div id="extra" style="color:blue"></div>
<input type="button" value="Calc" onclick="DoCalc()"/>
<script type="text/javascript">
var p1 = document.getElementById("p1");
var p2 = document.getElementById("p2");
var extra = document.getElementById("extra");
 
function DoStart()
{
    testdiv.textContent = "started";
}
 
function DoCalc()
{
    p1.textContent = "";
    p1.textContent += "##" + 54/31;//calcObject1.y / calcObject2.x;
    var outval = ((54/31)+140);
    p2.textContent = outval.toString();
    extra.textContent = "Notice the digit after the last 9 in the sequence.";
    extra.textContent += " The rounded up value should be a 7 (round up from 6), but it is reported as an 8 in every browser except IE.";
    extra.textContent += "  You can also compare the value to Windows Calculator for 54/31.  Interesting?";
}
 
</script>
</body>
</html>

GeneralRe: You wanna see a real calc bug? Pin
BobJanova17-Jul-14 6:03
memberBobJanova17-Jul-14 6:03 
GeneralRe: You wanna see a real calc bug? Pin
harold aptroot17-Jul-14 6:10
memberharold aptroot17-Jul-14 6:10 
GeneralRe: You wanna see a real calc bug? Pin
newton.saber17-Jul-14 7:13
membernewton.saber17-Jul-14 7:13 
GeneralRe: You wanna see a real calc bug? Pin
harold aptroot17-Jul-14 7:21
memberharold aptroot17-Jul-14 7:21 
GeneralRe: You wanna see a real calc bug? Pin
newton.saber17-Jul-14 8:21
membernewton.saber17-Jul-14 8:21 
GeneralRe: You wanna see a real calc bug? Pin
Corporal Agarn17-Jul-14 6:26
professionalCorporal Agarn17-Jul-14 6:26 
GeneralRe: You wanna see a real calc bug? Pin
Tim Carmichael17-Jul-14 7:16
memberTim Carmichael17-Jul-14 7:16 
GeneralRe: You wanna see a real calc bug? Pin
newton.saber17-Jul-14 8:19
membernewton.saber17-Jul-14 8:19 
GeneralRe: You wanna see a real calc bug? Pin
thrakazog17-Jul-14 7:25
memberthrakazog17-Jul-14 7:25 
GeneralRe: You wanna see a real calc bug? Pin
John Simmons / outlaw programmer17-Jul-14 8:48
memberJohn Simmons / outlaw programmer17-Jul-14 8:48 
GeneralRe: You wanna see a real calc bug? Pin
newton.saber17-Jul-14 9:38
membernewton.saber17-Jul-14 9:38 
GeneralRe: You wanna see a real calc bug? Pin
John Simmons / outlaw programmer17-Jul-14 9:57
memberJohn Simmons / outlaw programmer17-Jul-14 9:57 
GeneralRe: You wanna see a real calc bug? Pin
newton.saber17-Jul-14 10:18
membernewton.saber17-Jul-14 10:18 
GeneralRe: You wanna see a real calc bug? Pin
Bassam Abdul-Baki18-Jul-14 0:47
professionalBassam Abdul-Baki18-Jul-14 0:47 
GeneralRe: You wanna see a real calc bug? Pin
Fueled By Caffeine18-Jul-14 0:37
memberFueled By Caffeine18-Jul-14 0:37 
GeneralRe: You wanna see a real calc bug? Pin
newton.saber18-Jul-14 2:21
membernewton.saber18-Jul-14 2:21 
GeneralWell, not amazing, just amusing... Pin
mark merrens17-Jul-14 5:17
membermark merrens17-Jul-14 5:17 

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.


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 26 Jun 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid