help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Round function


From: Windhorn, Allen E [ACIM/LSA/MKT]
Subject: RE: Round function
Date: Fri, 16 Nov 2018 14:48:31 +0000

-----Original Message-----
From: Help-octave [mailto:address@hidden On Behalf Of Juan Pablo Carbajal

> This is actually an easy fix,
> new_round = @(x, n=0) round (x * 10^n) * 10^(-n)

>> new_round(pi, 1.5)
ans =  3.1307

Maybe new_round = @(x, n=0) round (x * 10^round(n)) * 10^(-round(n))?
Depending on what you expect it to do.

Regards,
Allen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]