I have something with pow I need to return a whole inter for different results (reversed basically)
For Example (rounded to 4 decimals):
<?php
$var = 10 * pow(1.01,0); // = 10
$var = 10 * pow(1.01,1); // = 10.1
$var = 10 * pow(1.01,2); // = 10.201
$var = 10 * pow(1.01,3); // = 10.303
etc
How could I return the whole number for 10.1150 = 1 since it is above 10 * pow(1.01,1); and below 10 * pow(1.01,2);
The 1.01 can also be a number of variables, (percentage scaled point and figure charting), why I need the Whole number only of the percentage differences (1 box = 1 percentage change from the box above or below)
Thanks much all, I've battled with this issue in many different ways including x all price data points for 250 percentage changed into an array, that is fast, except to build the array becomes the slow issue. if else is the current solution but for 2500 price points on 250 charts = 2 seconds just to find a plot point, considering I'm doing 10's of millions of charts daily, 2 seconds = a lot of time accumulated.
Have you tried using log? It's the reverse of the pow function.
$orig = floor(log($var/10,1.01));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With