Division durch Null

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Division durch Null

Re: Division durch Null

Post by Julius » 31 Mar 2018, 14:51

Ja, das war mir wirklich noch nie aufgefallen. Da hätte ich auch im Traum nicht mit gerechnet. Danke!

Re: Division durch Null

Post by just me » 31 Mar 2018, 06:55

Moin Julius,
Ausdrucksoperatoren (in absteigender Priorität) wrote: * / //:
Eine Division durch 0 erzeugt ein leeres Ergebnis (leere Zeichenkette).
In AHK 1.1 werden leere Zeichenketten in mathematischen Operationen manchmal als 0 behandelt.

Frohe Ostern!
just me

Division durch Null

Post by Julius » 31 Mar 2018, 06:39

Hi, wahrscheinlich ist das ein alter Hut, ich habe es trotzdem jetzt erst entdeckt, dass AHK die Division durch Null erlaubt, ohne eine Fehlermeldung auszuwerfen:

Code: Select all

nom := 0
denom := 1
x := denom/nom
MsgBox % x
x := round(x, 1)
MsgBox % x
ExitApp
Die erste msgbox bleibt ja noch verschämt leer, aber nach dem Runden zeigt die zweite als Ergebnis 0.0 an. Was hab ich übersehen?

Frohe Ostern, btw :cookie:

Top