Re: POW Function
Hi Andrew, Thanks for the answer. Also, thanks to Miyako and Jeremy. Spencer actually helped me get this figured out offline, but I didn’t realize we’d gone offline. So its all taken care of. Thanks. -- Cannon.Smith Synergy Farm Solutions Inc. Hill Spring, AB Canada 403-626-3236 > On Jul 24, 2018, at 8:17 PM, Andrew Hickey via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > As Spencer mentioned you need to transform the log from a natural log to > base 10. ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: POW Function
I won't recommend it, but just to illustrate the difference: $rRange:=1200-50 C_LONGINT($rExponent) Begin SQL SELECT LOG10(:$rRange) FROM _USER_SCHEMAS LIMIT 1 INTO :$rExponent End SQL $rMagnitude:=10^$rExponent > But I’m getting an exponent of 7 instead of 3. Any ideas what I’m doing wrong? ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: POW Function
> On 24 Jul 2018, at 17:32, Cannon Smith via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > > In 4D I’m doing this: > > $rRange:=1200-50 > $rExponent:=Int(Log($rRange)) > $rMagnitude:=10^$rExponent > > But I’m getting an exponent of 7 instead of 3. Any ideas what I’m doing wrong? > > Thanks. You’re using log base e. It’s not clear from the docs that 4D has a log base 10 function. You might have to divide by 10 in a loop. Jeremy ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: POW Function
difference btwn log and natural log. try LOG10 > On Jul 24, 2018, at 9:32 AM, Cannon Smith via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > > But I’m getting an exponent of 7 instead of 3. Any ideas what I’m doing wrong? > ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: POW Function
Hi Spencer, Yes, it is! So simple. Thank you. Perhaps some more help from someone? I’m trying to translate some code on the web into 4D. Here are the lines of code along with an explanation: range = max - min; exponent = int(log(range)); magnitude = pow(10, exponent); //So, for example, if your range is from 50 - 1200, the exponent is 3 and the magnitude is 1000. In 4D I’m doing this: $rRange:=1200-50 $rExponent:=Int(Log($rRange)) $rMagnitude:=10^$rExponent But I’m getting an exponent of 7 instead of 3. Any ideas what I’m doing wrong? Thanks. -- Cannon.Smith Synergy Farm Solutions Inc. Hill Spring, AB Canada 403-626-3236 > On Jul 24, 2018, at 10:19 AM, Spencer Hinsdale via 4D_Tech > <4d_tech@lists.4d.com> wrote: > > is it caret? > > 7^3 > ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: POW Function
is it caret? 7^3 > On Jul 24, 2018, at 9:15 AM, Cannon Smith via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > I’m looking for an equivalent function in 4D as the pow function in other > languages. For example: > > > <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow> > ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
POW Function
I’m looking for an equivalent function in 4D as the pow function in other languages. For example: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow> Does anyone know how to do this? My math is really rusty. Thanks. -- Cannon.Smith Synergy Farm Solutions Inc. Hill Spring, AB Canada 403-626-3236 ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **