• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[vJASS] [Graveyard] Logarithm by Vexorian

I'm not the owner of this code: it's Vexorian.
It's just that it can't be found on internet anymore (even with Wayback Machine to dig into archived old web pages), so I thought it could be posted again here.

JASS:
library Logarithm

   globals
       private constant integer ITERATIONS=20
   endglobals

    function Log takes real x returns real
     local real min=-88.0
     local real max= 88.0
     local real mid
     local integer i=ITERATIONS

        loop
            set mid=(min+max)/2
            exitwhen(i<=0)
            set i=i-1
            if (Pow(bj_E,mid)>=x) then
                set max=mid
            else
                set min=mid
            endif
        endloop
     return mid
    endfunction

    function Logarithm takes real base, real x returns real
     local real min=-88.0
     local real max= 88.0
     local real mid
     local integer i=ITERATIONS

        loop
            set mid=(min+max)/2
            exitwhen(i<=0)
            set i=i-1
            if (Pow(base,mid)>=x) then
                set max=mid
            else
                set min=mid
            endif
        endloop
     return mid
    endfunction

endlibrary
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,468
There are a lot of "lost" resources from wc3campaigns that shouldn't just be preserved on the Wayback Machine in my opinion. There were a lot of quality scripts as well as important discussions shedding light onto their development.

I recommend you create a github gist or an archive repository for resources like this that you just want to "preserve". I am of the mind that something submitted here should be original work or include QoL modifications to original work and (like you've done) give credit where credit is due.

We can leave this in the Graveyard so that it will at least exist if someone does a Google search for a WarCraft 3 logarithm.
 
There are a lot of "lost" resources from wc3campaigns that shouldn't just be preserved on the Wayback Machine in my opinion. There were a lot of quality scripts as well as important discussions shedding light onto their development.

I recommend you create a github gist or an archive repository for resources like this that you just want to "preserve". I am of the mind that something submitted here should be original work or include QoL modifications to original work and (like you've done) give credit where credit is due.

We can leave this in the Graveyard so that it will at least exist if someone does a Google search for a WarCraft 3 logarithm.
Okay, ty.

If you've pointers about what resources among those should not be preserved it would help updating the list of currently best-in-slot GUI/jass/vJass systems :)
 
Top