Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Log#

Math / Arithmetic / Log

  • Can Read

  • Cannot Write

Description#

Returns the logarithm of a specified number in a specified base

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Log")]
    [Category("Math/Arithmetic/Log")]
    
    [Description("Returns the logarithm of a specified number in a specified base")]
    [Image(typeof(IconLog), ColorTheme.Type.Yellow)]
    
    [Keywords("Base", "Logarithm")]
    
    [Serializable]
    public class TypeNumberMathLog : TypeNumber
    {
        [SerializeField] private GetNumber m_Number = new GetNumber();
        [SerializeField] private GetNumber m_Base = new GetNumber();

        public override double GetPreview(GameObject source) => Math.Log(this.m_Number.GetPreview(source), this.m_Base.GetPreview(source));

        public override double Get(Args args)
        {
            double number = this.m_Number.Get(args);
            double logBase = this.m_Base.Get(args);
            return Math.Log(number, logBase);
        }

        public override string ToString()
        {
            return $"Log({this.m_Number}, {this.m_Base})";
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.