make maxval work better near p8 precision limits

This commit is contained in:
Kistaro Windrider 2024-12-29 23:44:39 -08:00
parent 33fede4ed8
commit 175099d778
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -423,9 +423,13 @@ end
function vertmeter(x0,y0,x1,y1,val,maxval,cols) function vertmeter(x0,y0,x1,y1,val,maxval,cols)
if ((val <= 0) or (maxval <= 0)) return if ((val <= 0) or (maxval <= 0)) return
if val < 0x0.001 or maxval < 0x0.001 then
val *= 16
maxval *= 16
end
val=min(val, maxval) val=min(val, maxval)
local h = y1-y0 local h = y1-y0
local px = val/maxval * h \ 1 local px = val*h/maxval \ 1
local ncols = #cols local ncols = #cols
local firstcol = ((h-px)*ncols\h)+1 local firstcol = ((h-px)*ncols\h)+1
local lastbottom = y0+(h*firstcol\ncols) local lastbottom = y0+(h*firstcol\ncols)