Int(1.48/0.02) = 73 instead of 74

Bug #387070 reported by Hoffmann
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GCalctool
Fix Released
Medium
gcalctool (Ubuntu)
Fix Released
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 4m-Band 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 Int-function can't be the problem as well...

Hoffmann (hoffmann-p)
description: updated
Revision history for this message
Robert Ancell (robert-ancell) wrote :

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?

Changed in gcalctool (Ubuntu):
status: New → Incomplete
Revision history for this message
Hoffmann (hoffmann-p) wrote :

There was an typo, the right function is Int(347 + (75.695 - 74.215)/0.02) = 420. (so the change is the plus-sign 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...)

Revision history for this message
Robert Ancell (robert-ancell) wrote :

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
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcalctool - 5.27.4-0ubuntu1

---------------
gcalctool (5.27.4-0ubuntu1) karmic; urgency=low

  * New upstream release: (LP: #399160)
    - Update bit editor after shifting (Robert Ancell, Bug #587545) (LP: #394375)
    - Use a base-10 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
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.