English
Source / code snippets

straight maths Ungerade

 

Normann
Strübli
detect whether a number straight or Ungerade is
DEF IsOdd(1) @&(1) & 1 <> 0

If IsOdd (99)

    print "ungerade"

else

    print "gerade"

Endif

 
11/17/05  
 




Melanie
Brayer
Why not MODulo 2???
 
mele (¯`·.¸¸.{ WinXP Pro, XProfan9, XPIA }.¸¸.·´¯)

<Bugs zählen ist besser als Schafe zählen, da der Computer nur so schlau ist wie der der Mensch der ihn bedient.>
11/18/05  
 




Normann
Strübli
i think with MOD is it integrally simply slower

from another Forum:
[quote:cb43b037ef]
still is it, have it with 100.000.000 Compare tested, The Variante with if number and 1 = 1 is around the factor 2 faster as The Variante if number mod 2 = 1.[/quote:cb43b037ef]
 
11/18/05  
 




Michael
Wodrich
there to evident still Informationsbedarf exists, should we it now time stand let.

short Statement to:

If one with Bitmaskierungen operates can The CPU the faster work out as if one with Multiplikation and Division operates. latter are simply grottenlangsam.

and Specifically to question the recognition on straight and ungerade: If the latest bit a number staid is, then is tappt im dunkeln ungerade. this is really The fastest method the recognition.

In Assembler would I z.B. simply the lowermost bit the number in that Carry-Flag schieben and so then a bedingten plunge JC/JNC trigger.

Best wishes
Michael Wodrich
 
Programmieren, das spannendste Detektivspiel der Welt.
11/18/05  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

6.015 Views

Untitledvor 0 min.
Peter Max Müller11/15/17
Michael W.12/23/16
Julian Schmidt10/07/11
Torsten Boo03/05/11

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie