Forum Academy Marketplace Showcase Pricing Features

Use mathjs to add together values from DB and divide by 2

Hey,

I’m using the DB to add together two number:


The numbers added together are as follows:
(3.7 + 3.6666666666666665)/2

But the output is: 6.78333

This is obviously wrong… What am I missing here?

Could you not just use the native Bubble function to do this?

1 Like

I’m new to Bubble, could you maybe show me how?

Since Bubble doesn’t follow order of operations, you can simply do the average (divide by two) after the addition.

So, in Bubble you can write your expression as A + B / 2

And using your example it will be 3.7 + 3.666 / 2 with each step in order so…

7.366 / 2 = 3.683