Mercurial > octave
view test/fcn-handle/shared_ctx.m @ 31198:863730dd0f83 stable
nextpow2: Fix for input between 0.5 and 1 (bug #62947).
* scripts/general/nextpow2.m: Switch to a naïve implementation using log2 with
a single output argument and ceil.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Wed, 24 Aug 2022 17:15:34 +0200 |
parents | 8dd50efa3c47 |
children |
line wrap: on
line source
function [add, sub, mul, div] = shared_ctx (val) add = @add_fun; sub = @sub_fun; mul = @mul_fun; div = @div_fun; function r = add_fun (x) val += x; r = val; endfunction function r = sub_fun (x) val -= x; r = val; endfunction function r = mul_fun (x) val *= x; r = val; endfunction function r = div_fun (x) val /= x; r = val; endfunction endfunction