News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Solving expressions

Started by RuiLoureiro, December 11, 2010, 06:58:37 PM

Previous topic - Next topic

RuiLoureiro

Quote from: Farabi on December 31, 2010, 02:36:40 PM
anyone tried this

mov eax,some_value
xor ecx,ecx
div ecx


I dunno if Im making mistake, but it create a fault on the processor. Anyone experiencing that? I did.

          No, but i think it gives a fault

dedndave

divide by zero is the highest priority condition that x86 CPU's trap   :P
that's why it generates INT0

oex

Quote from: RuiLoureiro on December 30, 2010, 06:07:17 PM
X^0=1                   0^X=0
(Why except 0?)         (Why except 0?)

:lol Because you cant divide by 0.... There are other arguements.... Looks like this one was Euler's....

http://www.faqs.org/faqs/sci-math-faq/specialnumbers/0to0/
http://en.wikipedia.org/wiki/Division_by_zero
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

RuiLoureiro

:lol Because you cant divide by 0.... There are other arguements.... Looks like this one was Euler's....
Quote
oex,
         For me y^x is an indeterminate form when y=0 and x=0.
         For me 0^0 is not 1. I dont follow your point of view.
         If for convenience you want it 1, yes you can why not ?
         Play with 0^0+0^0+0^0+0^0+0^0=5 why not ?

oex

:lol This is OK I dont believe I've ever typed 0^0 before now I was just trying to show you/others the other points, mathmatic and programatic, logical and illogical.... My own expression evaluator uses 0^0=1 but there is no 'right' result, following your posts I may well update this to better error check different scenarios ie 1+0^0=1 but 10*0^0=10.... Currently however my code calculates:

0^0+0^0+0^0+0^0+0^0=5 yes

However in a more usual situation
10*0^0=10 and 0^0 is 'ignored'

This is more important for my expression evaluator as it also does more complex functionality however it really does depend on context what is the right result....
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

RuiLoureiro

i typed 0^0 in all my calculators and they all give ERROR
They dont want to say nothing about it
I play with 1^1+1^1+1^1+1^1+1^1=5

Have a nice new year