Code: Select all
l.l = 0
m.l = 1 / l
Code: Select all
f.f = 0.0
g.f = 1.0 / f
Code: Select all
g.f = 1.0 / 0.0
Dri
Code: Select all
l.l = 0
m.l = 1 / l
Code: Select all
f.f = 0.0
g.f = 1.0 / f
Code: Select all
g.f = 1.0 / 0.0
Code: Select all
Alpha.f = 0.0
If Alpha <> 0.0
Gamma.f = 1.0 / Alpha
EndIf
Code: Select all
f.f = 0.0
g.f = 1.0 / f
Debug g
1.#INF
I have to ask, why would you want to?Dr. Dri wrote: is it possible to remove this check ?
Its no bug, but if u really want to have an exception when divide by zero with float-numbers try this:Guimauve wrote:The divide by zero without error message it's a MAJOR bug.
Code: Select all
FPU_ControlWord.w
!FSTCW [v_FPU_ControlWord]
FPU_ControlWord ! 4
!FLDCW [v_FPU_ControlWord]
Code: Select all
zero.f = 0.0
Debug 1.0 / zero
FPU_ControlWord.w
!FSTCW [v_FPU_ControlWord]
FPU_ControlWord ! 4
!FLDCW [v_FPU_ControlWord]
Debug 1.0 / zero
It's not really major in my opinion, but I reported it a few days ago anyways.Guimauve wrote:The divide by zero without error message it's a MAJOR bug.
There is no "correct" return value. 1/0 is not infinity.Kaeru Gaman wrote:but the result holds the correct return-value of the FPU:debugsCode: Select all
f.f = 0.0 g.f = 1.0 / f Debug g
1.#INF
Division by zero is an operation for which you cannot find an answer, so it is disallowed. You can understand why if you think about how division and multiplication are related.But no value would work for x because 0 times any number is 0. So division by zero doesn't work.Code: Select all
12 divided by 6 is 2 because 6 times 2 is 12 12 divided by 0 is x would mean that 0 times x = 12
We are not talking about what u've learned in school - you are writting programs which uses the FPU, and if you ask the FPU 1/0 is infinity! (or an exception if you set the ZeroFlag of the FPU ControlWord (see code above))Trond wrote:There is no "correct" return value. 1/0 is not infinity.
You are writing programs in PB and if you ask PB it's not allowed.Deeem2031 wrote:We are not talking about what u've learned in school - you are writting programs which uses the FPU, and if you ask the FPU 1/0 is infinity! (or an exception if you set the ZeroFlag of the FPU ControlWord (see code above))Trond wrote:There is no "correct" return value. 1/0 is not infinity.
Code: Select all
g.f = 1.0 / 0.0
We certainly are! All of this is about that. Now i don't know what your education is but this is actually very very low level math..We are not talking about what u've learned in school
Not true. PB uses doubles and quads for evaluating constant expressions.Kaeru Gaman wrote:PB does not allow it hardcoded, thats whyfails: the compiler doesn't accept the expression.Code: Select all
g.f = 1.0 / 0.0
sure he couldn't because he tries to evaluate constant expressions.
but when you use variables, PB passes the responsability to the FPU,
that will react according to it's ControlWord, like Deeem described.
Code: Select all
a.q = 23372036854775807.0
Debug a