Discuss Scratch

rrch6000
Scratcher
16 posts

Number Stuff

I need an equation that make's low numbers (that are not negative) into high numbers.

Please help!
HardClaw57
Scratcher
500+ posts

Number Stuff

Do you mean using

0+00-00*00/0
dimitrip
Scratcher
500+ posts

Number Stuff

To turn something (lets's say variable x) between 0 and 1, into something between infinite and 1, you can use
1/x
Greetz,
Dimitri.
rrch6000
Scratcher
16 posts

Number Stuff

I don't want the number to be random
gtoal
Scratcher
1000+ posts

Number Stuff

rrch6000 wrote:

I need an equation that make's low numbers (that are not negative) into high numbers.
I don't want the number to be random

OK, you're about 1/10th the way towards specifying what you want in enough detail to actually implement it. Keep going.
rrch6000
Scratcher
16 posts

Number Stuff

Well, if the number is high then the output will be low. And the higher the number gets, then the lower the output is.

If the number is low, then the output is high. the lower the number, the higher the output.

The output cannot be negative though.
TheLogFather
Scratcher
1000+ posts

Number Stuff

A few questions…

Do you have a limited range for the input number? Or could it have any value? Can it be negative? Can it be zero? Can it be only integer?

And the output… do you want it to be within some (positive) range? Can it be zero? If it can be zero, would that correspond to the input being infinite (or its max. possible value)? Do you want the output to be only an integer?

If you could provide any more info about the context for this numerical transformation, it would help to narrow down the possible algorithms…

Last edited by TheLogFather (July 13, 2015 15:11:13)

discocarp
New Scratcher
7 posts

Number Stuff

The simplest answer, if you have a range of values, is result=max-val. Add one if you don't want zeroes.

Example, your numbers will always be between 1 and 100, and you want your result to also be between 1 and 100.

In this case, use: result=101-val

So if val is 65:

result=101-val
result=101-65
result=36
rrch6000
Scratcher
16 posts

Number Stuff

So… can you please put this in scratch blocks.
dimitrip
Scratcher
500+ posts

Number Stuff

Sure.
setNumberto65setOutputto101-Number
rrch6000
Scratcher
16 posts

Number Stuff

Okay! now I see! Thanks!

Powered by DjangoBB