Int(1.48/0.02) = 73 instead of 74
Affects  Status  Importance  Assigned to  Milestone  

 GCalctool 
Fix Released

Medium


 gcalctool (Ubuntu) 
Low

Unassigned 
Bug Description
Binary package hint: gcalctool
I was trying to calculate a radio channel. The frequency of the first channel is 74.215 MHz, the frequency of my channel is 75.695 MHz. The distance between two channels is 0,02 Mhz and the first channel is #347. (Just for the interested ones, this is german 4mBand BOS).
Now I use Int(347  (75.695  74.215)/0.02) = 420.
But if I do it without Int() it results in 75.695  74.215)/0.02 = 421.
I looked it up and the right channel would be 421. So where is the problem? If I convert 421 to Int it results in 421, so the Intfunction can't be the problem as well...
description:  updated 
Hoffmann (hoffmannp) wrote :  #2 
There was an typo, the right function is Int(347 + (75.695  74.215)/0.02) = 420. (so the change is the plussign after 347). Sorry for that.
But I broke the problem down to: 1.48/0.02 = 74 but Int(1.48/0.02) = 73, still Int(74) = 74 (as I think it should be...)
Robert Ancell (robertancell) wrote :  #3 
Confirmed. Also note Frac(1.48/0.02) = 1 which is also wrong
Changed in gcalctool (Ubuntu):  
importance:  Undecided → Low 
status:  Incomplete → Triaged 
summary: 
 gcalctool calculates wrong + Int(1.48/0.02) = 73 instead of 74 
Changed in gcalctool:  
status:  Unknown → Confirmed 
Launchpad Janitor (janitor) wrote :  #4 
This bug was fixed in the package gcalctool  5.27.40ubuntu1

gcalctool (5.27.40ubuntu1) karmic; urgency=low
* New upstream release: (LP: #399160)
 Update bit editor after shifting (Robert Ancell, Bug #587545) (LP: #394375)
 Use a base10 internal representation (Robert Ancell, bug #585813, bug #585931, bug #560802) (LP: #375356) (LP: #387070)
 Make padding consistent in GUI (Jerry Casiano, Bug #587292)
 Support implicit multiply before functions, e.g. "6 log 3" (Robert Ancell, Bug #586812) (LP: #389533)
 Use inverse notation for trigonometric functions, i.e. "asin" > "sin⁻¹"
 Use lowercase notation for trigonometric and logarithm functions to look
more like standard mathematical notation
 Put spacing around functions, i.e. "sin" > " sin "
 Use subscript for logarithm base two, i.e. "log2" > "log₂"
 Added etched border around display (Robert Ancell, Bug #140836)
 Rewrote out of date man page (Robert Ancell, Bug #585997)
* debian/watch:
 Watch for unstable versions
 Robert Ancell <email address hidden> Tue, 14 Jul 2009 17:41:36 +1000
Changed in gcalctool (Ubuntu):  
status:  Triaged → Fix Released 
Changed in gcalctool:  
status:  Confirmed → Fix Released 
Changed in gcalctool:  
importance:  Unknown → Medium 
If I do the following:
347  (75.695  74.215)/0.02
I get 273 (in both gcalctool and other calculators). What version of gcalctool are you using? Are you using decimal base?