12 Replies Latest reply on Mar 19, 2010 11:58 PM by zibzab_1

# Exp Function not working how I want it too – help please!

### Title

Exp Function not working how I want it too – help please!

### Post

I am transporting a formula from excel to filemaker and up to a point everything is fine. There is 1 line that is not returning the result I am after.

the line is:

30 * Exp ( - ((( z - 275) / 25 ) ^ 2 ))

the value of "z" is 45.2070721 in this case, and the above function should return a value of 6.089.

I think it is getting stuck on the "-" in the brackets. This function works fine in excel, but not here. The excel formula looks like this:

=30*EXP(-(((C26-275)/25)^2))

If anyone has any ideas I would be most greatful since this is one of the last of 20 lines in a formula.

• ###### 1. Re: Exp Function not working how I want it too – help please!

I think that gives 6.0897E-36 not 6.0897

• ###### 2. Re: Exp Function not working how I want it too – help please!

Have you seen this?

Not sure if this is "how" it goes wrong but worth a look.

• ###### 3. Re: Exp Function not working how I want it too – help please!

After a bit of testing, it looks like FMP doesn't display number fields with the general format correctly much beyond 30*Exp(-42)  or 3e-17.

The SetPrecision function suggested in the thread above helps alot.

SetPrecision(30*Exp(-(((z - 275)/25)^2)); 40)  gives the right result.

• ###### 4. Re: Exp Function not working how I want it too – help please!

WoodApple wrote:

Have you seen this?

Yes, I have... :smileywink: It has nothing to do with the issue here.

Jade's answer is correct on both counts. Filemaker computes to precision of 15 decimal places (IIRC) and the result is 0. Using SetPrecision() with a precision of 36 or higher will return a more meaningful result.

• ###### 5. Re: Exp Function not working how I want it too – help please!

Hi everyone,

thanks for that – much appreciated. I now get the figure 6.87277486e-40 which is great (new figures).

However, I’ve now encountered what I hope will be my last problem for a while. In excel I have the formula:   =-SIN(2*RADIANS(C35))*C36

C35 = 6.87277486e-40 and C36  = -3.2975E-41

In filemaker I have added the formula as:   SetPrecision ( -Sin ( 2 * Radians ( C35)) * C36 ; 41 )

This returns the value 5.853088383e-46

Any ideas anyone?

• ###### 6. Re: Exp Function not working how I want it too – help please!

SetPrecision() does not work with trigonometric functions (though I wouldn't expect it to return an incorrect result - as it seems to in this case).

• ###### 7. Re: Exp Function not working how I want it too – help please!

If I remove the SetPrecision then filemaker only returns a 0

any ideas how I can get the correct result

• ###### 8. Re: Exp Function not working how I want it too – help please!

I made an error earlier and omitted a minus sign. I get the same result of 0 for both:

-Sin ( 2 * Radians ( C35)) * C36

and

SetPrecision ( -Sin ( 2 * Radians ( C35)) * C36 ; 41 )

Note that 2 * Radians ( C35 ) is 2.399051e-41, and I don't think Filemaker can calculate the Sin of this to a precision greater than 15.

• ###### 9. Re: Exp Function not working how I want it too – help please!

Do you think this is impossible then.

• ###### 10. Re: Exp Function not working how I want it too – help please!

Not sure what you're trying to do. I am not even sure what the "correct" result is - I'd suspect you get 0 in Excel too.

• ###### 11. Re: Exp Function not working how I want it too – help please!

Excel gives approximately 7.91E-82.   I concur with Comment that the FMP Sin function is the problem as it is returning 0.

…and interestingly enough, if I remove the Sin function from the Excel equation, it gives the same answer: 7.91E-82.  So does my HP calculator.

These extremely small values are probably beyond the precision of the functions' algorithms.

You can try this but verify your results:-

• ###### 12. Re: Exp Function not working how I want it too – help please!

Brilliant, that works fine – crazy eh.

Appreciate all your help – this is part of a colour formula which can now be solved.

Many thanks