09-20-2021 03:22 AM
Today i wanted to find out, how much money i'd have to put on my phone, so that eventually my subscription would bring it down to 0.
Each time my subscription (6.99€) renews, my account balance is left at 4.5€. If i fill it manually, 5€ is the lowest amount i can fill it with. I couldn't be arsed to calculate the above on my own so i made a bit of labview code to do it for me.
I'm sure it's terribly inefficient, but it was a quick hack and it works.
---------------
Anyway, the point of this thread is to post the code you wrote when you were too lazy to do something manually 😄
09-20-2021 06:32 AM
@AeroSoul wrote:
I'm sure it's terribly inefficient, but it was a quick hack and it works.
Such as how the array in the inner loop isn't needed at all...
09-20-2021 06:45 AM
Yeah, could have just checked if it's less than 6.99 and call it a day 😛
09-20-2021 10:47 AM - edited 09-20-2021 10:49 AM
@AeroSoul wrote:
Yeah, could have just checked if it's less than 6.99 and call it a day 😛
That too but, I think Tim meant to point out that you put an array on your SR then only care about one value. A sure candidate for the Rube-Goldburg thread.😂🤣🙃
But, we've all had face-palm moments like that.
09-20-2021 12:11 PM - edited 09-20-2021 12:19 PM
I would have been way too lazy to code all that! I am sure there is a "one-liner" solution that fits on a postage stamp. 😄
(I would also definitely do everything in pennies (or local equivalent) using pure integer math. There are way too many places where floating point limitations can accumulate that you never get a zero, ever.)
09-20-2021 12:43 PM
09-20-2021 03:23 PM - edited 09-20-2021 03:33 PM
Examples: kudos for having better Google skills than I
09-21-2021 01:01 AM - edited 09-21-2021 01:01 AM
@altenbach wrote:
A very lazy solution. I am sure it can be simplified 😄
That's just plain wrong... the original calculation was in € 😄
09-21-2021 08:37 AM
That's why I earlier said "Pennies (or local equivalent)". 😄
(my keyboard does not have the euro symbol and I was way too lazy to bring up the charmap. Wasn't that on topic? 😄 )
09-22-2021 04:27 AM
@altenbach ha scritto:
(my keyboard does not have the euro symbol and I was way too lazy to bring up the charmap. Wasn't that on topic? 😄 )
On my system I can enter the "€" symbol by pressing Ctrl+Alt+E: I learned it once and for all 'cause I'm too lazy to bring up the charmap every single time I have to use it (just to stay on topic 😉 )