Absolute function

So something like absolute(1000000000) doesn't return a magnitutide, but instead 1000000000. Am I doing something wrong?

1 Like

Hello, kindly show us your blocks
:wink:

Yes.

abs Returns the absolute value of the given number. abs returned what it should. You might google absolute value to understand what a function like that returns. If a number is negative, it will return the positive value (the number times -1); if a number is positive, it will return the number.

See Math blocks

image

I was hoping it could return a mantra like javascript does.

Read the App Inventor documentation if you want to code using App Inventor; it is not javascript.

absoluteMath

1 Like

image
I made something like this that sort of works, but is resource heavy and slows down everything BY A LOT. Any ideas on how to optimize? Thanks!

Use the webviewer together with some Javascript, see an example here

Taifun

What if I want to put the file with the app? I want to upload the file and have it there, as I don't think it will work if you keep a path. Thanks!

It's called a mantissa, not a mantra.

a mantissa, not a mantra

a mantissa, not a mantra.

a mantissa, not a mantra.

...

What does the "abs" procedure of your post #7 ?. Looking for the characteristic and the mantissa of a number?

upload it into the assets of your app, also known as media section in the designer

Taifun

Logs it into a power of 10.

i.e. 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 = 1x10^100


math.aia (31.1 KB)

1 Like

It is Scientific Notation
https://www.mathsisfun.com/numbers/scientific-notation.html

Mantissa is:

bor_mantissa.aia (3.5 KB)

2 Likes