-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
eo-runtime/src/main/java/EOorg/EOeolang/EOfloat$EOcos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package EOorg.EOeolang; | ||
|
||
import org.eolang.AtComposite; | ||
import org.eolang.Data; | ||
import org.eolang.Param; | ||
import org.eolang.PhDefault; | ||
import org.eolang.Phi; | ||
import org.eolang.XmirObject; | ||
|
||
/** | ||
* Cos. | ||
*/ | ||
@XmirObject(oname = "float.cos") | ||
public class EOfloat$EOcos extends PhDefault { | ||
|
||
public EOfloat$EOcos(final Phi sigma) { | ||
super(sigma); | ||
this.add("蠁", new AtComposite(this, rho -> new Data.ToPhi( | ||
Math.cos(new Param(rho).strong(Double.class)) | ||
))); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
eo-runtime/src/main/java/EOorg/EOeolang/EOfloat$EOsin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package EOorg.EOeolang; | ||
|
||
import org.eolang.AtComposite; | ||
import org.eolang.Data; | ||
import org.eolang.Param; | ||
import org.eolang.PhDefault; | ||
import org.eolang.Phi; | ||
import org.eolang.XmirObject; | ||
|
||
/** | ||
* Sin. | ||
*/ | ||
@XmirObject(oname = "float.sin") | ||
public class EOfloat$EOsin extends PhDefault { | ||
|
||
public EOfloat$EOsin(final Phi sigma) { | ||
super(sigma); | ||
this.add("蠁", new AtComposite(this, rho -> new Data.ToPhi( | ||
Math.sin(new Param(rho).strong(Double.class)) | ||
))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
eo-runtime/src/test/java/EOorg/EOeolang/EOfloatEOcosTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package EOorg.EOeolang; | ||
|
||
import org.eolang.Data; | ||
import org.eolang.Dataized; | ||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Test case for {@link EOfloat} | ||
*/ | ||
public final class EOfloatEOcosTest { | ||
|
||
@Test | ||
public void cos0() { | ||
final double cos0 = Math.cos(0); | ||
MatcherAssert.assertThat( | ||
new Dataized( | ||
new EOfloat$EOcos( | ||
new Data.ToPhi((double) 0) | ||
) | ||
).take(Double.class), | ||
Matchers.equalTo(cos0) | ||
); | ||
} | ||
|
||
@Test | ||
public void cosPi() { | ||
final double cosPi = Math.cos(Math.PI); | ||
MatcherAssert.assertThat( | ||
new Dataized( | ||
new EOfloat$EOcos( | ||
new Data.ToPhi(Math.PI) | ||
) | ||
).take(Double.class), | ||
Matchers.equalTo(cosPi) | ||
); | ||
} | ||
|
||
@Test | ||
public void cosPiDiv2() { | ||
final double cosPiDiv2 = Math.cos(Math.PI / 2); | ||
MatcherAssert.assertThat( | ||
new Dataized( | ||
new EOfloat$EOcos( | ||
new Data.ToPhi(Math.PI / 2) | ||
) | ||
).take(Double.class), | ||
Matchers.equalTo(cosPiDiv2) | ||
); | ||
} | ||
|
||
@Test | ||
public void cosMinusPiDiv2() { | ||
final double cosMinusPiDiv2 = Math.cos(-Math.PI / 2); | ||
MatcherAssert.assertThat( | ||
new Dataized( | ||
new EOfloat$EOcos( | ||
new Data.ToPhi(-Math.PI / 2) | ||
) | ||
).take(Double.class), | ||
Matchers.equalTo(cosMinusPiDiv2) | ||
); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
eo-runtime/src/test/java/EOorg/EOeolang/EOfloatEOsinTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package EOorg.EOeolang; | ||
|
||
import org.eolang.Data; | ||
import org.eolang.Dataized; | ||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Test case for {@link EOfloat} | ||
*/ | ||
public final class EOfloatEOsinTest { | ||
|
||
@Test | ||
public void sin0() { | ||
final double sin0 = Math.sin(0); | ||
MatcherAssert.assertThat( | ||
new Dataized( | ||
new EOfloat$EOsin( | ||
new Data.ToPhi((double) 0) | ||
) | ||
).take(Double.class), | ||
Matchers.equalTo(sin0) | ||
); | ||
} | ||
|
||
@Test | ||
public void sinPi() { | ||
final double sinPi = Math.sin(Math.PI); | ||
MatcherAssert.assertThat( | ||
new Dataized( | ||
new EOfloat$EOsin( | ||
new Data.ToPhi(Math.PI) | ||
) | ||
).take(Double.class), | ||
Matchers.equalTo(sinPi) | ||
); | ||
} | ||
|
||
@Test | ||
public void sinPiDiv2() { | ||
final double sinPiDiv2 = Math.sin(Math.PI / 2); | ||
MatcherAssert.assertThat( | ||
new Dataized( | ||
new EOfloat$EOsin( | ||
new Data.ToPhi(Math.PI / 2) | ||
) | ||
).take(Double.class), | ||
Matchers.equalTo(sinPiDiv2) | ||
); | ||
} | ||
|
||
@Test | ||
public void sinMinusPiDiv2() { | ||
final double sinMinusPiDiv2 = Math.sin(-Math.PI / 2); | ||
MatcherAssert.assertThat( | ||
new Dataized( | ||
new EOfloat$EOsin( | ||
new Data.ToPhi(-Math.PI / 2) | ||
) | ||
).take(Double.class), | ||
Matchers.equalTo(sinMinusPiDiv2) | ||
); | ||
} | ||
} |