1 view

Skip to first unread message

Aug 31, 2008, 10:38:53 AM8/31/08

to Study-HTDP

While attempting to solve fahrenheit to celsius problem I was trying

to add a simple test which tests the following condition

(= (fahrenheit-to-celsius 0) -17 7/9)

DrScheme allows adding fractions via Menu->Special->Insert Fraction.

However, when I try inserting a fraction for -17 7/9 it gets converted

to -16 2/9.

Is this a bug? 17 7/9 by itself gets added properly but not its

equivalent negative value.

Kartik

to add a simple test which tests the following condition

(= (fahrenheit-to-celsius 0) -17 7/9)

DrScheme allows adding fractions via Menu->Special->Insert Fraction.

However, when I try inserting a fraction for -17 7/9 it gets converted

to -16 2/9.

Is this a bug? 17 7/9 by itself gets added properly but not its

equivalent negative value.

Kartik

Aug 31, 2008, 1:18:44 PM8/31/08

to study...@googlegroups.com

It is not a bug. -17 7/9 can be reduced to -16 2/9. DrScheme reduced

the fraction.

the fraction.

Aug 31, 2008, 1:48:12 PM8/31/08

to Study-HTDP

Hi Kartik,

I figured you would prefer a reply when you woke up, so I posted your

post to the PLT group. It turns out that the way the insert fraction

dialog box is like this:

It takes the whole part and adds it to the fraction specified by the

numerator and denominator. So when we enter -17 it adds that to 7/9,

resulting in -16 2/9. You can run this in the Interactions window:

(check-expect (+ -17 (/ 7 9)) (- (+ 16 (/ 2 9))))

So there are two options:

1. Use the insert fraction dialog with this in mind.

2. Type the fraction out manually: (- (+ 17 (/ 7 9)))

Best wishes,

Grant

I figured you would prefer a reply when you woke up, so I posted your

post to the PLT group. It turns out that the way the insert fraction

dialog box is like this:

It takes the whole part and adds it to the fraction specified by the

numerator and denominator. So when we enter -17 it adds that to 7/9,

resulting in -16 2/9. You can run this in the Interactions window:

(check-expect (+ -17 (/ 7 9)) (- (+ 16 (/ 2 9))))

So there are two options:

1. Use the insert fraction dialog with this in mind.

2. Type the fraction out manually: (- (+ 17 (/ 7 9)))

Best wishes,

Grant

Aug 31, 2008, 1:54:55 PM8/31/08

to study...@googlegroups.com

Hi Grant,

It makes sense now.

Thanks much Douglas, Grant!

Kartik

It makes sense now.

Thanks much Douglas, Grant!

Kartik

--

Stay away from drunk acronym - it is inabbreviated.

Stay away from drunk acronym - it is inabbreviated.

Aug 31, 2008, 2:07:07 PM8/31/08

to Study-HTDP

DrScheme does support proper and improper fractions natively. If you

want to type in the fraction 7/9, just type in 7/9. It's equivalent to

(/ 7 9). But it only understands fractions with a numerator and a

denominator. To do -17 7/9, you'd have to write it one of a few ways:

-160/9

(- (+ 17 7/9))

(- -17 7/9)

want to type in the fraction 7/9, just type in 7/9. It's equivalent to

(/ 7 9). But it only understands fractions with a numerator and a

denominator. To do -17 7/9, you'd have to write it one of a few ways:

-160/9

(- (+ 17 7/9))

(- -17 7/9)

Aug 31, 2008, 3:32:12 PM8/31/08

to study...@googlegroups.com

OK. There is a negative sign in front of the mixed fraction. -17 7/9

is the same as writing -17/1 + 7/9 = -146/9. This can be reduced to

-16 2/9. Now, 17 7/9 is the same as writing 17/1 + 7/9 = 160/9 = 17

7/9.

is the same as writing -17/1 + 7/9 = -146/9. This can be reduced to

-16 2/9. Now, 17 7/9 is the same as writing 17/1 + 7/9 = 160/9 = 17

7/9.

If you're going to use the menu (Insert -> Insert Fraction...),

understand what it's doing. I guess this is getting into more math

then Scheme. There are fractions, improper fractions, and mixed

fractions understand what's happening to them or what you're doing to

them especially when dealing with a negative whole number or a

negative improper fraction.

Below, of course they're not equal. But, -17 7/9 and -16 2/9 can be

reduced. The comparison for equality should use the values -142/9 and

-146/9

(= (/ -142 9) (/ -146 9)) and this is false.

-1 is atomic; therefore, I assume -146 is atomic. -17 is atomic. -17

7/9 isn't atomic because it's an expression. -17/1 + 7/9

(+ (/ -17 1) (/ 7 9))

The kids are screaming... I have to play with them.

Aug 31, 2008, 9:28:22 PM8/31/08

to Study-HTDP

I guess it was a bug.

On Aug 31, 2:32 pm, "Douglas Gregor" <kerrangs...@gmail.com> wrote:

> OK. There is a negative sign in front of the mixed fraction. -17 7/9

> is the same as writing -17/1 + 7/9 = -146/9. This can be reduced to

> -16 2/9. Now, 17 7/9 is the same as writing 17/1 + 7/9 = 160/9 = 17

> 7/9.

>

> If you're going to use the menu (Insert -> Insert Fraction...),

> understand what it's doing. I guess this is getting into more math

> then Scheme. There are fractions, improper fractions, and mixed

> fractions understand what's happening to them or what you're doing to

> them especially when dealing with a negative whole number or a

> negative improper fraction.

>

> Below, of course they're not equal. But, -17 7/9 and -16 2/9 can be

> reduced. The comparison for equality should use the values -142/9 and

> -146/9

>

> (= (/ -142 9) (/ -146 9)) and this is false.

>

> -1 is atomic; therefore, I assume -146 is atomic. -17 is atomic. -17

> 7/9 isn't atomic because it's an expression. -17/1 + 7/9

>

> (+ (/ -17 1) (/ 7 9))

>

> The kids are screaming... I have to play with them.

>

On Aug 31, 2:32 pm, "Douglas Gregor" <kerrangs...@gmail.com> wrote:

> OK. There is a negative sign in front of the mixed fraction. -17 7/9

> is the same as writing -17/1 + 7/9 = -146/9. This can be reduced to

> -16 2/9. Now, 17 7/9 is the same as writing 17/1 + 7/9 = 160/9 = 17

> 7/9.

>

> If you're going to use the menu (Insert -> Insert Fraction...),

> understand what it's doing. I guess this is getting into more math

> then Scheme. There are fractions, improper fractions, and mixed

> fractions understand what's happening to them or what you're doing to

> them especially when dealing with a negative whole number or a

> negative improper fraction.

>

> Below, of course they're not equal. But, -17 7/9 and -16 2/9 can be

> reduced. The comparison for equality should use the values -142/9 and

> -146/9

>

> (= (/ -142 9) (/ -146 9)) and this is false.

>

> -1 is atomic; therefore, I assume -146 is atomic. -17 is atomic. -17

> 7/9 isn't atomic because it's an expression. -17/1 + 7/9

>

> (+ (/ -17 1) (/ 7 9))

>

> The kids are screaming... I have to play with them.

>

Sep 1, 2008, 1:05:24 AM9/1/08

to Study-HTDP

It was. Per the PLT list, it now does what one would expect in the SVN

trunk.

trunk.

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu