0

Coders out there - I suspect that's not more than 10 people worldwide:) - ,

I have a very, very simple question:

How can I compute sin, cos, tan or sqrt with a REAL?

a: REAL
b: REAL
...
b := a.power(2) 

works, but ...

a: REAL
b: REAL
...
b := a.sin(2)
b := a.tan(2)
b := a.cos(2)
b := a.sqrt()

... does not.

Dear Internet, please don't let me down!

Paul:)

Paulquappe
  • 15
  • 3

1 Answers1

2

There are two library classes: SINGLE_MATH for REAL_32 and DOUBLE_MATH for REAL_64. If you plan to use only one kind of reals, just inherit from one of the classes and use

        b := sine (a)
        b := cosine (a)
        b := tangent (a)
        b := sqrt (a)

If you want to mix single and double precision reals, you can add once functions like

single_math: SINGLE_MATH
    once
        create Result
    end

and then use

        b := single_math.sine (a)
        b := single_math.cosine (a)
        b := single_math.tangent (a)
        b := single_math.sqrt (a)
Alexander Kogtenkov
  • 5,770
  • 1
  • 27
  • 35