Skip to content

Commit

Permalink
apply Jaroslav fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryTravis committed Feb 29, 2024
1 parent 28fd13b commit e04fcf1
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ public HostAccess allWithTypeMapping() {
.allowIteratorAccess(true)
.allowMapAccess(true)
.allowAccessInheritance(true)
.targetTypeMapping(
Long.class,
Double.class,
(v) -> v != null && !longInSafeDoubleRange(v, LONG_MAX_SAFE_DOUBLE),
(v) -> Double.longBitsToDouble(v))
.build();
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.enso.base.numeric;

public class Number_Utils {
// For testing only.
public static Double floatId(Double d) {
return d;
}
}
81 changes: 0 additions & 81 deletions test/Base_Tests/src/Data/Decimal_Spec.enso

This file was deleted.

65 changes: 65 additions & 0 deletions test/Base_Tests/src/Data/Numbers_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import project.Data.Round_Spec

polyglot java import java.math.BigInteger
polyglot java import java.math.BigDecimal
polyglot java import org.enso.base.numeric.Number_Utils

Integer.is_even self = self % 2 == 0

Expand Down Expand Up @@ -39,6 +40,10 @@ type Complex_Comparator
Comparable.from (_:Complex) = Complex_Comparator
Comparable.from (_:Number) = Complex_Comparator

float_id : Float -> Float
float_id f =
Number_Utils.floatId f


add_specs suite_builder =
eps = 0.000001
Expand Down Expand Up @@ -701,6 +706,66 @@ add_specs suite_builder =
[x, y, z, w].each b->
a+b . should_equal 20

suite_builder.group "arithmetic" group_builder->
group_builder.specify "should be able to pass a Float to Java" <|
vs = []
+ [92233720368547758080.0]
+ [9223372036854777000.0]
+ [9223372036854776001.0]
+ [9223372036854776000.0]
+ [9223372036854775808.0]
+ [9223372036854775000.0]
+ [9223372036854774000.0]
+ [9223372036854700000.0]
+ [9223372036854000000.0]
+ [9223372000000000000.0]
+ [922337203685470000.0]
+ [92233720368547000.0]
+ [9223372036854700.0]
+ [922337203685470.0]
+ [92233720368547.0]
+ [9223372036854.0]
+ [922337203685.0]
+ [92233720368.0]
+ [9223372036.0]
+ [922337203.0]
+ [92233720.0]
+ [9223372.0]
+ [922337.0]
+ [92233.0]
+ [9223.0]
+ [922.0]
+ [-92233720368547758080.0]
+ [-9223372036854777000.0]
+ [-9223372036854776001.0]
+ [-9223372036854776000.0]
+ [-9223372036854775808.0]
+ [-9223372036854775000.0]
+ [-9223372036854774000.0]
+ [-9223372036854700000.0]
+ [-9223372036854000000.0]
+ [-9223372000000000000.0]
+ [-922337203685470000.0]
+ [-92233720368547000.0]
+ [-9223372036854700.0]
+ [-922337203685470.0]
+ [-92233720368547.0]
+ [-9223372036854.0]
+ [-922337203685.0]
+ [-92233720368.0]
+ [-9223372036.0]
+ [-922337203.0]
+ [-92233720.0]
+ [-9223372.0]
+ [-922337.0]
+ [-92233.0]
+ [-9223.0]
+ [-922.0]

vs.map v->
r = float_id v
r . should_equal v

main filter=Nothing =
suite = Test.build suite_builder->
add_specs suite_builder
Expand Down

0 comments on commit e04fcf1

Please sign in to comment.