// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Reduce rounding error in a numeric sum // Not compiled or tested in-world // Setup: Place in a spare owned prim. Edit SAMPLES with float values of different magnitudes. Touch to run; output is private to the owner. // Stop / restore: Disable/remove. No scene changes or external calls. // Notes: Compensation reduces but cannot eliminate floating-point error; behavior depends on values and simulator float implementation. // License: see LICENSE in this distribution. // Original Incoprea. MIT. list SAMPLES=[100000.0,0.01,0.01,0.01,0.01,-100000.0]; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; float ordinary; float compensated; float correction; integer i; for(i=0;i