Discuss Scratch
- Discussion Forums
- » Suggestions
- » Dividing by zero should result in a NaN not infinity.
- RedNeckSideKick
- Scratcher
67 posts
Dividing by zero should result in a NaN not infinity.
Hey all! Recently I found out that dividing anything by 0 returns infinity, not the not a number that it should return. This is REALLY making it hard to program things that use complex(ish) math.
I hope this “problem” is sorted out soon!
(P.S. My browser / operating system: MacOS Macintosh X 10.8.5, Safari 6.1.5, Flash 14.0 (release 0), if it helps…)
I hope this “problem” is sorted out soon!
(P.S. My browser / operating system: MacOS Macintosh X 10.8.5, Safari 6.1.5, Flash 14.0 (release 0), if it helps…)
- djdolphin
- Scratcher
1000+ posts
Dividing by zero should result in a NaN not infinity.
Not everything - 0/0 gives you NaN.
!
- TimothyLawyer
- Scratcher
1000+ posts
Dividing by zero should result in a NaN not infinity.
REALLY making it hard to program things that use complex(ish) math.Could you give some examples? This is
BeetleBlocks, WatercolorBot, and Turtle Art
Hover over a name or label to translate into current language
When Earth was… Purple?
☂️
- AonymousGuy
- Scratcher
1000+ posts
Dividing by zero should result in a NaN not infinity.
I thought it some definitions of mathematics x / 0 = infinity, probably because as y approaches 0 in x / y, x becomes larger.
And there's technically a workaround:
And there's technically a workaround:
define divide (num1) by (num2)
if <(num2) = [0]> then
set [return v] to [NaN]
else
set [return v] to ((num1) / (num2))
end
- lalala3
- Scratcher
100+ posts
Dividing by zero should result in a NaN not infinity.
That's wrong. Let me explain. Assuming, for convenience, that x is positive, that's true as y approaches zero but is positive, but if y is negative, then x / y is a large negative number. So, what's the result of something divided by zero? Is it positive or negative infinity? That's the problem with saying that something divided by zero is infinity. I thought it some definitions of mathematics x / 0 = infinity, probably because as y approaches 0 in x / y, x becomes larger.
You could also think of it like this: any number divided by zero is not infinity, because if you multiplied zero by infinity, you wouldn't get the original number; you'd just get zero.
- Julianthewiki
- Scratcher
100+ posts
Dividing by zero should result in a NaN not infinity.
I bet 0/0=0, as 0*0=0. Not everything - 0/0 gives you NaN.
Julianthewiki | Double the Fun | Double the Thrill | Double the Coolness
Daydream: A Book By Julianthewiki | Official Studio | Chapter 1 | Chapter 2 | Chapter 3
World Population Clock | 24,618,660 | Learn More | Suggest Ideas
Two Year Anniversary Special | 101,405,320 | Learn More
Belated Happy Pi Day! | 102,312,109
- seanbobe
- Scratcher
500+ posts
Dividing by zero should result in a NaN not infinity.
noNo, obviously 0/0=9, because 9*0=0.I bet 0/0=0, as 0*0=0. Not everything - 0/0 gives you NaN.
0/0=3.1415926… because 3.1415926…*0=0
- MrNanners
- Scratcher
100+ posts
Dividing by zero should result in a NaN not infinity.
No support. Just read infinity as not a number.
if <not<<((1)/(variable))=[Infinity]> or <((1)/(variable))=[NaN]>>> then
end
That's about it, see yah.
My best and most helpful projects:
Savable Games Engine | Plants Vs. Zombies | Competitive Clicker Game
As a kid, John Lennon, member of the most successful band in history, the Beatles, said, “When I grow up, I want to be happy.” The teachers around him said that he didn't understand the question, but young John said that {the teachers} didn't understand life.
- reallysoftuser
- Scratcher
1000+ posts
Dividing by zero should result in a NaN not infinity.
Guys, this is just how the language works… Also it's useful in scenarios where you need a “infinity” value.
New Itch Cat game! It's a good one.
Oh snap!
New updates for Windows 11 coming soon, including tabs for File Explorer, contextual suggestions across Microsoft 365 apps, Cloud PC integration, a redesigned Quick Assist, App folders for the Start Menu, oh my!
Microsoft is preparing a new email client for Windows 11!
In the latest Windows 11 update, Microsoft is going to give a new look to its classic Outlook email app and make it more user friendly and feature rich like Google Gmail email app.
- dave-alt-4
- Scratcher
1000+ posts
Dividing by zero should result in a NaN not infinity.
no support , that'll break all projects using the 1/0 as infinity , also , whats wrong with infinity? u can code it into NaN anyways
guide to make good projects <3
Think! Is saying if you support a suggestion necessary? No! People can just tell by your constructive post after it. You have more freedom on your tone!
Forumers, especially new, may also get upset if you say “no support!!!” at them! They may take the whole post in a negative tone, and that makes them upset!
Instead, you can kindly say why their suggestion has cons. They will take it as “constructive criticism” and be happy. - dertermenter
Forumers, especially new, may also get upset if you say “no support!!!” at them! They may take the whole post in a negative tone, and that makes them upset!
Instead, you can kindly say why their suggestion has cons. They will take it as “constructive criticism” and be happy. - dertermenter
- CoolBoy4286
- Scratcher
100+ posts
Dividing by zero should result in a NaN not infinity.
No support, I think the reason that dividing by 0 returns infinity is because you can go 0+0+0+0+0… infinite times and you'll never get to the number that you're dividing.
01001110 01100101 01110110 01100101 01110010 00100000 01100111 01101111 01101110 01101110 01100001 00100000 01100111 01101001 01110110 01100101 00100000 01111001 01101111 01110101 00100000 01110101 01110000 if you translate this,
- Virus6120
- Scratcher
100+ posts
Dividing by zero should result in a NaN not infinity.
Except the whole point of division is that repeated addition of the divisor times eventually results in the dividend. 0+0+0+0+0 will never reach any number, even if you add it infinite times. Returning infinity would imply that after adding 0 infinity times you will reach the dividend, which is often not the case! No support, I think the reason that dividing by 0 returns infinity is because you can go 0+0+0+0+0… infinite times and you'll never get to the number that you're dividing.
Now for how computers do division, it's a rather computationally heavy process involving repeated subtraction, hence in the case of a divisor of 0 it would keep trying to subtract 0 from the number (which doesn't do anything), hence infinity sort of makes sense.
Welcoming all contributors, explorers, and kumquats
Heya there, I'm currently doing some renovations to my signature, but you're welcome to stay if you like.
- 6d66yh
- Scratcher
100+ posts
Dividing by zero should result in a NaN not infinity.
If variable is set to -0 it will pass through because 1÷-0=-Infinity. No support. Just read infinity as not a number.if <not<<((1)/(variable))=[Infinity]> or <((1)/(variable))=[NaN]>>> then
end
Integer arithmetic suggestion: https://scratch.mit.edu/discuss/post/5163608/
- BJ273
- Scratcher
84 posts
Dividing by zero should result in a NaN not infinity.
Scratch is coded in JavaScript, and unfortunately, 0/0 in JS returns NaN, and anything else/0 returns infinity. Don't ask why, it just does (I just checked). So JavaScript gets the same results as scratch, because scratch is coded in JS, scratch is just running by JS rules. So sadly, it is best to just find a workaround unless you want scratch to rewrite JS so they can fix a small problem.
Minecraft 2 launch date: https://www.youtube.com/watch?v=dQw4w9WgXcQ
- Discussion Forums
- » Suggestions
- » Dividing by zero should result in a NaN not infinity.