• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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
 
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