Resister-color-trio exercise may need clarification

The problem description of the “resister color trio” exercise says that the result should be given in ohms, kiloohms, megaohms, etc. One of the examples given in the description is:

  • orange-orange-red would be 33 and 2 zeros, which becomes 3300 ohms.

I am wondering what unit should I use in this case. The answer should be 3.3 kiloohms, 3300 ohms, or 3 kiloohms and 300 ohms? The test set contains no cases like this.

1 Like

There was an attempt to add a test for that case. There was no consensus on what the correct output ought to be so it was left undefined and up to the implementation to choose :)

1 Like

I know Emacs Lisp, Julia, and V have implemented that as 3.3 kiloohms instead of 3 kiloohms. There are 40+ tracks that implement the exercise though so there might be a few others as well. I don’t recall seeing tracks doing an expected value like “3 kiloohms and 300 ohms”. That doesn’t sound like natural English to me.

“3300 ohms”

@IsaacG I felt that I might have seen some discussion on this topic before, but I could not find it.

@BNAndras I agree that “3 kiloohms and 300 ohms” is not a natural English expression. I just added it half kidding, but we say “3 m 20 cm”, don’t we?

I don’t mean to add anything to the exercise. But it seems odd that the problem description brings up 3300 ohms as an example and then completely ignores such possibility in talking about various resistance units. I thought that the original proposer(s) of the exercise may have some view on this point.

2 Likes

She does, and the bikeshedding over getting a consensus made her abandon that discussion so we left it in the middle since :grinning:

1 Like

If we do decide to restart that conversation, I’d be for adding the 3300 ohms example as a test case.

I’m not sure it’s worth restarting :slight_smile:

1 Like

@SleeplessByte That’s too bad.

@BNAndras I am glad that at least some tracks have the kind of tests.

@IsaacG I appreciate the situation…

On the other hand, it might be worth updating the example in the prose to not use an ambiguous case!

3 Likes

Yeah, that was going to be my other suggestion. :slight_smile:

I think that would be good! That could solve the issue here without making “decisions” about implementation!

1 Like

@Borderite Would you like to propose a change, eg changing the example from 3,300 ohms to 33,000 ohms or 330 ohms?

Yes, I can do it., or I think that we can alternatively add a paragraph at the end of the description:

When a resister’s bands are "orange", "orange", "red", the register value is expressed 3300 ohms or 3.3 kiloohms in real life. Which style is used varies from a language track to another. Please check your track’s tests carefully.

Adding complexity might not add value to the exercise here :slight_smile: More isn’t always better.

@IsaacG OK, I am done with the PR.

At Exercism, we ask for discussions and proposals before PRs. PRs happen once a proposal is discussed and agreed upon.

@IsaacG You probably misunderstood my message. I modified the description as you suggested, (i.e., from 3300 to 330, not adding a paragraph).

Did you propose a change on the forum for discussion? I don’t see a proposal here to discuss and be approved.

OK, it sounds that I misunderstood your signal.