From 8ba5fd9ad345212470dba1669091f43b4d33c0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Kl=C3=B6wer?= Date: Sun, 5 Feb 2023 22:26:47 -0500 Subject: [PATCH 1/3] Base. for promote_rule --- src/float8.jl | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/src/float8.jl b/src/float8.jl index 98e3160..33eee07 100644 --- a/src/float8.jl +++ b/src/float8.jl @@ -198,22 +198,12 @@ function prevfloat(x::T) where {T<:AbstractFloat8} end end -promote_rule(::Type{Float8}, ::Type{Float64}) = Float64 -promote_rule(::Type{Float8}, ::Type{Float32}) = Float32 -promote_rule(::Type{Float8}, ::Type{Float16}) = Float16 - -promote_rule(::Type{Float8}, ::Type{Int64}) = Float8 -promote_rule(::Type{Float8}, ::Type{Int32}) = Float8 -promote_rule(::Type{Float8}, ::Type{Int16}) = Float8 - -promote_rule(::Type{Float8}, ::Type{Bool}) = Float8 - -promote_rule(::Type{Float8_4}, ::Type{Float64}) = Float64 -promote_rule(::Type{Float8_4}, ::Type{Float32}) = Float32 -promote_rule(::Type{Float8_4}, ::Type{Float16}) = Float16 - -promote_rule(::Type{Float8_4}, ::Type{Int64}) = Float8 -promote_rule(::Type{Float8_4}, ::Type{Int32}) = Float8 -promote_rule(::Type{Float8_4}, ::Type{Int16}) = Float8 - -promote_rule(::Type{Float8_4}, ::Type{Bool}) = Float8 +Base.promote_rule(::Type{Float8},::Type{Float16}) = Float16 +Base.promote_rule(::Type{Float8},::Type{Float32}) = Float32 +Base.promote_rule(::Type{Float8},::Type{Float64}) = Float64 +Base.promote_rule(::Type{Float8},::Type{<:Integer}) = Float8 + +Base.promote_rule(::Type{Float8_4},::Type{Float16}) = Float16 +Base.promote_rule(::Type{Float8_4},::Type{Float32}) = Float32 +Base.promote_rule(::Type{Float8_4},::Type{Float64}) = Float64 +Base.promote_rule(::Type{Float8_4},::Type{<:Integer}) = Float8_4 From e9e938bc8f57007e58b2244a8769fb68548fe1fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Kl=C3=B6wer?= Date: Mon, 6 Feb 2023 12:06:25 -0500 Subject: [PATCH 2/3] Other CI ymls removed --- .appveyor.yml | 42 ------------------------------------------ .cirrus.yml | 17 ----------------- .gitignore | 6 ++++++ .travis.yml | 19 ------------------- Manifest.toml | 2 -- 5 files changed, 6 insertions(+), 80 deletions(-) delete mode 100644 .appveyor.yml delete mode 100644 .cirrus.yml delete mode 100644 .travis.yml delete mode 100644 Manifest.toml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index e5408b4..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,42 +0,0 @@ -environment: - matrix: - - julia_version: 1 - - julia_version: 1.3 - - julia_version: nightly - -platform: - - x64 # 64-bit - -# Uncomment the following lines to allow failures on nightly julia -# (tests will run but not make your overall status red) -matrix: - allow_failures: - - julia_version: nightly - -branches: - only: - - master - - /release-.*/ - -notifications: - - provider: Email - on_build_success: false - on_build_failure: false - on_build_status_changed: false - -install: - - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) - -build_script: - - echo "%JL_BUILD_SCRIPT%" - - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" - -test_script: - - echo "%JL_TEST_SCRIPT%" - - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" - -# # Uncomment to support code coverage upload. Should only be enabled for packages -# # which would have coverage gaps without running on Windows -# on_success: -# - echo "%JL_CODECOV_SCRIPT%" -# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%" diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index 80a837b..0000000 --- a/.cirrus.yml +++ /dev/null @@ -1,17 +0,0 @@ -freebsd_instance: - image: freebsd-12-0-release-amd64 -task: - name: FreeBSD - env: - matrix: - - JULIA_VERSION: 1.0 - - JULIA_VERSION: 1.3 - - JULIA_VERSION: nightly - install_script: - - sh -c "$(fetch https://raw.githubusercontent.com/ararslan/CirrusCI.jl/master/bin/install.sh -o -)" - build_script: - - cirrusjl build - test_script: - - cirrusjl test - coverage_script: - - cirrusjl coverage codecov coveralls diff --git a/.gitignore b/.gitignore index 9bd3242..5428c71 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ .DS_Store *.jld *.nc + +# File generated by Pkg, the package manager, based on a corresponding Project.toml +# It records a fixed state of all packages used by the project. As such, it should not be +# committed for packages, but should be committed for applications that require a static +# environment. +Manifest.toml \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e2657a8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Documentation: http://docs.travis-ci.com/user/languages/julia/ -language: julia -os: - - linux - - osx -julia: - - 1.0 - - 1.3 - - nightly -notifications: - email: false -git: - depth: 99999999 - -## uncomment the following lines to allow failures on nightly julia -## (tests will run but not make your overall status red) -matrix: - allow_failures: - - julia: nightly diff --git a/Manifest.toml b/Manifest.toml deleted file mode 100644 index f45eecf..0000000 --- a/Manifest.toml +++ /dev/null @@ -1,2 +0,0 @@ -# This file is machine-generated - editing it directly is not advised - From 686019e9f95a98eb507484d752c36ee215874ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Kl=C3=B6wer?= Date: Mon, 6 Feb 2023 12:06:35 -0500 Subject: [PATCH 3/3] promotion tests added --- test/runtests.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 6b3d46d..3652554 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -342,3 +342,13 @@ end @test -zero(Float8) == sign(-zero(Float8)) @test -zero(Float8_4) == sign(-zero(Float8_4)) end + +@testset "Promotion" begin + @test Float8(2)*Float16(2) == Float16(4) + @test Float8(2)*Float32(2) == Float32(4) + @test Float8(2)*Float64(2) == Float64(4) + + @test true*Float8(2) == Float8(2) + @test false*Float8(2) == zero(Float8) + @test 2*Float8(2) == Float8(4) +end \ No newline at end of file